def DeleteAllTask(self): mysql = MySQLHander() sql = "select target,data from task where success=1" mysql.query(sql) slist = mysql.fetchAllRows() for line in slist: sql = "insert into successlist(`target` ,`data`) values (\"{0}\")".format(line[0], line[1]) mysql.insert(sql) sql = "delete from task" mysql.update(sql) mysql.close() print "[!] task schedule has been clear!"
def Save_Success_Target(): while True: mysql = MySQLHander() sql = "select taskid,target,data from task where success=1 and action=0" mysql.query(sql) resource = mysql.fetchAllRows() if resource != None: for line in resource: sql = "insert into successlist(`target`, `data`) values (\"{0}\", \"{1}\")".format(line[1], line[2]) mysql.insert(sql) sql = "update task set action=1 where taskid='{0}'".format(line[0]) mysql.update(sql) print '[*] save success target {0}'.format(line[1]) mysql.close() time.sleep(3)
def NewTaskId(self, **kwargs): url = "{0}/task/new".format(self.address) response = json.loads(requests.get(url).text) if response['success']: db = MySQLHander() taskid = response['taskid'] sql = "insert into task(`target`, `taskid`, `server`) VALUES (\"{0}\", \"{1}\", \"{2}\")"\ .format(kwargs['target'], taskid, self.address) if db.insert(sql) == 0L: print "Apply New TaskId Success!" else: print "Apply New Task Fail" del db return taskid else: return False