def task(self, req, threadname): self.logger and self.logger.info('%sNMAP 扫描执行任务中%s', threadname, str(datetime.datetime.now())) jobid = req.getJobid() jobid = str(jobid) hosts = req.getJobaddress() ports = req.getPort() arguments = req.getArgument() isjob = req.getisJob() if isjob == '1': tempresult = jobcontrol.jobupdate(jobstatus='3', taskid=str(jobid), starttime=webtool.getlocaltime()) ans = self.sniffer.scanaddress([hosts], [str(ports)], arguments) self.logger and self.logger.info('%sNMAP 扫描任务结束%s', threadname, str(datetime.datetime.now())) if isjob == '1': tempresult = jobcontrol.jobupdate( jobstatus='5', taskid=str(jobid), finishtime=webtool.getlocaltime()) setvalue = " (select count(*) from taskdata where taskstatus=5 and groupsid= (select groupsid from taskdata where taskid='" + jobid + "'))" dic = { "table": [self.config.taskstable], "select_params": ['completenum'], "set_params": [setvalue], "request_params": ['tasksid'], "equal_params": [ '(select groupsid from taskdata where taskid=\'' + jobid + '\')' ] } updateitem = Sqldata.SqlData('updatetableinfo_byparams', dic) updatedata = [] updatedata.append(updateitem) statusdic = { "table": [self.config.taskstable], "select_params": ['status'], "set_params": ['5'], "request_params": ['num'], "equal_params": ['completenum'] } statusitem = Sqldata.SqlData('updatetableinfo_byparams', statusdic) updatedata.append(statusitem) self.sqlTool.add_work(updatedata) # ans='' return ans
def task(self,req,threadname): print threadname+'执行任务中'+str(datetime.datetime.now()) jobid=req.getJobid() hosts=req.getJobaddress(); ports=req.getPort() arguments=req.getArgument() isjob=req.getisJob() if isjob=='1': tempresult=jobcontrol.jobupdate(jobstatus='3',taskid=jobid,starttime=webtool.getlocaltime()) ans = self.sniffer.scanaddress([hosts], [str(ports)], arguments) print threadname+'任务结束'+str(datetime.datetime.now()) if isjob=='1': tempresult=jobcontrol.jobupdate(jobstatus='5',taskid=jobid,finishtime=webtool.getlocaltime()) return ans
def task(self,req,threadname): self.logger and self.logger.info('%sNMAP 扫描执行任务中%s', threadname,str(datetime.datetime.now())) jobid=req.getJobid() hosts=req.getJobaddress(); ports=req.getPort() arguments=req.getArgument() isjob=req.getisJob() if isjob=='1': tempresult=jobcontrol.jobupdate(jobstatus='3',taskid=jobid,starttime=webtool.getlocaltime()) ans = self.sniffer.scanaddress([hosts], [str(ports)], arguments) self.logger and self.logger.info('%sNMAP 扫描任务结束%s', threadname,str(datetime.datetime.now())) if isjob=='1': tempresult=jobcontrol.jobupdate(jobstatus='5',taskid=jobid,finishtime=webtool.getlocaltime()) return ans
def task(self, req, threadname): print threadname + '执行任务中' + str(datetime.datetime.now()) jobid = req.getJobid() hosts = req.getJobaddress() ports = req.getPort() arguments = req.getArgument() isjob = req.getisJob() if isjob == '1': tempresult = jobcontrol.jobupdate(jobstatus='3', taskid=jobid, starttime=webtool.getlocaltime()) ans = self.sniffer.scanaddress([hosts], [str(ports)], arguments) print threadname + '任务结束' + str(datetime.datetime.now()) if isjob == '1': tempresult = jobcontrol.jobupdate( jobstatus='5', taskid=jobid, finishtime=webtool.getlocaltime()) return ans
def task(self,req,threadname): self.logger and self.logger.info('%sNMAP 扫描执行任务中%s', threadname,str(datetime.datetime.now())) jobid=req.getJobid() jobid=str(jobid) hosts=req.getJobaddress(); ports=req.getPort() arguments=req.getArgument() isjob=req.getisJob() if isjob=='1': tempresult=jobcontrol.jobupdate(jobstatus='3',taskid=str(jobid),starttime=webtool.getlocaltime()) ans = self.sniffer.scanaddress([hosts], [str(ports)], arguments) self.logger and self.logger.info('%sNMAP 扫描任务结束%s', threadname,str(datetime.datetime.now())) if isjob=='1': tempresult=jobcontrol.jobupdate(jobstatus='5',taskid=str(jobid),finishtime=webtool.getlocaltime()) setvalue = " (select count(*) from taskdata where taskstatus=5 and groupsid= (select groupsid from taskdata where taskid='"+jobid+"'))" dic = { "table": [self.config.taskstable], "select_params": ['completenum'], "set_params": [setvalue], "request_params": ['tasksid'], "equal_params": ['(select groupsid from taskdata where taskid=\''+jobid+'\')'] } updateitem = Sqldata.SqlData('updatetableinfo_byparams', dic) updatedata = [] updatedata.append(updateitem) statusdic={ "table": [self.config.taskstable], "select_params": ['status'], "set_params": ['5'], "request_params": ['num'], "equal_params": ['completenum'] } statusitem = Sqldata.SqlData('updatetableinfo_byparams', statusdic) updatedata.append(statusitem) self.sqlTool.add_work(updatedata) # ans='' return ans