Skip to content

Instantly share code, notes, and snippets.

@intrd
Last active March 3, 2017 05:57
Show Gist options
  • Save intrd/97a6c1805f1f4604bd8e8d0b0c98092e to your computer and use it in GitHub Desktop.
Save intrd/97a6c1805f1f4604bd8e8d0b0c98092e to your computer and use it in GitHub Desktop.
Pipe bruteforcer script to extract the flag @ rev100-re2 @ alexctf2k17
#!/usr/bin/python
## Pipe bruteforcer to extract the flag - rev100-re2 @ alexctf2k17
# @author intrd - http://dann.com.br/
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
import sys, time
from subprocess import Popen, PIPE, STDOUT
fixed=""
i=0
while 1:
with open("1_alphanumsimbs.txt") as fileobject:
for line in fileobject:
#print line
passtry = line.strip()
print str(i)+": "+fixed+passtry
process = Popen(["./re2", fixed+passtry], stdout=PIPE, stdin=PIPE, stderr=PIPE)
(output, err) = process.communicate(input=""+fixed+passtry)
#print output
if not "Better luck" in output:
print str(i)+" correct: "+passtry
print output
fixed+=passtry
#print fixed
time.sleep(0.1)
exit_code = process.wait()
i+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment