_ _ _ ____ _
| | | | __ _ ___| | _| __ ) ___ | |_
| |_| |/ _` |/ __| |/ / _ \ / _ \| __| By: Morpheuslord
| _ | (_| | (__| <| |_) | (_) | |_ AI used: Meta-LLama2
|_| |_|\__,_|\___|_|\_\____/ \___/ \__|
欢迎使用 HackBot,一个由人工智能驱动的网络安全聊天机器人,旨在为您提供有关网络安全问题的有用且准确的答案,同时还能进行代码分析和扫描分析。无论您是安全研究人员、白帽黑客,还是仅仅对网络安全感到好奇,HackBot 都能帮助您找到所需的信息。
HackBot 通过 "LlamaCpp" 库使用了强大的语言模型 Meta-LLama2。这使得 HackBot 能够以连贯且相关的方式回答您的问题。请确保您的查询使用英语,并遵守提供的指南,以便从 HackBot 获得最佳结果。
AI_OPTION 部分来连接它们,对于 Runpod,您需要使用 RUNPOD,对于 本地 Llama 部署 LOCALLLAMA。 RUNPOD 和 LOCALLLAMARUNPOD ID 和您的 RUNPOD API KEY。使用 LLama2 是目前最好的离线免费选项之一。它目前正在改进中,我正在开发一个提示,以更好地将网络安全视角融入 AI。 我必须感谢 @thisserand 和他的 llama2_local 仓库,以及他的 YT 视频 YT_Video。它们是很好的资源。坦白说,llama2 代码 95% 是他的,我只是复制了代码并添加了 Flask API 功能。
AI 离线及代码测试外的准确性很好,与 openai 或 bard 相当,但在代码中遇到了一些问题,可能是因为提示等原因。我会尝试修复。
速度取决于您的系统以及您拥有的 GPU 和 CPU 配置。目前,它使用 TheBloke/Llama-2-7B-Chat-GGML 模型,可以通过 portscanner 和 dnsrecon 文件更改。
目前,llama 代码和扫描的处理方式不同。经过几次测试,我发现 llama 需要一些训练才能按我预期的方式工作,所以需要一些时间。任何关于如何做到这一点的建议都可以添加到此仓库的讨论中 讨论链接。目前,输出不会是对所有数据的分类列表,而是对 AI 发现的漏洞或问题的解释。
模型使用的提示如下:
[INST] <<SYS>> {user_instruction}<</SYS>> NMAP Data to be analyzed: {user_message} [/INST]
指令如下:
Do a NMAP scan analysis on the provided NMAP scan information. The NMAP output must return in a asked format accorging to the provided output format. The data must be accurate in regards towards a pentest report.
The data must follow the following rules:
1) The NMAP scans must be done from a pentester point of view
2) The final output must be minimal according to the format given.
3) The final output must be kept to a minimal.
4) If a value not found in the scan just mention an empty string.
5) Analyze everything even the smallest of data.
6) Completely analyze the data provided and give a confirm answer using the output format.
7) mention all the data you found in the output format provided so that regex can be used on it.
8) avoid unnecessary explaination.
9) the critical score must be calculated based on the CVE if present or by the nature of the services open
10) the os information must contain the OS used my the target.
11) the open ports must include all the open ports listed in the data[tcp] and varifying if it by checking its states value. you should not negect even one open port.
12) the vulnerable services can be determined via speculation of the service nature or by analyzing the CVE's found.
The output format:
critical score:
- Give info on the criticality
"os information":
- List out the OS information
"open ports and services":
- List open ports
- List open ports services
"vulnerable service":
- Based on CVEs or nature of the ports opened list the vulnerable services
"found cve":
- List the CVE's found and list the main issues.
通过提示提供的指令集和数据,llama AI 生成其输出。
对于大多数使用场景,我建议您创建一个 llama 的 runpod 无服务器端点部署,您可以参考本教程 教程。按照教程使用会更好。



在开始安装之前,请确保您具备以下前提条件:
pip3 包管理器Visual Studio Code - 按照此链接中的步骤操作 llama-cpp-prereq-install-instructionscmakegit clone https://github.com/morpheuslord/hackbot.git
cd hackbot
pip3 install -r requirements.txt
python3 hackbot.py
第一次运行 HackBot 时,它会检查聊天机器人所需的 AI 模型。如果模型不存在,它将自动下载并保存为项目目录中的 "llama-2-7b-chat.ggmlv3.q4_0.bin"。
要开始与 HackBot 对话,请运行以下命令:
.env 文件必须如下所示:
RUNPOD_ENDPOINT_ID = ""
RUNPOD_API_KEY = ""
AI_OPTION = "LLAMALOCAL"
完成上述步骤后,运行以下命令:
python hackbot.py
.env 文件必须如下所示:
RUNPOD_ENDPOINT_ID = "<<SERVERLESS ENDPOINT ID>>"
RUNPOD_API_KEY = "<<RUNPOD API KEY>>"
AI_OPTION = "RUNPOD"
完成上述步骤后,运行以下命令:
python3 hackbot.py
HackBot 将显示一个横幅并等待您的输入。您可以提出与网络安全相关的问题,HackBot 会给出信息丰富的回答。要退出聊天,只需在输入提示符中输入 "quit_bot"。
以下是一些您可以使用的其他命令:
clear_screen:清除控制台屏幕,以提高可读性。quit_bot:用于退出聊天应用程序。bot_banner:打印默认的机器人横幅。contact_dev:提供我的联系信息。save_chat:保存当前会话的交互记录。vuln_analysis:使用扫描数据或日志文件进行漏洞分析。static_code_analysis:使用扫描数据或日志文件进行静态代码分析。注意: 我正在开发更多插件和类似命令,以提供更接近 chatGPT 的体验。
请注意: HackBot 的响应基于 Meta-LLama2 AI 模型,其准确性取决于提供给它的查询和数据的质量。
我也在致力于 AI 训练,通过训练我可以教会它如何更精确地调整,以便在更专业的层面上为黑客服务。
我们欢迎贡献以改进 HackBot 的功能和准确性。如果您遇到任何问题或有改进建议,请随时提出问题或提交拉取请求。请按照以下步骤贡献:
main 分支打开一个拉取请求。请保持干净的提交历史记录,并遵守项目的编码指南。
如果有人具备训练文本生成模型的知识,可以帮助改进代码。对于 AI 训练部分,我已经准备了一个数据集和一个可运行的训练代码,但我在训练部分遇到了问题,如果能得到协作将不胜感激。
您可以在以下位置查看数据集:
GitHub 版本的数据集用于 OpenAI 训练,另一个用于来自 meta 的 Llama2-7b。该数据集的目标是尝试生成一个能够更好地处理 CVE 数据的 AI 模型。如果您觉得数据集有所欠缺,请随意修改并分享您的看法。
如有任何关于 HackBot 的问题、反馈或咨询,请随时联系项目维护者: