Skip to main content
Glama

https://github.com/user-attachments/assets/ba467fae-a4c9-4f63-b2e6-3fc30fb023f3

🔐 GEMMA-by-GOOGLE — HALO

一个完全本地的自主AI渗透测试代理——Gemma 4-12B驱动42种工具,覆盖侦察、攻击和报告,以标准Model Context Protocol (MCP)服务器形式提供。无需云服务,无需API密钥。

功能 · 工具库 · 架构 · 技术栈 · 快速入门 · 变更日志 · 贡献指南

License Python Tools LM Studio Platform PRs Welcome GEMMA-by-GOOGLE MCP server


HALO是一个自主安全代理,运行在由本地LLM——Gemma 4-12B(未审查/去审查版)——通过LM Studio提供的Linux环境中。它会规划、执行侦察、根据发现链式攻击,并自行撰写专业渗透测试报告。一切都在本地运行:无云服务、无API密钥,不会泄露任何信息到机器之外。

一个词即可启动一次渗透:engage。


功能

  • 🔍 自主侦察 — 使用masscan和nmap发现开放端口和服务

  • ⚔️ 自主攻击循环 — 根据发现选择并组合工具

  • 🌐 Web侦察→攻击流程 — 从顶级域名到URL枚举(子域名、 主机、历史URL)、内容发现、模板扫描和XSS,并在CTF式Web目标上自动捕获标志

  • ✅ 验证过的入侵,而非横幅 — 每次攻击尝试都带有一次性挑战/随机数, 漏洞利用必须从已入侵的shell内部回应;仅靠uid=0横幅或诱捕无法伪造, 因此确认的入侵是真实的(基于执行证据,在关卡处一次性消费)

  • 🎯 精选PoC库 — 确定性、自证性的漏洞利用 (vsftpd 2.3.4、ingreslock、UnrealIRCd)通过沙箱化交付原语触发, 返回真实shell而非猜测

  • 🧠 持久化负面经验缓存 — 跨所有会话学习失败的攻击, 避免在已验证的死路上浪费循环

  • 🧩 自适应技能注入 — 基于当前目标加载相关攻击手册到提示中

  • 📝 自动HTML报告 — 退出时将发现编译为品牌化报告

  • 🔒 100%本地 — Gemma 4-12B在LM Studio中;不对外泄露任何信息


Related MCP server: Debugg AI MCP

工具库

42个工具位于代理决策循环之后,所有工具都通过相同的失败缓存层路由。它们在halo_tools.py中的TOOLS模式注册表中定义一次,并通过两种传输(MCP和HTTP)提供。

侦察与OSINT

工具

目的

run_subfinder

子域名枚举

run_theharvester

被动OSINT — 邮箱、子域名、主机

run_httpx

HTTP探测和指纹识别

run_katana

Web爬取

run_sherlock

跨90多个平台的用户名OSINT

run_shodan

互联网暴露情报查询

run_phoneinfoga

电话号码OSINT

run_phonextract

电话号码OSINT/提取

run_ghosttrack

用户名/IP/电话OSINT

run_cloudfox

云基础设施枚举

run_wafw00f

WAF/安全解决方案指纹识别

run_amass

子域名枚举(默认为被动模式)

run_dnsx

DNS解析和探测

run_gau

从OTX/Wayback/Common Crawl获取已知URL

run_waybackurls

从Wayback Machine获取历史URL

run_gowitness

Web截图用于视觉侦察

run_spiderfoot

无头多模块OSINT扫描

run_recon_ng

recon-ng OSINT框架(非交互)

扫描

工具

目的

run_masscan

快速端口发现

run_nmap

深度服务/版本扫描

run_nikto

Web漏洞扫描

run_nuclei

基于模板的漏洞扫描

run_netstat

网络连接分析

Web与模糊测试

工具

目的

run_gobuster

Web目录暴力破解

run_ffuf

Web模糊测试

run_feroxbuster

递归内容发现

run_dalfox

XSS扫描(反射/存储/DOM)

run_curl

HTTP请求测试

run_wget

文件下载

漏洞利用

工具

目的

run_sqlmap

SQL注入测试

run_searchsploit

漏洞查找

run_metasploit

向目标触发选定的Metasploit模块(人工批准)

run_exploit

沙箱化执行自定义PoC脚本

run_setoolkit

社会工程学工具包

凭据

工具

目的

run_hydra

凭据暴力破解

run_ncrack

网络认证破解

run_medusa

快速并行暴力破解

run_john

哈希破解

枚举与系统

工具

目的

run_enum4linux

SMB/Samba枚举

run_command

任意命令执行

read_file

读取文件内容

write_file

将输出写入文件


架构

一个统一的工具引擎(halo_tools.py)拥有工具库及其模式;两个轻量传输层位于其上方,因此工具只定义一次:

   agent_loop.py ──HTTP─►  tool_server.py ─┐
                                            ├─►  halo_tools.py  ──►  security tools
   MCP clients  ──stdio►  mcp_server.py  ──┘   (42-tool engine +
                                                 schema registry)
     │
     ├─►  agent_cache.py         (persistent negative-experience cache)
     ├─►  skills.py              (adaptive playbook injection)
     └─►  report_generator.py    (auto HTML pentest report on exit)
  • mcp_server.py — 一个符合规范的Model Context Protocol服务器 (stdio、JSON-RPC 2.0)。将任何MCP客户端(Claude Desktop、IDE代理、 inspector)或MCP注册表指向它,即可将HALO的工具库作为标准工具使用。

  • tool_server.py — 本地Flask HTTP工具服务器(端口8000), 供自主代理循环驱动。

将HALO用作MCP服务器

// e.g. an MCP client config
{
  "mcpServers": {
    "halo": { "command": "python3", "args": ["/abs/path/to/mcp_server.py"] }
  }
}

可直接提交的注册表清单位于 server.json。

多代理层

攻击由一组专家代理协调,它们通过共享消息模式(agent_schema.py)通信:

代理

角色

planner_agent.py

将目标转换为有序计划

orchestrator_agent.py

将任务路由到正确的专家

vuln_discovery_agent.py

发现候选漏洞

attacker_agent.py

分支到漏洞类专家(SQLi、暴力破解、IDOR、SSRF、XSS、auth)

validator_agent.py

根据真实证据确认发现后才计入

debugger_agent.py

诊断失败的工具调用并调整

自主代理层

负面经验缓存对每个工具调用进行指纹识别。调用失败则重试一次;两次失败即加入黑名单, 因此代理会转向更实用的工具。在攻击过程中,代理结构化自身的试错学习——建立上下文、 避免重复死路、智能升级——而不是重复运行已验证无效的操作。

验证过的入侵,而非直觉

自主攻击者面临的难题是如何知道它确实入侵了,还是只是复读了有希望的横幅。 HALO通过挑战-响应关卡解决这个问题:

  • 编排器在触发前铸造每次尝试的随机数,绑定到目标及确切payload哈希。

  • 只有当工具输出包含结构化的HALO-EVIDENCE nonce=… level=…行, 且回显那个随机数时,入侵才计入——而交付原语(pocs/_delivery.py) 只能通过在实际声称的shell内部运行代码来产生。

  • 随机数是一次性消费的:关卡(exploitation_core.py:breach_confirmed) 会拒绝重放或从未铸造的随机数,因此诱捕、反射字符串或静态uid=0横幅无法伪造确认。

pocs/中的精选PoC是确定性、自证性的漏洞 (vsftpd 2.3.4、ingreslock 1524、UnrealIRCd 3.2.8.1),它们诚实地通过此关卡—— 要么获得真实root shell,要么报告无结果。


构建历程

HALO由一位自学成才的开发者和安全研究员独立开发,在不到六个月内从零开始构建。 多代理核心逐个专家构建,每个专家都先在真实目标上验证后才继续:

  • 共享语言: 通用消息模式(agent_schema.py),使代理能够互相通信

  • Planner: 将目标转换为有序计划,并通过实时LM Studio验证

  • 编排器: 将每个任务路由到正确的专家

  • 漏洞发现: 发现候选漏洞,针对实时Metasploitable目标测试

  • 攻击者: 分支到SQLi/暴力破解/IDOR/SSRF/XSS/auth专家

  • 调试器: 诊断失败的工具运行并调整

  • 验证器+报告: 发现经过真实证据确认后才计入,然后编译为客户可读的报告

此后,工具库扩展到42个工具,包括完整的Web侦察→攻击流程(含标志捕获), 以及挑战-响应式入侵确认,而负面经验缓存将试错转化为跨会话的持久学习。 持续开发中——新功能定期推送;已发布里程碑参见变更日志。


技术栈

  • 模型: Gemma 4-12B Instruct Abliterated(通过LM Studio提供GGUF)—— 可搭配您选择的任何本地模型

  • 代理: 使用MCP工具调用的Python自主循环

  • 工具传输: 一个Model Context Protocol服务器(stdio)用于MCP客户端, 以及一个Flask HTTP工具服务器(端口8000)用于代理循环

  • 操作系统: Kali Linux(在Apple Silicon M1上的UTM中测试)

  • 硬件参考: MacBook Pro M1,16 GB RAM


快速入门

完整设置请参阅 docs/QUICKSTART.md。简而言之:

git clone https://github.com/XenoCoreGiger31/GEMMA-by-GOOGLE.git
cd GEMMA-by-GOOGLE
python3 -m pip install -r requirements.txt

cp engagement.example.yaml engagement.yaml   # then fill in authorization + scope_targets

python3 tool_server.py      # terminal 1 — HTTP tool server on port 8000
python3 agent_loop.py       # terminal 2 — the agent

>>> engage 203.0.113.3     # full autonomous recon + attack
>>> run nmap on 10.0.0.1    # single-goal query
>>> exit                    # triggers HTML report generation

注意: 端点和路径默认采用标准的本地配置(LM Studio 位于 localhost:1234,HTTP 工具服务器位于 localhost:8000)。你可以通过 HALO_* 环境变量覆盖其中任意一项——请参阅 环境覆盖 表格。少数作者专属的 日志/缓存路径默认值仍保留在 agent_cache.py 和 tool_server.py 中;这些环境变量同样涵盖它们。

没有 engagement.yaml,agent_loop.py 将无法启动——它是每次工具调用 都必须经过的授权与作用域门禁,而不是可选的配置。 请参阅 快速入门第 5 步。


运行测试

单元测试使用 Python 内置的 unittest,无需额外依赖:

python3 -m unittest

贡献指南

欢迎来自安全、AI 和 Python 社区的贡献——请参阅 CONTRIBUTING.md。如果你觉得这个仓库有用,请给它点个 Star, 或者提交一个 PR,让我们一起构建更多内容。

本项目由一位独立、自学的开发者和安全研究员积极推进。 新功能会定期推送。


免责声明与法律说明

本文由独立开发者发起的社区项目。它与 Google LLC 没有任何关联, 未获得其认可,也未受其赞助。 “Gemma” 是 Google LLC 的商标。

⚠️ 内容警告: 所引用的模型经过了深度去约束处理(abliterated), 将在缺少常规防护措施的情况下响应敏感请求。请负责任地使用,并仅在合适环境中使用。

🔒 法律警告: 本工具仅限于已授权的渗透测试和安全研究,且测试对象 只能是你拥有或经明确书面许可授权的系统。未经授权的使用是不合法的。

License

使用 MIT License 发布。

Available Tools

29 tools
read_fileB

Read and return the contents of a file.

Inputs: filename (required).

run_cloudfoxB

Enumerate the attack surface of an AWS environment.

Inputs: profile, command_type.

run_commandB

Execute an arbitrary shell command with sudo auto-escalation on permission errors.

Inputs: command (required).

run_curlB

Issue an HTTP request and return the verbose response.

Inputs: url (required), data, method, headers.

run_enum4linuxB

Enumerate SMB/Samba shares, users, and policies on a host.

Inputs: target (required).

run_exploitA

LAST RESORT: run a custom Python PoC in the isolated sandbox runner. Requires operator approval upstream.

Inputs: code (required), phase, target, timeout.

run_ffufC

Fast web fuzzer for directories, parameters, and vhosts.

Inputs: url (required), param, wordlist.

run_gobusterC

Brute-force web content, DNS, or vhosts against a wordlist.

Inputs: target (required), mode, wordlist.

run_httpxB

Probe hosts for live HTTP services (status, title, tech detection).

Inputs: target (required), flags.

run_hydraB

Parallelized network login brute-forcer across many protocols.

Inputs: target (required), username (required), service, threads, +1 more.

run_johnC

Crack password hashes with John the Ripper against a wordlist.

Inputs: hash_file (required), format, wordlist.

run_katanaC

Crawl a web target and map its attack surface.

Inputs: target (required), depth.

run_masscanB

High-speed asynchronous TCP port scan of a target or CIDR range.

Inputs: target (required), rate, ports.

run_medusaC

Fast, parallel, modular network login brute-forcer.

Inputs: target (required), username (required), service, wordlist.

run_ncrackC

High-speed network authentication cracking.

Inputs: target (required), users, service, wordlist.

run_netstatC

List network connections and listening sockets (falls back to 'ss').

Inputs: flags.

run_niktoC

Scan a web server for known vulnerabilities and misconfigurations.

Inputs: target (required), ssl, port.

run_nmapA

Detailed port/service scan with version and script detection.

Inputs: target (required), flags.

run_nucleiB

Run community vulnerability templates against a target.

Inputs: target (required), severity, templates.

run_phoneinfogaB

OSINT footprinting of a phone number (carrier, region, formatting).

Inputs: number (required).

run_searchsploitB

Search the Exploit-DB archive for known exploits by keyword.

Inputs: keyword (required), type.

run_setoolkitC

Drive the Social-Engineer Toolkit for a scripted attack scenario.

Inputs: target (required), attack_type.

run_sherlockB

Hunt a username across social networks and public sites.

Inputs: username (required).

run_shodanB

Look up an internet-exposed host in Shodan (open ports, services, banners).

Inputs: query (required).

run_sqlmapC

Automated SQL injection detection and exploitation against a URL.

Inputs: target (required), dbms, risk, level, +1 more.

run_subfinderB

Passively enumerate subdomains of a domain.

Inputs: domain (required), silent.

run_wafw00fA

Fingerprint the web application firewall / security solution in front of a target.

Inputs: target (required).

run_wgetC

Download a file or mirror content from a URL.

Inputs: url (required), output, recursive.

write_fileA

Write content to a file, escalating to sudo if the path is protected.

Inputs: filename (required), content.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 29 tools

    Disambiguation4/5

    Tools cover distinct security testing subdomains, but several have overlapping purposes (e.g., multiple brute-forcers and port scanners). Descriptions help differentiate them, reducing confusion.

    Naming Consistency2/5

    Most tools follow a 'run_<toolname>' pattern, but 'read_file' and 'write_file' break the convention, creating inconsistency.

    Tool Count4/5

    29 tools is on the high side for a penetration testing toolkit but remains within reasonable scope for comprehensive coverage.

    Completeness3/5

    Covers major security testing areas (scanning, brute-force, web, OSINT), but lacks post-exploitation and some common utilities like DNS enumeration, leaving notable gaps.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers