Skip to content

Instantly share code, notes, and snippets.

@EvaGL
Last active December 30, 2015 11:49
Show Gist options
  • Select an option

  • Save EvaGL/7824579 to your computer and use it in GitHub Desktop.

Select an option

Save EvaGL/7824579 to your computer and use it in GitHub Desktop.
__author__ = 'evagl'
from socket import *
class Exploit():
def read(self):
return self.s.recv(4096)
def read_all(self):
data = ''
try:
while True:
curr = self.read()
if not curr:
break
data += curr
except e:
pass
return data
def send(self, data):
self.s.send(data + '\n')
def execute(self, ip, port, flag_id):
self.s = socket(AF_INET, SOCK_STREAM)
self.s.settimeout(0.5)
self.s.connect((ip, port))
flags = self.exploit_it()
if flag_id in flags:
self.flag = flags[flag_id]
else:
self.flag = ''
def result(self):
return {'FLAG' : self.flag}
def exploit_it(self):
flags = {}
# evil code must be here
return flags
if __name__ == '__main__':
e = Exploit()
e.execute('127.0.0.1', 80, 'some-flag')
print e.result()['FLAG']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment