Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/documentation/modules/post/windows/manage/install_python.md
Views: 11789
Overview
This module downloads an embeddable Python3 distribution onto the target file system, granting pentesters access to a lightweight Python interpreter. This module does not require administrative privileges or user interaction with installation prompts. This is useful in cases where the in-memory python interpreter might be limited. If you only want to run a python script while connected, see https://docs.metasploit.com/docs/using-metasploit/advanced/meterpreter/python-extension.html.
Tested Version
This module has been tested against:
Windows 10, 1903
Verification Steps
Start msfconsole
Get a Meterpreter session
Do:
use post/windows/manage/install_python
Do:
set SESSION #
Optional Do:
set PYTHON_VERSION
Optional Do:
set PYTHON_URL
Optional Do:
set FILE_PATH
Do:
run
Options
PYTHON_VERSION
Specifies the Python version you would like to download. Downloads Python version 3.8.2 by default.
PYTHON_URL
Specifies the URL used to download the Python embeddable zip file.
FILE_PATH
Specifies the directory to place the Python embeddable zip file. Places Python zip file in the current working directory by default.
CLEANUP
If true, this option will delete the Python zip file as well as its extracted contents. It will also terminate running processes with name 'python', as you cannot delete the Python interpreter if it is actively running.
Scenarios
Get initial access: Create a Meterpreter exe using msfvenom, then transfer it to the target system via web server, SMB, etc. Execute the payload to get a session.
Use the post module to install Python on the target filesystem
Verify Python works
Note that running this Python interpreter interactively may hang your command shell.