Skip to content

Instantly share code, notes, and snippets.

@egcodes
Last active December 29, 2015 14:09
Show Gist options
  • Save egcodes/7682311 to your computer and use it in GitHub Desktop.
Save egcodes/7682311 to your computer and use it in GitHub Desktop.
get hacked tr(turkish) pages from zone-h.org
from BeautifulSoup import BeautifulSoup
import urllib2
from datetime import datetime
import time,os
pageNo = 1
while pageNo < 10:
print "PageNo: %d"%pageNo
page = urllib2.urlopen("http://www.zone-h.org/archive/page=%d"%pageNo, timeout=10).read()
soup = BeautifulSoup(page)
today = str(datetime.now())
today = today[:10]
table = soup.find("table")
rows = table.findAll('tr')
for i, tr in enumerate(rows):
cols = tr.findAll('td')
for j,td in enumerate(cols):
try:
text = ''.join(td.find(text=True))
except:
if str(td).find("tr.png") != -1:
ls = []
for item in tr:
try:
txt = ''.join(item.find(text=True))
if txt == "mirror":
ls.append(str(item)[str(item).find('href') + 1:str(item).rfind('mir') - 1])
else:
ls.append(txt.strip())
except Exception, error:
pass
hack = "Time: ",today + " " + ls[0] + " - " + "Hacked By: ",ls[1]
hack2 = ""
if ls[2].find('.') != -1:
hack2 = " - ","Site: ",ls[2] + " - " + "Os: ", ls[3] + "\n"
elif ls[3].find('.') != -1:
hack2 = " - ","Site: ",ls[3] + " - " + "Os: ", ls[4] + "\n"
elif ls[4].find('.') != -1:
hack2 = " - ","Site: ",ls[4] + " - " + "Os: ", ls[5] + "\n"
else:
hack2 = " - ","Site: ",ls[5] + " - " + "Os: ", ls[6] + "\n"
print hack+hack2
pageNo += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment