-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_phrack.py
More file actions
executable file
·52 lines (39 loc) · 1.09 KB
/
Copy pathget_phrack.py
File metadata and controls
executable file
·52 lines (39 loc) · 1.09 KB
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
#! /usr/bin/python2.7
from urllib2 import urlopen
import sys
search = raw_input("search> ").lower()
iss_num = 1
phi_num = 1
list_1 = []
def count(page,search):
if " " not in search:
return page.count(search)
searchs = search.split(" ")
results = []
for s in searchs:
results.append( page.count(s) )
mul = len(results) - results.count(0)
res = 0
for r in results:
res += r
return res * mul
while True:
try:
sys.stdout.write("\rissue "+hex(iss_num)+" Phile "+hex(phi_num))
sys.stdout.flush()
page = urlopen("http://www.phrack.org/archives/issues/"+str(iss_num)+"/"+str(phi_num)+".txt").read().lower()
if search.split(" ")[0] in page:
list_1.append( (count(page,search),iss_num,phi_num) )
except Exception as e:
if phi_num == 1:
break
else:
phi_num = 1
iss_num += 1
continue
phi_num += 1
sys.stdout.write("\rsearch is over\n")
sys.stdout.flush()
list_1.sort()
for i in list_1:
print "issue "+str(i[1])+" Phile "+str(i[2])