Skip to content

ffdba/nmap_AutomaticInspectionOfScanResults

Repository files navigation

AssetInspector - 资产巡检工具

GitHub Python

AssetInspector 是一款供安服工程师使用的资产巡检工具,用于解析 Nmap 扫描结果,自动识别资产类型(Web/TCP),收集资产信息,并导出 Excel 报告。

简介

  • Nmap解析: 支持解析标准Nmap扫描结果txt文件
  • 多线程扫描: 使用ThreadPoolExecutor进行并发扫描
  • 自动协议识别: 优先尝试HTTPS,失败再尝试HTTP
  • Web检测: 收集HTTP状态码、标题、Server头、响应时间等信息
  • TCP检测: 检测端口连通性(Connected/Timeout/Refused)
  • 指纹识别: 基于标题、Body、Header进行指纹匹配
  • 后台识别: 自动识别疑似后台管理系统
  • Excel导出: 自动列宽、冻结首行、颜色标识、过滤器

安装

git clone https://github.com/whoiscc/AssetInspector.git
cd AssetInspector
pip install -r requirements.txt

依赖

  • Python >= 3.10
  • requests >= 2.31.0
  • beautifulsoup4 >= 4.12.2
  • openpyxl >= 3.1.2

使用

基本用法

python asset_inspector.py scan.txt

命令行参数

python asset_inspector.py -h
usage: asset_inspector.py [-h] [-t THREADS] [-to TIMEOUT] [-o OUTPUT] input_file

AssetInspector - 资产巡检工具

positional arguments:
  input_file            Nmap扫描结果txt文件

optional arguments:
  -h, --help            show this help message and exit
  -t THREADS, --threads THREADS
                        线程数,默认 30
  -to TIMEOUT, --timeout TIMEOUT
                        超时时间(秒),默认 10
  -o OUTPUT, --output OUTPUT
                        输出文件名

示例

# 基本扫描
python asset_inspector.py nmap_scan.txt

# 指定线程数和超时时间
python asset_inspector.py -t 50 -to 5 nmap_scan.txt

# 指定输出文件名
python asset_inspector.py -o result.xlsx nmap_scan.txt

Excel说明

字段列表

字段 说明
URL 访问地址(http/https/tcp)
IP 主机IP地址
Port 端口号
Service 服务名称
Protocol 协议(HTTP/HTTPS/TCP)
Web 是否为Web服务
Status HTTP状态码
Title 页面标题
Fingerprint 指纹识别结果
Server Server头
Content-Type 内容类型
Length 内容长度
Location 跳转地址
Response(ms) 响应时间
Remark 备注信息
Suggestion 安全建议

颜色标识

  • 绿色 (200): HTTP 200 OK
  • 黄色 (301/302): 重定向
  • 橙色 (401/403): 认证/访问控制
  • 红色 (500): 服务器错误
  • 浅红: 疑似后台
  • 浅黄: 数据库服务

工程结构

AssetInspector/
├── asset_inspector.py     # 主入口
├── config.py              # 配置模块
├── logger.py              # 日志模块
├── nmap_parser.py         # Nmap解析模块
├── scanner.py             # 扫描模块
├── fingerprint.py         # 指纹识别模块
├── exporter.py            # Excel导出模块
├── fingerprints.json      # 指纹库
├── requirements.txt       # 依赖文件
├── .gitignore             # Git忽略文件
├── logs/                  # 日志目录(运行时生成)
└── output/                # 输出目录(运行时生成)

扩展指纹方法

方法一:直接编辑 fingerprints.json

{
  "MyApp": [
    "MyApp标识字符串",
    "X-Powered-By: MyApp"
  ]
}

方法二:通过代码添加

from fingerprint import FingerprintManager

fm = FingerprintManager("fingerprints.json")
fm.add_fingerprint("MyApp", ["MyApp标识"])
fm.save_fingerprints("fingerprints.json")

注意事项

  1. 本工具不是漏洞扫描器,仅进行资产信息收集
  2. 不进行爆破、漏洞利用或敏感目录扫描
  3. 仅进行最小化访问,避免对目标造成影响
  4. 建议在授权范围内使用
  5. 请勿扫描未经授权的目标

未来扩展

预留接口支持:

  • favicon hash 识别
  • whatweb 集成
  • httpx 替换 requests
  • Playwright 截图
  • ICP备案查询
  • TLS证书信息
  • CDN识别
  • FOFA/Hunter/Quake/Shodan API 集成

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

About

一款供安服工程师使用的资产巡检工具,用于解析 Nmap 扫描结果,自动识别资产类型(Web/TCP),收集资产信息,并导出 Excel 报告

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages