from ClassPart4 import hof
#from operator import mul
from ClassPart4 import *
import mysql.connector
from back import back
from pickurl import pick
from user import add
from soft import soft
# from checksql import checkd
def checkd(get): # check out which get's refrere is get11(get)
getf={}
conn = mysql.connector.connect(host='127.0.0.1', user='rootztf', password='rootztf', port='3306', database='url',
use_unicode=True)
cursor = conn.cursor()
sql="select * from url10 where url like '%"+get+"%'"
#print get,type(get)
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
fname=row[1].encode("utf-8")
surl=row[2].encode("utf-8")
#print fname
Get, Host, Ref, UAgent, Cookie = rexurl(surl)
Get=Get.strip()
if Get==get:#get11 same with ref11 , when get is Get checkout get's referer
#print fname,Ref
getf[fname]=Ref
else:
continue
cursor.close()
conn.close()
return getf
def checkua(get):
getf={}
uakind={}
conn = mysql.connector.connect(host='127.0.0.1', user='rootztf', password='rootztf', port='3306', database='url',
use_unicode=True)
cursor = conn.cursor()
sql="select * from url10 where url like '%"+get+"%'"
#print get,type(get)
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
fname=row[1].encode("utf-8")
surl=row[2].encode("utf-8")
#print fname
Get, Host, Ref, UAgent, Cookie = rexurl(surl)
Get=Get.strip()
if Get==get:#get11 same with ref11 , when get is Get checkout get's referer
#print fname,Ref
getf[fname]=UAgent
if UAgent not in uakind:
uakind[UAgent]=1
else:
uakind[UAgent]=uakind[UAgent]+1
else:
continue
cursor.close()
conn.close()
return getf,uakind
def cheua(sames1):
uas={}
conn = mysql.connector.connect(host='127.0.0.1', user='rootztf', password='rootztf', port='3306', database='url',
use_unicode=True)
cursor = conn.cursor()
checkrefurl = {}
#a=0
# print get01.keys()
# s="http://www.sunland.org.cn/ "
# if s in get01.keys():
# print s
for c1 in sames1.keys():
# print c1,type(c1)
c1 = c1.strip()
sql = "select * from url11 where url like '%" + c1 + "%'"
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
fname=row[1].encode("utf-8")
surl=row[2].encode("utf-8")
Get,Host,Ref,UAgent,Cookie=rexurl(surl)
Get=Get.strip()
if len(Get)!=0 and Get==c1:
if UAgent not in uas:
uas[UAgent]=1
else:
uas[UAgent]=uas[UAgent]+1
cursor.close()
conn.close()
return uas
def UaHost(ua):
#hosts={}
conn = mysql.connector.connect(host='127.0.0.1', user='rootztf', password='rootztf', port='3306', database='url',
use_unicode=True)
cursor = conn.cursor()
sql = "select * from url11 where url like '%" + ua + "%'"
cursor.execute(sql)
results = cursor.fetchall()
#all=cursor.rowcount
als=0
num=0
sof=0
for row in results:
fname=row[1].encode("utf-8")
surl=row[2].encode("utf-8")
#print type(surl)
cha="CONNECT"
if cha in surl:
num=num+1
#print fname
Get,Host,Ref,UAgent,Cookie=rexurl(surl)
Get=Get.strip()
ch="https:"
if len(Get)!=0 and UAgent==ua:
if back==0:
sof=sof+1
if ch in Get:
als=als+1
cursor.close()
conn.close()
if als!=0:
res=float(num)/als
if res<=0.5 and sof!=0:
return 0 # has https but soft and https nums too smal
else:
return 1
else: # no https UA
return 0
def UaHost1(urls,ua):
hosts={}
ua=ua.strip()
for row in urls.values():
url=row.encode("utf-8")
Get,Host,Ref,UAgent,Cookie=rexurl(url)
Get=Get.strip()
#UAgent=UAgent.strip()
if len(Get)!=0 and UAgent==ua:
if Ref not in hosts:
hosts[Ref]=1
else:
hosts[Ref]=hosts[Ref]+1
print "kinds of hosts:",len(hosts)
return hosts
# def uaref(urls,ref):
#
# for fname in urls.keys():
# row=urls[fname]
# url=row.encode("utf-8")
# try:
# Get, Host, Ref, UAgent, Cookie = rexurl(url)
# Gets = Get.strip()
# Ref = Ref.strip()
# if
def UaHost2(urls,ua):
refs={}
ref={}
ua=ua.strip()
for fname in urls.keys():
row=urls[fname]
url=row.encode("utf-8")
try:
Get,Host,Ref,UAgent,Cookie=rexurl(url)
Gets=Get.strip()
https=http(Gets)
Ref=Ref.strip()
back=soft(Get,Host,Ref,UAgent)
if https==1 and UAgent==ua:
if back == 0:
print https,fname
if Ref not in refs:
refs[Ref]=1
else:
refs[Ref]=refs[Ref]+1
else:
if Ref not in ref:
ref[Ref]=1
else:
ref[Ref]=ref[Ref] + 1
except:
print "Error:",fname
return refs,ref
def http(get): # pick out which get with more than 2 http
res=re.compile(r'(http)')
https=re.findall(res,get)
#print https
if len(https)!=0:
if len(https)>=2:
return 0
else:
return 1
else:
pass
# get="http://googlead"
# a=http(get)
# print a
def CharinD(cha,D):
cha=cha.strip()
# if cha in D.keys():
for dch in D.keys():
dch=dch.strip()
if dch==cha:
print cha
def check(d):
# print str(d.__class__)
for dk in d.keys():
print dk,":",d[dk]
def checkT(d):
account=0
a=[]
for dk in d.keys():
num=d[dk]
if num>=10:
account=account+1
print dk,":",num
else:
a.append(num)
print "number of Over Threshold:",account
print "length of low Threshold:",len(a)
print a
def check2kk(d):
# print str(d.__class__)
for dk in d.keys():
print dk,":",d[dk]
def Tref(d):
a=0
aurl=[]
# print str(d.__class__)
for dk in d.keys():
if len(dk)!=0 and d[dk]>=15:
dk=dk.encode("utf-8")
aurl.append(dk)
a=a+1
#print dk," : ",d[dk]
print "countnum of checkout:",a
return aurl
def checklist(l):
for li in l:
print li
def check2(d1,d2):
sames=[]
nosame1=[]
nosame2=[]
for c1 in d1.keys():
if c1 in d2.keys():
sames.append(c1)
else:
nosame1.append(c1)
#nosame2.append(c2)
continue
return sames,nosame1
def check2d(d1,d2):
sames1={}
sames2={}
nosame1={}
#nosame2={}
#print type(d2.keys())
for c1 in d1.keys():
c1url=d1[c1]
c1=c1.strip()
#print type(c1)
if c1 in d2.keys():
sames1[c1]=c1url
sames2[c1] =d2[c1]
else:
nosame1[c1]=c1url
return sames1,nosame1,sames2
def check2get(d1, d2):
sames1 = {}
sames2 = {}
nosame1 = {}
for c
没有合适的资源?快使用搜索试试~ 我知道了~
Url.rar_url分类_www//py6501.com_用户 识别
共89个文件
py:52个
pyc:29个
xml:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 14 浏览量
2022-09-15
00:24:08
上传
评论
收藏 88KB RAR 举报
温馨提示
利用朴素贝叶斯BS实现从HTTP数据流中识别出用户基于浏览器访问的URL
资源推荐
资源详情
资源评论
收起资源包目录
Url.rar (89个子文件)
Url
Fillter.py 4KB
Realuser.pyc 1KB
soft.pyc 2KB
user.py 6KB
openbrowser.py 2KB
debugmain.pyc 3KB
user.pyc 3KB
url
ClassPartMM.py 8KB
UserRealUrl.py 7KB
UserMT.py 9KB
fck.pyc 2KB
check.py 14KB
UA.pyc 5KB
__init__.pyc 109B
ClassPartMM.pyc 5KB
UserRealUrl.pyc 3KB
softclass.pyc 4KB
f1.py 2KB
fck.py 6KB
UserMT.pyc 5KB
checksql.py 5KB
charpick.py 2KB
__init__.py 0B
totTime.pyc 2KB
startnot.py 253B
use.py 2KB
file.py 240B
check.pyc 12KB
startnot.pyc 485B
learning.py 276B
backuphistory.py 3KB
PutInsqlMM.py 3KB
totTime.py 6KB
softclass.py 5KB
dealUrl1.py 2KB
pickurl.py 1KB
pickurl.pyc 1KB
checksql.pyc 3KB
UA.py 6KB
pcmain.pyc 2KB
mobilemain.pyc 2KB
soft.py 3KB
DataSet.py 10KB
scripe.py 1KB
ClassPart4.pyc 8KB
33.py 2KB
mobilemain.py 3KB
commonfun.py 1KB
ClassPart4.py 13KB
typecheck.py 1KB
back.py 271B
urlmm
Rua.py 4KB
One2Moreusers.py 1KB
Rua.pyc 3KB
class4.pyc 6KB
testxls.py 2KB
dealua.py 12KB
dealua.pyc 6KB
__init__.py 0B
class4.py 8KB
commonfun.pyc 396B
.idea
f2.py 1KB
misc.xml 708B
.name 15B
modules.xml 258B
__init__.py 0B
Url.iml 563B
dictionaries
Administrator.xml 94B
encodings.xml 159B
workspace.xml 53KB
pycharmlearning.iml 464B
openbrowser.pyc 2KB
NB2.py 5KB
fclient.py 2KB
Main.py 4KB
Realuser.py 2KB
3.py 311B
debugmain.py 5KB
confg2list.py 222B
JudgePcMobile.py 1KB
Dset.py 5KB
fclient.pyc 2KB
back.pyc 422B
Nbayes.py 4KB
confg2list.pyc 446B
Fillter.pyc 3KB
pcmain.py 2KB
PutMysql.py 2KB
KNN.pyc 415B
共 89 条
- 1
资源评论
四散
- 粉丝: 54
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功