mcpField
S
Security Scanning Tools

Security Scanning Tools

github.com/davila7安全33.0k311 次安装1 天前更新
代码仓库

关于 Security Scanning Tools

这项技能整理了网络、漏洞、Web、无线、云和合规扫描工具的选择与使用流程,面向具备基础网络知识且获授权的安全人员。

主要功能

  1. 01网络发现与端口扫描
  2. 02漏洞与合规评估
  3. 03Web 应用安全测试
  4. 04无线网络扫描
  5. 05云安全审计
  6. 06扫描报告与方法

适用场景

  1. 01盘点网络主机、端口和服务
  2. 02评估系统漏洞与配置风险
  3. 03检查 Web 应用安全问题
  4. 04执行云环境或合规审计

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/davila7/claude-code-templates --skill security-scanning-tools

安装后在 Claude Code 中输入/security-scanning-tools确认已加载。

详细介绍

安全扫描工具

目的

掌握用于网络发现、漏洞评估、Web 应用测试、无线安全和合规性验证的核心安全扫描工具。本技能涵盖不同扫描类别中的工具选择、配置和实际使用。

前置条件

所需环境
  • 基于 Linux 的系统(推荐 Kali Linux)
  • 对目标系统的网络访问权限
  • 对扫描活动的适当授权
所需知识
  • 基础网络概念(TCP/IP、端口、协议)
  • 对常见漏洞的理解
  • 熟悉命令行界面

输出与交付物

  1. 网络发现报告 - 识别出的主机、端口和服务
  2. 漏洞评估报告 - CVE、错误配置、风险评级
  3. Web 应用安全报告 - OWASP Top 10 发现项
  4. 合规性报告 - CIS 基准、PCI-DSS、HIPAA 检查

核心工作流

阶段 1:网络扫描工具
Nmap(Network Mapper)

用于网络发现和安全审计的主要工具:

# Host discovery
nmap -sn 192.168.1.0/24              # Ping scan (no port scan)
nmap -sL 192.168.1.0/24              # List scan (DNS resolution)
nmap -Pn 192.168.1.100               # Skip host discovery

# Port scanning techniques
nmap -sS 192.168.1.100               # TCP SYN scan (stealth)
nmap -sT 192.168.1.100               # TCP connect scan
nmap -sU 192.168.1.100               # UDP scan
nmap -sA 192.168.1.100               # ACK scan (firewall detection)

# Port specification
nmap -p 80,443 192.168.1.100         # Specific ports
nmap -p- 192.168.1.100               # All 65535 ports
nmap -p 1-1000 192.168.1.100         # Port range
nmap --top-ports 100 192.168.1.100   # Top 100 common ports

# Service and OS detection
nmap -sV 192.168.1.100               # Service version detection
nmap -O 192.168.1.100                # OS detection
nmap -A 192.168.1.100                # Aggressive (OS, version, scripts)

# Timing and performance
nmap -T0 192.168.1.100               # Paranoid (slowest, IDS evasion)
nmap -T4 192.168.1.100               # Aggressive (faster)
nmap -T5 192.168.1.100               # Insane (fastest)

# NSE Scripts
nmap --script=vuln 192.168.1.100     # Vulnerability scripts
nmap --script=http-enum 192.168.1.100  # Web enumeration
nmap --script=smb-vuln* 192.168.1.100  # SMB vulnerabilities
nmap --script=default 192.168.1.100  # Default script set

# Output formats
nmap -oN scan.txt 192.168.1.100      # Normal output
nmap -oX scan.xml 192.168.1.100      # XML output
nmap -oG scan.gnmap 192.168.1.100    # Grepable output
nmap -oA scan 192.168.1.100          # All formats
Masscan

面向大型网络的高速端口扫描:

# Basic scanning
masscan -p80 192.168.1.0/24 --rate=1000
masscan -p80,443,8080 192.168.1.0/24 --rate=10000

# Full port range
masscan -p0-65535 192.168.1.0/24 --rate=5000

# Large-scale scanning
masscan 0.0.0.0/0 -p443 --rate=100000 --excludefile exclude.txt

# Output formats
masscan -p80 192.168.1.0/24 -oG results.gnmap
masscan -p80 192.168.1.0/24 -oJ results.json
masscan -p80 192.168.1.0/24 -oX results.xml

# Banner grabbing
masscan -p80 192.168.1.0/24 --banners
阶段 2:漏洞扫描工具
Nessus

企业级漏洞评估:

# Start Nessus service
sudo systemctl start nessusd

# Access web interface
# https://localhost:8834

# Command-line (nessuscli)
nessuscli scan --create --name "Internal Scan" --targets 192.168.1.0/24
nessuscli scan --list
nessuscli scan --launch <scan_id>
nessuscli report --format pdf --output report.pdf <scan_id>

Nessus 的主要功能:

  • 全面的 CVE 检测
  • 合规性检查(PCI-DSS、HIPAA、CIS)
  • 自定义扫描模板
  • 凭据扫描以实现更深入的分析
  • 定期插件更新
OpenVAS(Greenbone)

开源漏洞扫描:

# Install OpenVAS
sudo apt install openvas
sudo gvm-setup

# Start services
sudo gvm-start

# Access web interface (Greenbone Security Assistant)
# https://localhost:9392

# Command-line operations
gvm-cli socket --xml "<get_version/>"
gvm-cli socket --xml "<get_tasks/>"

# Create and run scan
gvm-cli socket --xml '
<create_target>
  <name>Test Target</name>
  <hosts>192.168.1.0/24</hosts>
</create_target>'
阶段 3:Web 应用扫描工具
Burp Suite

全面的 Web 应用测试:

# Proxy configuration
1. Set browser proxy to 127.0.0.1:8080
2. Import Burp CA certificate for HTTPS
3. Add target to scope

# Key modules:
- Proxy: Intercept and modify requests
- Spider: Crawl web applications
- Scanner: Automated vulnerability detection
- Intruder: Automated attacks (fuzzing, brute-force)
- Repeater: Manual request manipulation
- Decoder: Encode/decode data
- Comparer: Compare responses

核心测试工作流:

  1. 配置代理和范围
  2. 爬取应用程序
  3. 分析站点地图
  4. 运行主动扫描器
  5. 使用 Repeater/Intruder 进行手动测试
  6. 审查发现项并生成报告
OWASP ZAP

开源 Web 应用扫描器:

# Start ZAP
zaproxy

# Automated scan from CLI
zap-cli quick-scan https://target.com

# Full scan
zap-cli spider https://target.com
zap-cli active-scan https://target.com

# Generate report
zap-cli report -o report.html -f html

# API mode
zap.sh -daemon -port 8080 -config api.key=<your_key>

ZAP 自动化:

# Docker-based scanning
docker run -t owasp/zap2docker-stable zap-full-scan.py \
  -t https://target.com -r report.html

# Baseline scan (passive only)
docker run -t owasp/zap2docker-stable zap-baseline.py \
  -t https://target.com -r report.html
Nikto

Web 服务器漏洞扫描器:

# Basic scan
nikto -h https://target.com

# Scan specific port
nikto -h target.com -p 8080

# Scan with SSL
nikto -h target.com -ssl

# Multiple targets
nikto -h targets.txt

# Output formats
nikto -h target.com -o report.html -Format html
nikto -h target.com -o report.xml -Format xml
nikto -h target.com -o report.csv -Format csv

# Tuning options
nikto -h target.com -Tuning 123456789  # All tests
nikto -h target.com -Tuning x          # Exclude specific tests
阶段 4:无线扫描工具
Aircrack-ng 套件

无线网络渗透测试:

# Check wireless interface
airmon-ng

# Enable monitor mode
sudo airmon-ng start wlan0

# Scan for networks
sudo airodump-ng wlan0mon

# Capture specific network
sudo airodump-ng -c <channel> --bssid <target_bssid> -w capture wlan0mon

# Deauthentication attack
sudo aireplay-ng -0 10 -a <bssid> wlan0mon

# Crack WPA handshake
aircrack-ng -w wordlist.txt -b <bssid> capture*.cap

# Crack WEP
aircrack-ng -b <bssid> capture*.cap
Kismet

被动无线检测:

# Start Kismet
kismet

# Specify interface
kismet -c wlan0

# Access web interface
# http://localhost:2501

# Detect hidden networks
# Kismet passively collects all beacon frames
# including those from hidden SSIDs
阶段 5:恶意软件与漏洞利用扫描
ClamAV

开源杀毒扫描:

# Update virus definitions
sudo freshclam

# Scan directory
clamscan -r /path/to/scan

# Scan with verbose output
clamscan -r -v /path/to/scan

# Move infected files
clamscan -r --move=/quarantine /path/to/scan

# Remove infected files
clamscan -r --remove /path/to/scan

# Scan specific file types
clamscan -r --include='\.exe$|\.dll$' /path/to/scan

# Output to log
clamscan -r -l scan.log /path/to/scan
Metasploit 漏洞验证

通过漏洞利用验证漏洞:

# Start Metasploit
msfconsole

# Database setup
msfdb init
db_status

# Import Nmap results
db_import /path/to/nmap_scan.xml

# Vulnerability scanning
use auxiliary/scanner/smb/smb_ms17_010
set RHOSTS 192.168.1.0/24
run

# Auto exploitation
vulns                           # View vulnerabilities
analyze                         # Suggest exploits
阶段 6:云安全扫描
Prowler(AWS)

AWS 安全评估:

# Install Prowler
pip install prowler

# Basic scan
prowler aws

# Specific checks
prowler aws -c iam s3 ec2

# Compliance framework
prowler aws --compliance cis_aws

# Output formats
prowler aws -M html json csv

# Specific region
prowler aws -f us-east-1

# Assume role
prowler aws -R arn:aws:iam::123456789012:role/ProwlerRole
ScoutSuite(多云)

多云安全审计:

# Install ScoutSuite
pip install scoutsuite

# AWS scan
scout aws

# Azure scan
scout azure --cli

# GCP scan
scout gcp --user-account

# Generate report
scout aws --report-dir ./reports
阶段 7:合规性扫描
Lynis

面向 Unix/Linux 的安全审计:

# Run audit
sudo lynis audit system

# Quick scan
sudo lynis audit system --quick

# Specific profile
sudo lynis audit system --profile server

# Output report
sudo lynis audit system --report-file /tmp/lynis-report.dat

# Check specific section
sudo lynis show profiles
sudo lynis audit system --tests-from-group malware
OpenSCAP

安全合规性扫描:

# List available profiles
oscap info /usr/share/xml/scap/ssg/content/ssg-<distro>-ds.xml

# Run scan with profile
oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_pci-dss \
  --report report.html \
  /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml

# Generate fix script
oscap xccdf generate fix \
  --profile xccdf_org.ssgproject.content_profile_pci-dss \
  --output remediation.sh \
  /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
阶段 8:扫描方法论

结构化扫描方法:

  1. 规划

    • 定义范围和目标
    • 获取适当授权
    • 选择合适的工具
  2. 发现

    • 主机发现(Nmap ping 扫描)
    • 端口扫描
    • 服务枚举
  3. 漏洞评估

    • 自动化扫描(Nessus/OpenVAS)
    • Web 应用扫描(Burp/ZAP)
    • 手动验证
  4. 分析

    • 关联发现项
    • 消除误报
    • 按严重性排序
  5. 报告

    • 记录发现项
    • 提供修复指导
    • 执行摘要
阶段 9:工具选择指南

为每种场景选择合适的工具:

场景推荐工具
网络发现Nmap, Masscan
漏洞评估Nessus, OpenVAS
Web 应用测试Burp Suite, ZAP, Nikto
无线安全Aircrack-ng, Kismet
恶意软件检测ClamAV, YARA
云安全Prowler, ScoutSuite
合规性Lynis, OpenSCAP
协议分析Wireshark, tcpdump
阶段 10:报告与文档

生成专业报告:

# Nmap XML to HTML
xsltproc nmap-output.xml -o report.html

# OpenVAS report export
gvm-cli socket --xml '<get_reports report_id="<id>" format_id="<pdf_format>"/>'

# Combine multiple scan results
# Use tools like Faraday, Dradis, or custom scripts

# Executive summary template:
# 1. Scope and methodology
# 2. Key findings summary
# 3. Risk distribution chart
# 4. Critical vulnerabilities
# 5. Remediation recommendations
# 6. Detailed technical findings

快速参考

Nmap 速查表
扫描类型命令
Ping 扫描nmap -sn <target>
快速扫描nmap -T4 -F <target>
全端口扫描nmap -p- <target>
服务扫描nmap -sV <target>
操作系统检测nmap -O <target>
激进扫描nmap -A <target>
漏洞脚本nmap --script=vuln <target>
隐蔽扫描nmap -sS -T2 <target>
常见端口参考
端口服务
21FTP
22SSH
23Telnet
25SMTP
53DNS
80HTTP
443HTTPS
445SMB
3306MySQL
3389RDP

约束与限制

法律注意事项
  • 始终获取书面授权
  • 遵守范围边界
  • 遵循负责任的披露实践
  • 遵守当地法律法规
技术限制
  • 某些扫描可能触发 IDS/IPS 告警
  • 高强度扫描可能影响网络性能
  • 误报需要人工验证
  • 加密流量可能限制分析
最佳实践
  • 从非侵入式扫描开始
  • 逐步提高扫描强度
  • 记录所有扫描活动
  • 在报告前验证发现结果

故障排除

扫描未检测到主机

解决方案:

  1. 尝试不同的发现方法:nmap -Pn 或 nmap -sn -PS/PA/PU
  2. 检查阻止 ICMP 的防火墙规则
  3. 使用 TCP SYN 扫描:nmap -PS22,80,443
  4. 验证网络连通性
扫描性能缓慢

解决方案:

  1. 提高时序:nmap -T4 或 -T5
  2. 缩小端口范围:--top-ports 100
  3. 使用 Masscan 进行初步发现
  4. 禁用 DNS 解析:-n
Web 扫描器遗漏漏洞

解决方案:

  1. 进行身份验证以访问受保护区域
  2. 增加爬取深度
  3. 添加自定义注入点
  4. 使用多个工具以提高覆盖率
  5. 执行手动测试

评论

支持 Markdown