-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrabbitfilter.py
45 lines (38 loc) · 1.04 KB
/
rabbitfilter.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
import sys
def contains(word,letters):
#if word.find("'")!=-1:
# return False
if set(letters) & set(word):
for w in letters:
if word.count(w)>letters.count(w):
return False
return True
return False
phrase = 'poultryoutwitsants'
abcd = 'abcdefghijklmnopqrstuvwxyz'
nophrase = set(abcd).difference(set(phrase))
try:
dictfile = sys.argv[1]
except:
print "Not enough arguments"
print "\t"+argv[0]+" [wordlist]"
print "Loading wordlist: "+dictfile
fo = open(dictfile,"r")
wordlist = fo.readlines()
fo.close()
print "Importing original wordlist"
list1 = []
for word in wordlist:
if contains(word,phrase):
list1.append(word)
for character in nophrase:
list1 = [ x for x in list1 if character not in x ]
print "list: "+str(len(list1))
print str(len(list1)*len(list1)*len(list1))+" COMBINATIONS"
print str(len(list1)*len(list1)*len(list1)*len(phrase)/1000000000)+" Gbytes"
print " "
print "Writing filtered wordlist"
fi = open("filtered_"+dictfile,"w")
for item in list1:
fi.write(item)
fi.close()