Issue
I am trying to test a vulnerability on my router using an exploit from exploit_DB. The exploit is a Python script that requires Metasploit to run . Here's a link to the exploit
I am using Kali-Linux with Metasploit v4.17.3-dev.
What I have tried is :
After creating the dir, I have copied the file using
cp ~/Desktop/45170.py ~/.msf4/module/exploit/windows/45170.py
in msfconsole
reload_all
the exploit number on Metasploits is still the same
1795 exploits
then when I tried
use /exploits/windows/45170
, I got this errorFailed to load the module :/exploits/windows/45170
So that didn't work for me but when I try to use a .rb
file it works with no problem.
I know it's a Ruby based framework but I also know that python support have been added.
I have also tried to run it directly from python using /usr/bin/env python3 ~/Desktop/45170.py
But I get this error
no module named Metasploit
Solution
It looks like you haven't installed Metasploit correctly. Check the instructions provided for linux and let me know if that fixed your problem.
Also, does running this example work on your Kali machine? I guess that writing an external Python module for Metasploit is what you're trying to do? If the example throws an error, please report it back. Otherwise, please post your custom code since it might contain an obvious syntax/spelling error.
If these things don't solve the problem, check the location of the Python Metasploit library on your system. Is it in your PYTHONPATH
(run echo $PYTHONPATH
from the command line)? Check this link for more information on the system location of Metasploit.
Answered By - Daniel Schütte