2012-01-29 14:28:02 +00:00
|
|
|
# coding=utf-8
|
|
|
|
import httplib
|
|
|
|
import hashlib
|
|
|
|
import time
|
|
|
|
|
|
|
|
def getPage(s, p):
|
|
|
|
conn = httplib.HTTPConnection(s)
|
2012-02-20 13:26:41 +00:00
|
|
|
conn.request("GET", "/%s"%(p))
|
2012-01-29 14:28:02 +00:00
|
|
|
|
|
|
|
res = conn.getresponse()
|
|
|
|
data = res.read()
|
|
|
|
|
|
|
|
conn.close()
|
|
|
|
return data
|
|
|
|
|
2012-02-20 13:26:41 +00:00
|
|
|
def startThread(s, a, p, CHANLIST, message):
|
2012-01-29 14:28:02 +00:00
|
|
|
lastpage = hashlib.sha224(getPage(a, p)).hexdigest()
|
|
|
|
time.sleep(2)
|
|
|
|
while 1:
|
|
|
|
page = hashlib.sha224(getPage(a, p)).hexdigest()
|
|
|
|
|
|
|
|
if page != lastpage:
|
|
|
|
print("Page differ!")
|
|
|
|
for chan in CHANLIST.split():
|
2012-02-20 13:26:41 +00:00
|
|
|
s.send("PRIVMSG %s :%s\r\n" % (chan, message))
|
2012-01-29 14:28:02 +00:00
|
|
|
lastpage = page
|
|
|
|
|
|
|
|
time.sleep(60)
|