Last active
September 21, 2017 10:51
-
-
Save intrd/b26d3b24c817073c2bca9e4899cd08cc to your computer and use it in GitHub Desktop.
Solution for cry_t0k3n @ Global Cyberlympics Prequals 2017 (cryptcat multithread bruteforcer)
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
## Solution for cry_t0k3n @ Global Cyberlympics Prequals 2017 (cryptcat multithread bruteforcer) | |
# @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,Queue,threading,hashlib,os,time | |
from subprocess import Popen, PIPE, STDOUT | |
NumOfThreads=5 | |
queue = Queue.Queue() | |
#WordList = open("passwords_found.txt",'r') | |
#WordList = open("pins.txt",'r') | |
#WordList = open("unix_passwords.txt",'r') | |
WordList = open("rockyou.txt",'r') | |
class checkHash(threading.Thread): | |
def __init__(self,queue): | |
threading.Thread.__init__(self) | |
self.queue=queue | |
def run(self): | |
i=0 | |
while True: | |
self.clear=self.queue.get() | |
passtry = self.clear | |
if passtry != "" \ | |
and not "'" in passtry \ | |
and not " " in passtry \ | |
and not ";" in passtry \ | |
and not "$" in passtry \ | |
and not "!" in passtry \ | |
and not "/" in passtry: | |
process = Popen("./elf.elf 127.0.0.1 -k "+passtry+" -w 1 -vvvlp 6345", shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=False) | |
(output, err) = process.communicate() | |
print passtry+" -", | |
print output | |
#os._exit(0) | |
#time.sleep(0.04) | |
if len(output) > 2000: | |
print str(i)+" ## FOUND: "+passtry+"\n" | |
print output | |
os._exit(0) | |
exit_code = process.wait() | |
i+=1 | |
self.queue.task_done() | |
for i in range(NumOfThreads): | |
t=checkHash(queue) | |
t.setDaemon(True) | |
t.start() | |
for word in WordList.readlines(): | |
queue.put(word.strip()) | |
queue.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment