Skip to content

Instantly share code, notes, and snippets.

@intrd
Last active March 8, 2017 18:39
Show Gist options
  • Save intrd/6ca640814b4d2e14c9dc783bf431c8aa to your computer and use it in GitHub Desktop.
Save intrd/6ca640814b4d2e14c9dc783bf431c8aa to your computer and use it in GitHub Desktop.
intrd's multithread pipe/stdin bruteforcer v1.2 (sample: bruteforcing .cpt ccrypt encrypted files)
# This tool is deprecated, please use https://github.com/intrd/nozzlr
#!/usr/bin/env python
## intrd's multithread pipe/stdin bruteforcer v1.2 (sample: bruteforcing .cpt ccrypt encrypted files)
# @author intrd - http://dann.com.br/ (based on https://www.phillips321.co.uk/2013/08/31/multi-threading-python-a-quick-example/)
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
import sys,Queue,threading,hashlib,os
from subprocess import Popen, PIPE, STDOUT
NumOfThreads=70
queue = Queue.Queue()
WordList = open("~/dics/wordlist.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:
process = Popen("ccrypt -d encrypted.xls.cpt -K '"+passtry+"'", shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=False)
(output, err) = process.communicate()
## to pipe @ stdin
# process = Popen(["./programname", passtry], stdout=PIPE, stdin=PIPE, stderr=PIPE)
# (output, err) = process.communicate(input=''+passtry)
# print output
if not "unchanged" in output:
print str(i)+" found: "+passtry
print output
#sys.exit(0)
file = open("founds.txt", 'a')
file.write(output+"\n"+passtry+"\n")
file.close()
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