Advertisement
hollerith

senseless

Oct 23rd, 2018
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. import multiprocessing
  3. import subprocess
  4.  
  5. class PyCrack:
  6.     def __init__(self, slice):
  7.         self.pwrd = multiprocessing.Array('c', '\n' * 512)
  8.         self.lock = multiprocessing.Lock()
  9.        
  10.         self.workers = []
  11.        
  12.         for entry in slice:
  13.             worker = multiprocessing.Process(target=self.logic, args=(entry,))
  14.             self.workers.append(worker)
  15.                
  16.     def logic(self, entry):
  17.         if entry == "":
  18.             return
  19.            
  20.         try:
  21.             args = ["steghide", "extract", "-sf", "meow.wav", "-p", "%s" % entry]
  22.             proc = subprocess.Popen(args, stdin=-1, stdout=-1, stderr=-1)
  23.             out, err = proc.communicate()
  24.                
  25.             if "could not extract" not in err:
  26.                 self.set(entry)
  27.         except:
  28.             pass
  29.            
  30.     def set(self, entry):
  31.         self.lock.acquire()
  32.         self.pwrd.value = entry
  33.         self.lock.release()
  34.        
  35.     def run(self):
  36.         for worker in self.workers:
  37.             worker.start()
  38.        
  39.         for worker in self.workers:
  40.             worker.join()
  41.            
  42.         return self.pwrd.value.strip()
  43.        
  44. def main():
  45.     wordlist = "/usr/share/wordlists/rockyou.txt"
  46.     wordlist = [o.strip() for o in open(wordlist).readlines()]
  47.  
  48.     while len(wordlist) % 8:
  49.         wordlist.append("")
  50.        
  51.     for n in xrange(0, len(wordlist), 8):
  52.         slice = wordlist[n:n+8]
  53.         procs = []
  54.        
  55.         print "%02i/%02i" % ((n/8)+1, len(wordlist)/8)
  56.        
  57.         crack = PyCrack(slice)
  58.         pwrd = crack.run()
  59.        
  60.         if len(results):
  61.             print "\nPASSWORD: %s\n" % pwrd
  62.             sys.exit()
  63.            
  64. if __name__ == "__main__":
  65.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement