1 – Serving a HTTPServer quickly
SimpleHTTPServer is a python module which allows you to instantly create a web server with file access. Use the command below to start the webserver on a pre-defined ip and port number.
python3 -m http.server --bind 192.168.1.100 9980
You should now have access to this webserver on: http://192.168.1.100:9980 or use the hosts ip with the default port 8000
python3 -m http.server
...Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Now the webserver is accessible on: http://x.x.x.x:8000
2 – Spawn a new bash shell in meterpreter with Python
Trying to use a command such as su – root in a Meterpreter session results in an error message:
su: must be run from a terminal
You could try to create an python “wrapper” to perform the bash command(s).
python -c 'import pty;pty.spawn("/bin/bash")'
Now it is possible to run the command!