找回密码
立即注册
搜索
热搜: Java Python Linux Go
发回帖 发新帖

2298

积分

0

好友

321

主题
发表于 3 天前 | 查看: 9| 回复: 0

afrog 是一款性能卓越、快速稳定、PoC 可定制的漏洞扫描工具,其 PoC 涵盖 CVE、CNVD、默认口令、信息泄露、指纹识别、未授权访问、任意文件读取、命令执行等多种漏洞类型,能有效帮助网络安全从业者快速验证并及时修复漏洞。

什么是 afrog

功能特性

核心特性

  • 开源
  • 快速、稳定、误报率低
  • 详细的 HTML 漏洞报告
  • 可定制且可稳定更新的 PoCs
  • 活跃的社区交流群

安装环境准备

前置要求

Go 环境
需要 Go 版本 1.19 或更高版本。

在 Kali Linux 系统下安装会相对简单,使用 apt-get 命令即可完成,安装后无需额外配置环境变量。

安装命令如下:

# 切换到 root 角色
sudo su
# 更新资源
apt-get update
# 安装 golang
apt-get install golang-go
# 查看安装版本
go version

安装 afrog

三种安装方式

方式一:Binary 直接使用

  1. 访问 afrog Releases 页面,下载最新的 afrog_xxx_linux_amd64.zip 压缩包。
  2. 将下载的压缩包复制到 Kali 系统中,执行以下命令进行安装:
# 创建目录,复制下载的编译好的 zip 包到该目录下
mkdir afrog
# 切换到 afrog 目录下
cd afrog
# 解压压缩包
unzip afrog_3.0.7_linux_amd64.zip
# 删除压缩包
rm -rf afrog_3.0.7_linux_amd64.zip
# 查看版本号验证命令是否可正常使用
./afrog -v
# 更多命令使用参数 -h 查看
./afrog -h

方式二:Github 下载源码编译

# 切换到 tools 目录
cd tools
# 下载 afrog 源码
git clone https://github.com/zan8in/afrog.git
# 切换到 afrog 源码目录
cd afrog
# 方式一:生成的执行文件是 afrog【建议使用】
go build -o afrog cmd/afrog/main.go
# 方式二:生成的执行文件是 main
go build cmd/afrog/main.go

方式三:Go 方式安装

go install -v github.com/zan8in/afrog/v3/cmd/afrog@latest

配置 afrog

配置文件与使用

配置文件位置
首次启动 afrog 时,它会自动在用户目录下的 $HOME/.config/afrog/ 路径中创建名为 afrog-config.yaml 的配置文件。

配置示例

reverse:
  ceye:
    api-key: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
    domain: “xxxxxx.cey2e.io”
  dnslogcn:
    domain: dnslog.cn
  alphalog:
    domain: dnslogxx.sh
    api_url: “http://dnslogxx.sh/”
  xray:
    x_token: “xraytest”
    domain: dnslogxx.sh
    api_url: “http://x.x.0.x:8777”
  revsuit:
    token: “xx”
    dns_domain: “log.xx.com”
    http_url: “http://x.x.x.x/log/”
    api_url: “http://x.x.x.x/helplog”

Ceye 配置

  1. 访问 ceye.io 网站并注册账号。
  2. 登录后,在个人设置页面复制 domainapi-key
  3. 使用 vim 等编辑器打开 afrog-config.yaml 配置文件,将复制的信息粘贴到对应位置。

基本使用方法

常用命令示例

扫描单个目标

./afrog -t https://example.com

默认情况下,afrog 会扫描所有内置 PoC。如果发现漏洞,将自动生成以扫描日期命名的 HTML 报告,并可在 Web 服务端查看;若无漏洞则不会生成报告。

扫描多个目标
将多个目标 URL 逐行写入文本文件(如 urls.txt),然后执行:

./afrog -T urls.txt

指定漏扫报告文件

./afrog -t http://127.0.0.1 -o report_result.html

测试 PoC

  • 测试单个 PoC 文件:
    ./afrog -t http://127.0.0.1 -P ./test/demo.yaml
  • 测试多个 PoC 文件:
    ./afrog -t http://127.0.0.1 -P ./test/

按 PoC 关键字扫描

./afrog -t http://127.0.0.1 -s tomcat,springboot,shiro

按 Poc 漏洞等级扫描

./afrog -t http://127.0.0.1 -S high,critical

在线更新 afrog-pocs

./afrog --up

禁用指纹识别,直接漏扫

./afrog -t http://127.0.0.1 --nf

扫描结果查看

报告查看方式

查看报告文件
扫描结果默认保存在 reports 目录下,使用浏览器打开生成的 HTML 文件即可查看详细漏洞信息。

启动 web 服务查看报告

./afrog --web

启动后,通过浏览器访问 http://x.x.x.x:16868 即可在网页端查看报告,并支持关键词搜索和按漏洞严重程度筛选。

高级用法

批量扫描脚本

Python 批量扫描脚本

import subprocess
import concurrent.futures
import os
import chardet
from bs4 import BeautifulSoup
import time

def read_file_auto_encoding(filename):
    “”“自动检测文件编码并读取内容”“”
    with open(filename, ‘rb’) as f:
        raw = f.read()
        result = chardet.detect(raw)
        encoding = result[‘encoding’] or ‘utf-8’
        try:
            return raw.decode(encoding)
        except Exception:
            return raw.decode(‘utf-8’, errors=‘replace’)

def remove_afrog_div(content):
    “”“使用 BeautifulSoup 移除<div class=‘top’>部分”“”
    soup = BeautifulSoup(content, ‘html.parser’)
    for div in soup.find_all(‘div’, class_=‘top’):
        div.decompose()
    return str(soup)

def run_afrog(url, idx):
    “”“执行 afrog 扫描任务”“”
    out_file = f“result_{idx}.html”
    command = f“afrog.exe -t {url} -oob dnslogcn -o {out_file} -rl 20 -c 5 -timeout 20 -retries 2”
    try:
        print(f“正在扫描: {url} (任务 {idx + 1})”)
        subprocess.run(command, shell=True, check=True, timeout=2500)
        print(f“成功扫描: {url}”)

        if os.path.exists(out_file):
            content = read_file_auto_encoding(out_file)
            # 处理扫描结果
            # …
    except subprocess.TimeoutExpired:
        print(f“扫描超时: {url}”)
    except Exception as e:
        print(f“扫描失败: {url}, 错误信息: {e}”)

# 读取目标文件
with open(‘urls.txt’, ‘r’, encoding=‘utf-8’) as f:
    urls = [line.strip() for line in f if line.strip()]

# 多线程扫描
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
    executor.map(run_afrog, urls, range(len(urls)))

注意事项

安全使用规范

合法性
使用 afrog 进行漏洞扫描前,必须确保已获得目标系统的明确授权,并严格遵守《中华人民共和国网络安全法》等相关法律法规。

准确性
扫描结果仅供参考,可能存在误报或漏报,建议结合其他信息收集手段进行综合研判。

更新
为了保持最佳的漏洞检测能力,建议定期更新 afrog 主程序及其 PoC 库。

性能
在进行大规模扫描时,应注意合理设置并发数、速率限制等参数,避免对目标系统造成不必要的压力或影响其正常服务。

总结

afrog 是一款功能强大且易于上手的漏洞扫描工具,非常适合网络安全从业者用于日常的漏洞检测与验证工作。

通过本文的讲解,你应该已经掌握了 afrog 的基本安装、配置和核心使用方法。在实际运用中,请务必牢记安全合规底线,在法律授权的范围内合理使用工具,共同维护网络空间安全。

欢迎在 云栈社区 与其他安全爱好者交流更多工具使用心得与实战技巧。

免责声明:本文内容仅供学习与参考。使用任何安全工具进行测试前,务必确保拥有合法授权。使用者应对其行为负全部责任。




上一篇:微服务架构下,如何突破数据库连接数瓶颈实现无限扩容?
下一篇:Python服务崩溃排查:从多线程切换到协程的稳定性优化实录
您需要登录后才可以回帖 登录 | 立即注册

手机版|小黑屋|网站地图|云栈社区 ( 苏ICP备2022046150号-2 )

GMT+8, 2026-1-14 14:15 , Processed in 0.290644 second(s), 39 queries , Gzip On.

Powered by Discuz! X3.5

© 2025-2025 云栈社区.

快速回复 返回顶部 返回列表