Kali linux中加载github.com中metasploit-framework新脚本
在使用metasploit-framework过程中,有时在github.com中新增了msf脚本,但是kali中的metasploit-framework脚本通过常规更新无法及时加载这些新出现的msf脚本,这时就需要将脚本下载到本地加载。于是就有了这篇文章。
以CVE-2020-16875为例
- 找到github.com中的CVE-2020-16875项目漏洞地址,查看脚本位置
https://github.com/rapid7/metasploit-framework/pull/14126/
- 根据查到的脚本位置,找到脚本
双击“code”进入代码页面
依次进入modules/exploits/windows/http,找到exchange_ecp_dlp_policy.rb,双击。
点击“raw”查看源码
https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/windows/http/exchange_ecp_dlp_policy.rb
- 将github上的exchange_ecp_dlp_policy.rb拷贝到kali linux中
在kali linux中,将example.rb模板拷贝到/usr/share/metasploit-framework/modules/exploits/windows/http下,并改名为exchange_ecp_dlp_policy.rb:
cp /usr/share/metasploit-framework/modules/exploits/example.rb /usr/share/metasploit-framework/modules/exploits/windows/http/exchange_ecp_dlp_policy.rb
复制https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/windows/http/exchange_ecp_dlp_policy.rb中的内容,通过编辑器VI替换掉exchange_ecp_dlp_policy.rb(example.rb)的内容。
赋予exchange_ecp_dlp_policy.rb权限
chmod 755 exchange_ecp_dlp_policy.rb
- 将说明文档的内容加到kali linux中
在“code”网页,找到documentation页面,分别进入exchange_ecp_dlp_policy.rb对应的路径documentation/modules/exploit/windows/http,找到说明文档exchange_ecp_dlp_policy.md
找到它的源码链接地址:
在kali linux中,将exchange_ecp_dlp_policy.md下载下来
wget https://raw.githubusercontent.com/rapid7/metasploit-framework/master/documentation/modules/exploit/windows/http/exchange_ecp_dlp_policy.md
然后将它拷贝到/usr/share/metasploit-framework/documentation/modules/exploit/windows/http目录下:
cp exchange_ecp_dlp_policy.md /usr/share/metasploit-framework/documentation/modules/exploit/windows/http/
- 打开msfconsole,并加载 exchange_ecp_dlp_policy.rb
root@kali:/# msfconsole
msf5 > reload_all
调用exchange_ecp_dlp_policy.rb
msf5 > search exchange_ecp_dlp_policy
sf5 > use exploit/windows/http/exchange_ecp_dlp_policy
[*] Using configured payload windows/x64/meterpreter/reverse_https
msf5 exploit(windows/http/exchange_ecp_dlp_policy) > show options
至此 exchange_ecp_dlp_policy.rb加载完全加载到kali linux中。