Skip to content

Instantly share code, notes, and snippets.

@yhuag
Created April 23, 2018 09:31
Show Gist options
  • Save yhuag/ffbc65ac6303ce2dca7bcf543ca2757a to your computer and use it in GitHub Desktop.
Save yhuag/ffbc65ac6303ce2dca7bcf543ca2757a to your computer and use it in GitHub Desktop.
pin demonstration
import os
def testChar(_char):
os.system("echo '"+_char+"' | ../../../pin -t obj-intel64/inscount0.so -- ~/Downloads/break")
def getInstr():
return os.popen("cat inscount.out").read()
ascii_list = [chr(x) for x in range(48,127)]
ans = ""
while ans[-1] != '}':
curr_instr = 0
max_instr = 0
max_char = ''
for j,char in enumerate(ascii_list):
testChar(ans + char)
curr_instr = int(getInstr()[6:-1])
if (curr_instr > max_instr):
max_instr = curr_instr
max_char = char
ans = ans + max_char
print(">>> Current Answer:", ans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment