rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.17k stars 13.98k forks source link

Importing Python modules on Linux Mint (Ubuntu) #12683

Closed SirmSolutionsGeorgiYankov closed 4 years ago

SirmSolutionsGeorgiYankov commented 4 years ago

Issue:

From what i saw, putting a Python script (module), into modules/exploits/.... and issuing updatedb should add the script to the database. But with use i cant seem to find it. Permissions on the script are root:root, 744 (all other Ruby scripts use 644).

I have the Metasploit installed in /opt/metasploit-framework with /usr/bin/ having symlinks to /etc/alternatives/ and from there to the /opt/metasploit-framework/bin.

I tried adding the $PYTHONPATH to use /opt/metasploit-framework/embedded/framework/lib/msf/core/modules/external/python/metasploit/, but nothing happened.

Running the script directly gives an error for missing module metasploit. Trying to install it with pip returns 404 error, likely no longer present (but this should not matter, since it should be looking in the Metasploit directories supposedly).

Tried installing the pymetasploit and renaming the imported module, but ... does not find it, with or without the $PYTHONPATH.

ku4eto@ku4eto:~/Desktop$ python3 routeros-exploit.py 
Traceback (most recent call last):
  File "routeros-exploit.py", line 7, in <module>
    from pymetasploit import module
ModuleNotFoundError: No module named 'pymetasploit'
ku4eto@ku4eto:~/Desktop$ pip3 install pymetasploit
Requirement already satisfied: pymetasploit in /usr/local/lib/python3.6/dist-packages (1.1)
Requirement already satisfied: msgpack-python>=0.1.12 in /usr/local/lib/python3.6/dist-packages (from pymetasploit) (0.5.6)

(tried under normal and root users, does not matter).

The script i want to run is this one: https://www.exploit-db.com/exploits/45170

Version and source: root@ku4eto:/home/ku4eto# apt-cache policy | grep metasploit 500 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid/main i386 Packages origin downloads.metasploit.com 500 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid/main amd64 Packages origin downloads.metasploit.com metasploit-framework -> 5.0.64+20191207112612~1rapid7-1 with priority 1000

OS: Linux Mint 19

I would need help on getting this to work, not sure where the issue exactly is. There is almost no documentation about this.

SirmSolutionsGeorgiYankov commented 4 years ago

Sorry, posted with the wrong account