forked from leresearcher/I-know-your-password
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPasscracker.py
67 lines (53 loc) · 2.75 KB
/
Passcracker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import urllib2
import re
import sys
import random
import subprocess
import unicodedata
import os
def sizepasswordfile():
filesize = os.stat('password.txt').st_size
return filesize
def unique(words):
array = []
[array.append(x.encode('utf-8')) for x in words if x not in array and (len(x) > 4 and len(x) < 16)]
return array
def twitter(query):
data = json.loads(urllib2.urlopen("http://search.twitter.com/search.json?q=%s&rpp=1000"%query).read())
array = []
for tweet in data['results']:
filterurl = re.sub(r"""((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|(([^\s()<>]+|(([^\s()<>]+)))*))+(?:(([^\s()<>]+|(([^\s()<>]+)))*)|[^\s'!()[]{};:'".,<>?«»""'']))""", ' ', tweet['text'])
filterspecial = unicodedata.normalize('NFKD', re.sub(r"""[^\w]|_""", ' ',filterurl)).encode('ascii', 'ignore')
array.extend(re.split(r"""\s+""", filterspecial))
return array
if __name__ == "__main__":
err = sys.stderr.write
if len(sys.argv) != 2:
sys.exit(err("Usage: python %s <hash list> \n" % (sys.argv[0],)))
else:
while 1:
try:
words = [line.strip() for line in open('keywords.txt')]
wordlist = unique(twitter(random.choice(words)))
print wordlist
print "Filesize:", sizepasswordfile()
for i in xrange(len(wordlist)):
f = open("password.txt", "a").write("%s\n"%wordlist[i])
if sizepasswordfile() > 200000:
############################################################optional##############################################################
print "Running Passwordpro & combinator rules...."
hashcat = subprocess.Popen(["optirun","./hashcat/cudaHashcat-plus64.bin","--remove","--rules-file","hashcat/rules/passwordspro.rule", "--rules-file","hashcat/rules/combinator.rule","--outfile", "crackme.out", sys.argv[1], "password.txt"], stdout=subprocess.PIPE).communicate()[0]
print hashcat
print "Running Leetspeak & Best64 rules...."
hashcat = subprocess.Popen(["optirun","./hashcat/cudaHashcat-plus64.bin","--remove","--rules-file","hashcat/rules/best64.rule", "--rules-file","hashcat/rules/leetspeak.rule", "--outfile", "crackme.out", sys.argv[1], "password.txt"], stdout=subprocess.PIPE).communicate()[0]
print hashcat
print "Running generated Rules...."
hashcat = subprocess.Popen(["optirun","./hashcat/cudaHashcat-plus64.bin","--remove","--rules-file","hashcat/rules/generated.rule", "--outfile", "crackme.out", sys.argv[1], "password.txt"], stdout=subprocess.PIPE).communicate()[0]
print hashcat
f = open("password.txt", "w").write("")
############################################################optional##############################################################
except:
pass