-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsniffy.py
54 lines (37 loc) · 926 Bytes
/
sniffy.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
import os
import sys
import getopt
import urllib2
import urllib
from urlparse import urlparse
from speedy.speedydb import SpeedyDb
class Sniffy(object):
def __init__(self):
self.db = SpeedyDb()
def findBetas(self):
sites = self.db.getSites()
for site in sites:
siteId = site[0]
siteName = site[1]
urlBits = urlparse(site[2])
sitebit = urlBits.netloc.strip('www')
self.checkSite('beta', sitebit)
self.checkSite('new', sitebit)
# self.checkSite('alpha', sitebit)
def checkSite(self, type, sitebit):
url = 'http://' + type + sitebit
code = self.getSite(url)
if (code == 200):
print url
def getSite(self, url):
try:
response = urllib2.urlopen(url, timeout=10)
return response.code
except:
return 500
def main(argv):
sniff = Sniffy()
sniff.findBetas()
print sniff.getSite('http://jumoo.uk')
if __name__ == '__main__':
main(sys.argv[1:])