-
Notifications
You must be signed in to change notification settings - Fork 10
/
scanret.py
72 lines (53 loc) · 1.44 KB
/
scanret.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
67
68
69
70
#! /bin/python
from redis_inc import RedisConnection, RedisQueueConnection
from time import time, sleep
def test():
runque = RedisQueueConnection('scan').conn
size = runque.qsize()
print size
sleep(1)
cnt = 0
if size:
while cnt < size:
i = runque.get()
print i
runque.put(i)
cnt += 1
runque.flushdb()
exit(0)
f = open('seeds995k.txt')
urls = f.read().strip().split('\n')
if size == 0:
i = 0
st = time()
for url in urls:
runque.put(url)
test()
exit(0)
import redis
from RedisQueue import RedisQueue
#
# use one redis queue to store the extracted urls
# then master pop them to check whether already in done_site.bin
# if not, send the host (without http://) to the dns server
# from dns server we got the website host is accessble or not
# when recived the reply from dns, then insert the parsed url (which is accessble) into the runqueu in a specific redis queue
#
#
# store the website
#
#
# db = dbd['runque']
# db = dbd['extracturls']
#
dbd = dict()
dbd['runque'] = 1
dbd['extracturls'] = 2
host = "127.0.0.1"
password = 'j&tzbPG3Lwpb25#rFS'
# first insert into the done_site.bin
rq = RedisQueue(name = 'extracturls', host=host, password=password, db=dbd['extracturls'])
rr = RedisQueue(name ='runque', host=host, password=password, db=dbd['runque'])
print rq.qsize()
print rr.qsize()
#exit(0)