Last active
March 3, 2017 05:57
-
-
Save intrd/97a6c1805f1f4604bd8e8d0b0c98092e to your computer and use it in GitHub Desktop.
Pipe bruteforcer script to extract the flag @ rev100-re2 @ alexctf2k17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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