本文整理汇总了Python中spidertool.SQLTool类的典型用法代码示例。如果您正苦于以下问题:Python SQLTool类的具体用法?Python SQLTool怎么用?Python SQLTool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SQLTool类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: taskshow
def taskshow(taskname='',tasktatus='',username='',taskid='',taskport='',result='',page='0'):
validresult=False
request_params=[]
values_params=[]
if taskname!='':
request_params.append('tasksname')
values_params.append(SQLTool.formatstring(taskname))
if tasktatus!='':
request_params.append('status')
values_params.append(SQLTool.formatstring(tasktatus))
if username!='':
request_params.append('username')
values_params.append(SQLTool.formatstring(username))
if taskid!='':
request_params.append('tasksid')
values_params.append(SQLTool.formatstring(taskid))
if taskport!='':
request_params.append('taskport')
values_params.append(SQLTool.formatstring(taskport))
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
table=localconfig.taskstable
result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['count(*)'], request_params, values_params)
if count>0:
count= int(result[0]['count(*)'])
if count == 0:
pagecount = 0
elif count %limitpage> 0:
pagecount=int((count+limitpage-1)/limitpage)
else:
pagecount = count / limitpage
if pagecount>0:
limit=' limit '+str(int(page)*limitpage)+','+str(limitpage)
result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['username','tasksid','tasksname','status','starttime','tasksaddress','taskport','endtime','createtime','num','completenum'], request_params, values_params,limit,order='createtime desc')
DBhelp.closedb()
jobs=[]
if count>0:
validresult=True
for temp in result :
ajob=tasks.Tasks(username=temp['username'],tasksid=temp['tasksid'],tasksname=temp['tasksname'],taskstatus=temp['status'],starttime=temp['starttime'],taskaddress=temp['tasksaddress'],tasksport=temp['taskport'],endtime=temp['endtime'],createtime=temp['createtime'],num=temp['num'],completenum=temp['completenum'])
jobs.append(ajob)
return jobs,count,pagecount
return [],0,pagecount
开发者ID:LubyRuffy,项目名称:Scan-T,代码行数:55,代码来源:taskscontrol.py
示例2: jobupdate
def jobupdate(taskid='',jobport='',jobaddress='',jobname='',priority='',jobstatus='',starttime='',result='',username='',finishtime='',groupid=''):
request_params=[]
values_params=[]
wset_params=[]
wand_params=[]
if starttime!='':
request_params.append('starttime')
values_params.append(SQLTool.formatstring(starttime))
if finishtime!='':
request_params.append('endtime')
values_params.append(SQLTool.formatstring(finishtime))
if jobaddress!='':
request_params.append('taskaddress')
values_params.append(jobaddress)
if priority!='':
request_params.append('taskprior')
values_params.append(priority)
if jobname!='':
request_params.append('taskname')
values_params.append(jobname)
if jobstatus!='':
request_params.append('taskstatus')
values_params.append(jobstatus)
if jobport!='':
request_params.append('taskport')
values_params.append(jobport)
if result!='':
request_params.append('result')
values_params.append(result)
if username!='':
wset_params.append('username')
wand_params.append(SQLTool.formatstring(username))
if taskid!='':
wset_params.append('taskid')
wand_params.append(SQLTool.formatstring(taskid))
if groupid!='':
wset_params.append('groupsid')
wand_params.append(SQLTool.formatstring(str(groupid)))
table=localconfig.tasktable
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
tempresult=DBhelp.updatetableinfo_byparams([table],request_params,values_params,wset_params,wand_params)
DBhelp.closedb()
return tempresult
开发者ID:LubyRuffy,项目名称:Scan-T,代码行数:49,代码来源:jobcontrol.py
示例3: portadd
def portadd(port):
ip=port.getIP()
port=port.getVendor()
timesearch=port.getOsfamily()
state=port.getState()
name=port.getOsgen()
product=port.getUpdatetime()
version=port.getAccurate()
script=port.getHostname()
request_params=[]
values_params=[]
if ip!='':
request_params.append('ip')
values_params.append(SQLTool.formatstring(ip))
if port!='':
request_params.append('port')
values_params.append(SQLTool.formatstring(port))
if timesearch!='':
request_params.append('timesearch')
values_params.append(SQLTool.formatstring(timesearch))
if state!='':
request_params.append('state')
values_params.append(SQLTool.formatstring(state))
if name!='':
request_params.append('name')
values_params.append(SQLTool.formatstring(name))
if product!='':
request_params.append('product')
values_params.append(SQLTool.formatstring(product))
if version!='':
request_params.append('version')
values_params.append(SQLTool.formatstring(version))
if script!='':
request_params.append('script')
values_params.append(SQLTool.formatstring(script))
if detail!='':
request_params.append('detail')
values_params.append(SQLTool.formatstring(detail))
if head!='':
request_params.append('head')
values_params.append(SQLTool.formatstring(head))
table=localconfig.porttable
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
tempresult=None
try:
tempresult=DBhelp.replaceinserttableinfo_byparams(table, request_params, [tuple(values_params)])
except Exception,e:
print str(e)
开发者ID:suxinging,项目名称:toolforspider,代码行数:53,代码来源:portcontrol.py
示例4: ipshow
def ipshow(ip='',vendor='',osfamily='',osgen='',accurate='',updatetime='',hostname='',state='',page='0'):
validresult=False
request_params=[]
values_params=[]
if ip!='':
request_params.append('ip')
values_params.append(SQLTool.formatstring(ip))
if vendor!='':
request_params.append('vendor')
values_params.append(SQLTool.formatstring(vendor))
if osfamily!='':
request_params.append('osfamily')
values_params.append(SQLTool.formatstring(osfamily))
if osgen!='':
request_params.append('osgen')
values_params.append(SQLTool.formatstring(osgen))
if accurate!='':
request_params.append('accurate')
values_params.append(SQLTool.formatstring(accurate))
if updatetime!='':
request_params.append('updatetime')
values_params.append(SQLTool.formatstring(updatetime))
if hostname!='':
request_params.append('hostname')
values_params.append(SQLTool.formatstring(hostname))
if state!='':
request_params.append('state')
values_params.append(SQLTool.formatstring(state))
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
table=localconfig.iptable
result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['ip','vendor','osfamily','osgen','accurate','updatetime','hostname','state'], request_params, values_params)
if count == 0:
pagecount = 0;
elif count %limitpage> 0:
# pagecount = math.ceil(count / limitpage)
pagecount=int((count+limitpage-1)/limitpage)
else:
pagecount = count / limitpage
# print pagecount
if pagecount>0:
limit=' limit '+str(int(page)*limitpage)+','+str(limitpage)
result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['ip','vendor','osfamily','osgen','accurate','updatetime','hostname','state'], request_params, values_params,limit,order='updatetime desc')
DBhelp.closedb()
ips=[]
if count>0:
validresult=True
for temp in result :
aip=ipmain.Ip(ip=temp['ip'],vendor=temp['vendor'],osfamily=temp['osfamily'],osgen=temp['osgen'],accurate=temp['accurate'],updatetime=temp['updatetime'],hostname=temp['hostname'],state=temp['state'])
# aip=ipmain.Ip(ip=temp[0],vendor=temp[1],osfamily=temp[2],osgen=temp[3],accurate=temp[4],updatetime=temp[5],hostname=temp[6],state=temp[7])
ips.append(aip)
return ips,count,pagecount
return [],0,pagecount
开发者ID:WinneShen,项目名称:toolforspider,代码行数:59,代码来源:ipcontrol.py
示例5: storedata
def storedata(ip='',port='',hackinfo=None):
sqlTool=Sqldatatask.getObject()
localtime=str(time.strftime("%Y-%m-%d %X", time.localtime()))
insertdata=[]
# if islocalwork==0:
# work=[]
# dic={"table":config.Config.iptable,"select_params": ['ip','vendor','osfamily','osgen','accurate','updatetime','hostname','state'],"insert_values": [(temphosts,tempvendor,temposfamily,temposgen,tempaccuracy,localtime,temphostname,tempstate)]}
# tempdata={"func":'replaceinserttableinfo_byparams',"dic":dic}
# jsondata=uploaditem.UploadData(url=self.webconfig.upload_ip_info,way='POST',params=tempdata)
# work.append(jsondata)
# self.uploadwork.add_work(work)
# else:
hackinfo=SQLTool.escapewordby(str(hackinfo))
extra=' on duplicate key update hackinfo=\''+hackinfo+'\' , timesearch=\''+localtime+'\''
insertdata.append((str(ip),port,hackinfo,str(port)))
sqldatawprk=[]
dic={"table":config.Config.porttable,"select_params":['ip','port','hackinfo','portnumber'],"insert_values":insertdata,"extra":extra}
tempwprk=Sqldata.SqlData('inserttableinfo_byparams',dic)
sqldatawprk.append(tempwprk)
sqlTool.add_work(sqldatawprk)
pass
开发者ID:0x-Jin,项目名称:toolforspider,代码行数:27,代码来源:callbackresult.py
示例6: storedata
def storedata(ip='',port='',hackinfo=None):
sqlTool=Sqldatatask.getObject()
localtime=str(time.strftime("%Y-%m-%d %X", time.localtime()))
insertdata=[]
hackinfo=SQLTool.escapewordby(str(hackinfo))
extra=' on duplicate key update disclosure=\''+hackinfo+'\' , timesearch=\''+localtime+'\''
insertdata.append((str(ip),port,hackinfo,str(port)))
dic={"table":config.Config.porttable,"select_params":['ip','port','disclosure','portnumber'],"insert_values":insertdata,"extra":extra}
if islocalwork==0:
work=[]
tempdata={"func":'inserttableinfo_byparams',"dic":dic}
jsondata=uploaditem.UploadData(url=webconfig.WebConfig.upload_ip_info,way='POST',params=tempdata)
work.append(jsondata)
temp=uploadtask.getObject()
temp.add_work(work)
else:
sqldatawprk=[]
tempwprk=Sqldata.SqlData(func='inserttableinfo_byparams',dic)
sqldatawprk.append(tempwprk)
sqlTool.add_work(sqldatawprk)
print 'fuzz 数据存储'
pass
开发者ID:roottime,项目名称:normal_hack,代码行数:32,代码来源:callbackfuzz.py
示例7: portshow
def portshow(ip='',port='',timesearch='',state='',name='',product='',version='',script='',detail='',page='0',extra='',command='and'):
validresult=False
request_params=[]
values_params=[]
if ip!='':
request_params.append('ip')
values_params.append(SQLTool.formatstring(ip))
if port!='':
request_params.append('port')
values_params.append(SQLTool.formatstring(port))
if timesearch!='':
request_params.append('timesearch')
values_params.append(SQLTool.formatstring(timesearch))
if state!='':
request_params.append('state')
values_params.append(SQLTool.formatstring(state))
if name!='':
request_params.append('name')
values_params.append(SQLTool.formatstring(name))
if product!='':
request_params.append('product')
values_params.append(SQLTool.formatstring(product))
if version!='':
request_params.append('version')
values_params.append(SQLTool.formatstring(version))
if script!='':
request_params.append('script')
values_params.append(SQLTool.formatstring(script))
if detail!='':
request_params.append('detail')
values_params.append(SQLTool.formatstring(detail))
global DBhelp
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
localconfig=config.Config()
table=localconfig.porttable
content=None
result=None
try:
result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['ip','port','timesearch','state','name','product','version','script','detail'], request_params, values_params,extra=extra,command=command)
except Exception,e:
print str(e)+'portcontrol 50'
if DBhelp is not None:
DBhelp.closedb()
DBhelp=None
return [],0,0
开发者ID:WinneShen,项目名称:toolforspider,代码行数:46,代码来源:portcontrol.py
示例8: divided
def divided(ports,params='port'):
if ports=='':
return ''
sql=' and ( '
array=ports.split(',')
for i in range(len(array)-1):
resulto=re.match(r"^(\d*)\-(\d*)$",array[i])
if resulto:
p = re.compile(r'\d+')
list= p.findall(array[i])
sql+=params+' between '+SQLTool.formatstring(list[0])+' and '+ SQLTool.formatstring(list[1])+' or '
else:
p = re.compile(r'\d+$')
list= p.findall(array[i])
sql+=params+' ='+SQLTool.formatstring(list[0])+' or '
temp=array[len(array)-1]
resulto=re.match(r"^(\d*)\-(\d*)$",temp)
if resulto:
p = re.compile(r'\d+')
list= p.findall(temp)
sql+=params+' between '+SQLTool.formatstring(list[0])+' and '+ SQLTool.formatstring(list[1])+') '
else:
p = re.compile(r'\d+$')
list= p.findall(temp)
sql+=params+' ='+SQLTool.formatstring(list[0])+' ) '
return sql
开发者ID:suxinging,项目名称:toolforspider,代码行数:29,代码来源:portcontrol.py
示例9: mapshow
def mapshow(ip='',port='',state='',name='',product='',version='',searchcontent='',isdic=1):
localconfig=config.Config()
table=localconfig.porttable
iptable=localconfig.iptable
validresult=False
request_params=[]
values_params=[]
if ip!='':
request_params.append(table+'.'+'ip')
values_params.append(SQLTool.formatstring(ip))
if port!='':
request_params.append('port')
values_params.append(SQLTool.formatstring(port))
if state!='':
request_params.append(table+'.'+'state')
values_params.append(SQLTool.formatstring(state))
if name!='':
request_params.append('name')
values_params.append(SQLTool.formatstring(name))
if product!='':
request_params.append('product')
values_params.append(SQLTool.formatstring(product))
if version!='':
request_params.append('version')
values_params.append(SQLTool.formatstring(version))
global DBhelp
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
size = 0
content=None
result=None
sql=""""""
if isdic==0:
if searchcontent =='':
sql="""SELECT city, COUNT(*) FROM ip_maindata GROUP BY city"""
else:
sql="""SELECT city, COUNT(*) FROM (SELECT ip AS ipitem FROM snifferdata WHERE MATCH (version , product , head , detail , script , hackinfo , disclosure , keywords) AGAINST ('%s' IN BOOLEAN MODE)
GROUP BY ip) AS iptable LEFT JOIN ip_maindata ON ipitem = ip_maindata.ip GROUP BY city""" %(searchcontent)
else:
sql="""SELECT city, COUNT(*) FROM (SELECT ip AS ipitem FROM snifferdata WHERE """
request_params_length=len(request_params)
for k in range(0, request_params_length - 1):
sql = sql + request_params[k] + ' = ' + values_params[k] +' and '
sql = sql + request_params[request_params_length - 1] + ' = ' + values_params[request_params_length - 1] + ' '
sql = sql + """ GROUP BY ip) AS iptable LEFT JOIN ip_maindata ON ipitem = ip_maindata.ip GROUP BY city """
try:
result,content,count,col=DBhelp.searchtableinfo_byparams(table=sql,usesql=1)
except Exception,e:
print str(e)+'portcontrol 69'
if DBhelp is not None:
DBhelp.closedb()
return [],0,0
开发者ID:nanshihui,项目名称:Scan-T,代码行数:57,代码来源:mapcontrol.py
示例10: jobshow
def jobshow(jobname='',jobstatus='',username='',taskid='',jobport='',result='',page='0'):
validresult=False
request_params=[]
values_params=[]
if jobname!='':
request_params.append('taskname')
values_params.append(SQLTool.formatstring(jobname))
if jobstatus!='':
request_params.append('taskstatus')
values_params.append(SQLTool.formatstring(jobstatus))
if username!='':
request_params.append('username')
values_params.append(SQLTool.formatstring(username))
if taskid!='':
request_params.append('taskid')
values_params.append(SQLTool.formatstring(taskid))
if jobport!='':
request_params.append('taskport')
values_params.append(SQLTool.formatstring(jobport))
if result!='':
request_params.append('result')
values_params.append(SQLTool.formatstring(result))
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
table=localconfig.tasktable
result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['count(*)'], request_params, values_params)
if count>0:
count= int(result[0]['count(*)'])
if count == 0:
pagecount = 0;
elif count %limitpage> 0:
# pagecount = math.ceil(count / limitpage)
pagecount=int((count+limitpage-1)/limitpage)
else:
pagecount = count / limitpage
# print pagecount
if pagecount>0:
limit=' limit '+str(int(page)*limitpage)+','+str(limitpage)
result,content,count,col=DBhelp.searchtableinfo_byparams([table], ['username','taskid','taskname','taskprior','taskstatus','starttime','taskaddress','taskport','result','endtime','createtime','forcesearch'], request_params, values_params,limit,order='createtime desc')
DBhelp.closedb()
jobs=[]
if count>0:
validresult=True
for temp in result :
ajob=job.Job(username=temp['username'],jobid=temp['taskid'],jobname=temp['taskname'],priority=temp['taskprior'],jobstatus=temp['taskstatus'],starttime=temp['starttime'],jobaddress=temp['taskaddress'],jobport=temp['taskport'],result=temp['result'],endtime=temp['endtime'],createtime=temp['createtime'],forcesearch=temp['forcesearch'])
# ajob=job.Job(username=temp[0],jobid=temp[1],jobname=temp[2],priority=temp[3],jobstatus=temp[4],starttime=temp[5],jobaddress=temp[6],jobport=temp[7],result=temp[8],endtime=temp[9],createtime=temp[10],forcesearch=temp[11])
jobs.append(ajob)
return jobs,count,pagecount
return [],0,pagecount
开发者ID:0x-Jin,项目名称:toolforspider,代码行数:55,代码来源:jobcontrol.py
示例11: portabstractshow
def portabstractshow(ip='',port='',timesearch='',state='',name='',product='',version='',script='',detail='',page='0',extra='',command='and',head='',city='',hackinfo='',disclosure=''):
localconfig=config.Config()
table=localconfig.porttable
iptable=localconfig.iptable
validresult=False
request_params=[]
values_params=[]
if ip!='':
request_params.append(table+'.'+'ip')
values_params.append(SQLTool.formatstring(ip))
if port!='':
request_params.append('port')
values_params.append(SQLTool.formatstring(port))
if timesearch!='':
request_params.append('timesearch')
values_params.append(SQLTool.formatstring(timesearch))
if state!='':
request_params.append(table+'.'+'state')
values_params.append(SQLTool.formatstring(state))
if name!='':
request_params.append('name')
values_params.append(SQLTool.formatstring(name))
if product!='':
request_params.append('product')
values_params.append(SQLTool.formatstring(product))
if version!='':
request_params.append('version')
values_params.append(SQLTool.formatstring(version))
if script!='':
request_params.append('script')
values_params.append(SQLTool.formatstring(script))
if detail!='':
request_params.append('detail')
values_params.append(SQLTool.formatstring(detail))
if head!='':
request_params.append('head')
values_params.append(SQLTool.formatstring(head))
if city!='':
request_params.append('city')
values_params.append(SQLTool.formatstring(city))
global DBhelp
DBhelp=SQLTool.DBmanager()
DBhelp.connectdb()
content=None
result=None
try:
result,content,count,col=DBhelp.searchtableinfo_byparams([table+' left join ip_maindata on snifferdata.ip=ip_maindata.ip'], ['count(*)'], request_params, values_params,extra=extra,command=command)
except Exception,e:
print str(e)+'portcontrol 58'
if DBhelp is not None:
DBhelp.closedb()
DBhelp=None
return [],0,0
开发者ID:he1m4n6a,项目名称:toolforspider,代码行数:56,代码来源:portcontrol.py
示例12: str
result,content,count,col=DBhelp.searchtableinfo_byparams([table+' left join ip_maindata on snifferdata.ip=ip_maindata.ip'], [table+'.'+'ip','port','timesearch',table+'.'+'state','name','product','version','script','detail','head','city','hackinfo','disclosure'], request_params, values_params,limit=limit,order=table+'.'+'port',extra=extra,command=command)
except Exception,e:
print str(e)+'portcontrol 69'
if DBhelp is not None:
DBhelp.closedb()
return [],0,0
if DBhelp is not None:
DBhelp.closedb()
DBhelp=None
portarray=[]
if count>0:
validresult=True
for temp in result :
aport=ports.Port(ip=temp['ip'],port=temp['port'],timesearch=temp['timesearch'],state=temp['state'],name=temp['name'],product=temp['product'],version=temp['version'],script=SQLTool.decodestring(temp['script']),detail=SQLTool.decodestring(temp['detail']),head=SQLTool.decodestring(temp['head']),city=temp['city'],hackinfo=SQLTool.decodestring(temp['hackinfo']),disclosure=SQLTool.decodestring(temp['disclosure']))
# aport=ports.Port(ip=temp[0],port=temp[1],timesearch=temp[2],state=temp[3],name=temp[4],product=temp[5],version=temp[6],script=temp[7])
portarray.append(aport)
print str(count)+' '+str(pagecount)
return portarray,count,pagecount
return [],0,pagecount
def portshow(ip='',port='',timesearch='',state='',name='',product='',version='',script='',detail='',page='0',extra='',command='and',head='',city=''):
validresult=False
request_params=[]
values_params=[]
if ip!='':
request_params.append('ip')
values_params.append(SQLTool.formatstring(ip))
if port!='':
request_params.append('port')
开发者ID:he1m4n6a,项目名称:toolforspider,代码行数:31,代码来源:portcontrol.py
示例13: str
except Exception,e:
print str(e)+'portcontrol 69'
if DBhelp is not None:
DBhelp.closedb()
return [],0,0
if DBhelp is not None:
DBhelp.closedb()
DBhelp=None
portarray=[]
if count>0:
validresult=True
import base64
for temp in result :
aport=ports.Port(ip=temp['ip'],port=temp['port'],timesearch=temp['timesearch'],state=temp['state'],name=temp['name'],product=temp['product'],version=temp['version'],script=base64.b64encode(SQLTool.getdecodeproperty(temp,'script')),detail=SQLTool.getdecodeproperty(temp,'detail'),head=SQLTool.getdecodeproperty(temp,'head'),city=temp['city'],hackinfo=SQLTool.getdecodeproperty(temp,'hackinfo'),disclosure=SQLTool.getdecodeproperty(temp,'disclosure'))
# aport=ports.Port(ip=temp[0],port=temp[1],timesearch=temp[2],state=temp[3],name=temp[4],product=temp[5],version=temp[6],script=temp[7])
portarray.append(aport)
print str(count)+' '+str(pagecount)
return portarray,count,pagecount
return [],0,pagecount
def portshow(ip='',port='',timesearch='',state='',name='',product='',version='',script='',detail='',page='0',extra='',command='and',head='',city='',order='port'):
validresult=False
request_params=[]
values_params=[]
if ip!='':
request_params.append('ip')
values_params.append(SQLTool.formatstring(ip))
if port!='':
request_params.append('port')
开发者ID:nanshihui,项目名称:Scan-T,代码行数:31,代码来源:portcontrol.py
注:本文中的spidertool.SQLTool类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论