forked from evilpacket/DVCS-Pillage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudhgpwn.py
69 lines (59 loc) · 1.77 KB
/
cloudhgpwn.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
import time
import socket
import urllib
import urllib2
import re
from urllib2 import URLError
import cloud
import os
import redis
# This (horribly written) script will read in a line of domains in format of example.com, one per line and create a job out of those domains and send it to picloud for processing. You must signup for picloud and put in your API key below.
# Current issues:
# Does not support HTTPS (manually change it)
# PICLOUD.COM API KEY
cloud.setkey("####", "##########################")
set = "dvcspwns"
redis_host="example.com"
host_list = "dvcshostlist"
#cloud.start_simulator()
# Size of job to run
chunksize = 1000
start = 0
timeout = 10
def chunks(start, size):
f = open(host_list)
patterns = []
count = 0
lines = []
for line in f:
if count < start:
count = count + 1
elif count < start + chunksize:
lines.append("http://%s/.hg/requires" % line.split(",")[0].rstrip())
patterns.append('^revlogv1')
count = count + 1
else:
break
f.close()
return lines,patterns
def check_git(url,pattern):
request = urllib2.Request("%s" % (url))
try:
response = urllib2.urlopen(request)
except Exception, e:
return False, ""
else:
result = response.read()
match = re.search(pattern,result)
if match is None:
return False, ""
else:
r = redis.Redis(redis_host)
r.sadd(set,url)
print "TRUE"
return True, result
try:
lines,patterns = chunks(start,chunksize)
print cloud.map(check_git,lines, patterns)
except Exception, e:
print e