本文简单介绍如何使用Metasploit从文件中读取目标地址,来执行检测。

  以检测MS17-010漏洞为例,在设定RHOSTS参数时,可设定目标地址范围和CIDR地址块,设定单个IP的目标也是可以的。

  参考:Metasploit set rhosts file

msf > use auxiliary/scanner/smb/smb_ms17_010
msf auxiliary(smb_ms17_010) > show optionsModule options (auxiliary/scanner/smb/smb_ms17_010):Name        Current Setting  Required  Description----        ---------------  --------  -----------CHECK_DOPU  true             yes       Check for DOUBLEPULSAR on vulnerable hostsRHOSTS                       yes       The target address range or CIDR identifierRPORT       445              yes       The SMB service port (TCP)SMBDomain   .                no        The Windows domain to use for authenticationSMBPass                      no        The password for the specified usernameSMBUser                      no        The username to authenticate asTHREADS     1                yes       The number of concurrent threads

  但如何设定从文件中读取目标地址呢?

  其实可以使用file指定读取的目标文件...如下:

msf auxiliary(smb_ms17_010) > set rhosts file:/root/pentest/10-all.txt      # 设置读取的文件
rhosts => file:/root/pentest/10-all.txt
msf auxiliary(smb_ms17_010) > show optionsModule options (auxiliary/scanner/smb/smb_ms17_010):Name        Current Setting                Required  Description----        ---------------                --------  -----------CHECK_DOPU  true                           yes       Check for DOUBLEPULSAR on vulnerable hostsRHOSTS      file:/root/pentest/10-all.txt  yes       The target address range or CIDR identifierRPORT       445                            yes       The SMB service port (TCP)SMBDomain   .                              no        The Windows domain to use for authenticationSMBPass                                    no        The password for the specified usernameSMBUser                                    no        The username to authenticate asTHREADS     1                              yes       The number of concurrent threadsmsf auxiliary(smb_ms17_010) > set threads 10
threads => 10
msf auxiliary(smb_ms17_010) > show optionsModule options (auxiliary/scanner/smb/smb_ms17_010):Name        Current Setting                Required  Description----        ---------------                --------  -----------CHECK_DOPU  true                           yes       Check for DOUBLEPULSAR on vulnerable hostsRHOSTS      file:/root/pentest/10-all.txt  yes       The target address range or CIDR identifierRPORT       445                            yes       The SMB service port (TCP)SMBDomain   .                              no        The Windows domain to use for authenticationSMBPass                                    no        The password for the specified usernameSMBUser                                    no        The username to authenticate asTHREADS     10                             yes       The number of concurrent threads

  设置完成之后,就可以执行扫描了。

msf auxiliary(smb_ms17_010) > spool ms17-010.txt         # 输出记录写入到文件
[*] Spooling to file ms17-010.txt...
msf auxiliary(smb_ms17_010) > exploit                    # 执行检测[-] 10.0.0.17:445         - An SMB Login Error occurred while connecting to the IPC$ tree.
[-] 10.0.0.13:445         - Host does NOT appear vulnerable.
[-] 10.0.0.14:445         - Host does NOT appear vulnerable.
[-] 10.0.0.2:445          - Host does NOT appear vulnerable.
[-] 10.0.0.11:445         - Host does NOT appear vulnerable.[-] 10.2.2.25:445         - Host does NOT appear vulnerable.
[-] 10.2.3.160:445        - Host does NOT appear vulnerable.
[-] 10.2.3.162:445        - Host does NOT appear vulnerable.
[-] 10.5.0.2:445          - An SMB Login Error occurred while connecting to the IPC$ tree.
[-] 10.5.0.11:445         - Host does NOT appear vulnerable.
[-] 10.5.0.13:445         - Host does NOT appear vulnerable.
[-] 10.5.0.24:445         - Host does NOT appear vulnerable.
[+] 10.5.0.25:445         - Host is likely VULNERABLE to MS17-010!  (Windows Server 2012 R2 Standard 9600)

  扫描结束之后,使用spool off,即可停止记录。

  ms17-010.txt文件中将会保存所有的检测记录。

转载于:https://www.cnblogs.com/Hi-blog/p/Metasploit-Read-Target-from-File.html

Metasploit从文件中读取目标地址相关推荐

  1. C++从文件中读取数据,打印(追加打印)至文件

    无论读取还是打印,都需要在开始引入<fstream>头文件,我们需要用到里面的对于文件的函数操作. 文件读取 首先来说从文件中读取.我们定位文件所在具体位置,指向目标文件,这里的myfil ...

  2. 在blk文件中找寻目标块及交易示例

    在blk文件中找寻目标块及交易示例 bitcoin所有得交易信息都以block的形式存放在文件中,存访文件名为blkxxxxx.dat,文件存放在blocks目录下.如测试网的block文件存放在te ...

  3. c语言把一个字符从指定文件中读取的函数,C语言中对文件最基本的读取和写入函数...

    C语言中对文件最基本的读取和写入函数 C语言read()函数:读文件函数(由已打开的文件读取数据)头文件: #include 定义函数: ssize_t read(int fd, void * buf ...

  4. vc++从txt文件中读取数据

    数值分析课上老师说要将数据写在txt文件上,然后让程序从txt文件中读取数据.让本来C++已经遗忘了很久的我们无从下手,在网上也查看了很多,发现大多都是扯淡,放在VC++编辑器上发现并不能运行,不知道 ...

  5. 【Python】从文件中读取数据

    从文件中读取数据 1.1 读取整个文件 要读取文件,需要一个包含几行文本的文件(文件PI_DESC.txt与file_reader.py在同一目录下) PI_DESC.txt 3.1415926535 ...

  6. 使用Java中的FileChannel和ByteBuffer在文件中读取/写入文件

    过去,我讨论过RandomAccessFile以及如何将其用于在Java中进行更快的IO,在本Java NIO教程中,我们将了解如何通过使用FileChannel和ByteBuffer来使用读/写数据 ...

  7. xlswriter-用于Excel 2007+XLSX文件中读取数据

    介绍: xlswriter是一个 ,可用于在 Excel 2007+ XLSX 文件中读取数据,插入多个工作表,写入文本.数字.公式.日期.图表.图片和超链接. 特点: 一.写入 100%兼容的Exc ...

  8. 使用 Python 从文件中提取 IP 地址

    让我们看看如何使用 Python 从文件中提取 IP 地址. 算法 : 为正则表达式导入 re 模块. 使用 open() 函数打开文件. 读取文件中的所有行并将它们存储在列表中. 声明 IP 地址的 ...

  9. python从文件中读取数据_【Python】从文件中读取数据

    从文件中读取数据 1.1 读取整个文件 要读取文件,需要一个包含几行文本的文件(文件PI_DESC.txt与file_reader.py在同一目录下) PI_DESC.txt 3.1415926535 ...

最新文章

  1. Codeforces Round #698 (Div. 2)(A ~ F)6题全,超高质量题解)【每日亿题】2021/2/4
  2. 常用24个方法有效优化ASP.NET的性能
  3. linux系统调用(syscall)原理
  4. mysql 高级语法,SQL 语法高级
  5. css选择器 nth-child
  6. 数据库查询经常卡死?面对亿级大数据量,我是这么展示分析的
  7. 12-sed命令详解
  8. mysql 千万数据分页_MySQL处理千万级数据查询、分页
  9. 《南溪的目标检测学习笔记》——DCN(DCNv2)的学习笔记
  10. NASNET-【论文理解】
  11. JavaScript中的内置对象(数组、Boolean、Number、字符串)和自定义对象
  12. java中String字符串
  13. oracle10G/oracle11G连接oracle12c,ORA-28040的解决
  14. Ubuntu安装OpenCV4记录
  15. 汉字符号(汉字特殊符号)
  16. in_array函数漏洞
  17. 数字化闯入“深水区”,超级营销平台是突破口吗?
  18. 单域安全评估以及加固方案
  19. 使用Perl编写协议分析脚本 z
  20. Newman基础使用

热门文章

  1. LeetCode 47全排列Ⅱ48旋转图像
  2. Android退出程序(二)——利用广播机制
  3. Ubuntu/Fedora 编译内核教程
  4. Gentoo 安装日记 11 (配置内核 :Module, block layer 和 CPU)
  5. 三体系建设是什么意思_湖南信息系统建设和服务能力评估体系怎么做?是什么?...
  6. axure能做剪切蒙版吗_卫生间瓷砖不打掉能做防水吗
  7. python字符串单个替换_如何用变量替换列表中的单个字符串?
  8. 邀请函|2021 云原生实战峰会,邀请您免费现场参会报名
  9. 免费下载来自阿里巴巴 双11 的《云原生大规模应用落地指南》
  10. 从零开始入门 K8s | Kata Containers 创始人带你入门安全容器技术