4
4
####################################################################################
5
5
#
6
6
# Basicly same idea as Passcracker.py, only this generates a baseword list.
7
- # Only reads 1MB from password.txt and choose a random word to search for.
7
+ # Reads 1MB from password.txt and choose a random word to search for.
8
8
#
9
9
####################################################################################
10
10
15
15
import random
16
16
import subprocess
17
17
import unicodedata
18
- import os
18
+ import time
19
19
20
20
def unique (words ):
21
21
array = []
22
22
[array .append (x .encode ('utf-8' )) for x in words if x not in array and (len (x ) > 3 and len (x ) < 16 )]
23
23
return array
24
24
25
25
def twitter (query ):
26
- data = json .loads (urllib2 .urlopen ("http://search.twitter.com/search.json?q=%s&rpp=1000" % query ).read ())
26
+ twitter = urllib2 .urlopen ("http://search.twitter.com/search.json?q=%s&rpp=1000" % query ).read ()
27
+ data = json .loads (twitter )
27
28
array = []
28
29
29
30
for tweet in data ['results' ]:
@@ -33,21 +34,25 @@ def twitter(query):
33
34
return array
34
35
35
36
def randomword ():
36
- readfile = os .open ('password.txt' , os .O_RDONLY )
37
- words = random .choice (filter (None , [line .strip () for line in os .read (readfile , 100000 ).split ('\n ' )]))
37
+ f = open ('password.txt' , "r" )
38
+ f .seek (0 , 2 )
39
+ size = f .tell ()
40
+ f .seek (max (size - 1024 , 0 ), 0 )
41
+ words = random .choice (filter (None , [line .strip () for line in f .readlines ()]))
42
+
38
43
return words
39
44
40
45
if __name__ == "__main__" :
41
46
42
47
while 1 :
43
48
try :
44
49
word = randomword ()
45
- print "\n Searching for:" ,word
50
+ print "Searching for:" ,word
46
51
wordlist = unique (twitter (word ))
47
- print wordlist
48
-
52
+
49
53
for i in xrange (len (wordlist )):
50
54
open ("password.txt" , "a" ).write ("%s\n " % wordlist [i ])
55
+ time .sleep (1 )
51
56
52
57
except (KeyboardInterrupt , SystemExit ):
53
58
sys .exit (sys .stderr .write ("Bai Bai\n " ))
0 commit comments