Exemplo n.º 1
0
 def update_settings(self, kwargs):
     mysql = MySQLHander()
     sql = "update settings set server=\"{0}\", writelist=\"{1}\", blacklist=\"{2}\", proxyaddr=\"{3}\"," \
           "rootdomain=\"{4}\", blackdomain = \"{5}\" where id=1 ".format(kwargs.form['sqlmapaddr'], \
           kwargs.form['writelist'],kwargs.form['blacklist'],\
           kwargs.form['proxyaddr'], getrootdomain(kwargs.form['target']), getrootdomain(kwargs.url))
     mysql.update(sql)
     mysql.close()
Exemplo n.º 2
0
 def SaveData(target, data):
     sql = ""
     mysql = MySQLHander()
     if len(data['data']) == 0:
         sql = "update task set success=0 where target=\"{0}\"".format(target)
     else:
         sql = "update task set data=\"{0}\",success=1 where target=\"{1}\"".format(\
             Tools.dict2base64(data['data'][0]['value'][0]['data']), target)
     mysql.update(sql)
     mysql.close()
     return
Exemplo n.º 3
0
 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!"
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
def Thread_Handle(taskid, target):
    lock.acquire()
    sql = SqlMapAction()
    server = sql._get_server()
    url_status = "{0}/scan/{1}/status".format(server, taskid)
    url_log = "{0}/scan/{1}/log".format(server, taskid)
    url_data="{0}/scan/{1}/data".format(server, taskid)
    mysql = MySQLHander()
    response_status = json.loads(requests.get(url_status,None).text)['status']
    while response_status != "terminated" and response_status!="deleting":
        time.sleep(2)
        response_status = json.loads(requests.get(url_status,None).text)['status']
        sql = "update `task` set status = \"{0}\" where taskid=\"{1}\"".format(response_status, taskid)
        mysql.update(sql)
    response_data = json.loads(requests.get(url_data, None).text)
    if response_data==None:
        return False
    Action.SaveData(target, response_data)
    mysql.close()
    lock.release()
    return True