Beispiel #1
0
def _get_by_ip(conn, host):
    sql_string = "SELECT * FROM host_tbl h WHERE h.ipv4 = %s"
    data = _sql._get_an_item(conn, sql_string, tuple([host["ipv4"]]))
    return data
Beispiel #2
0
def get_code_by_user(conn, user_name):
    sql_string = "SELECT * FROM verify_tbl WHERE user_name = %s"
    result = _sql._get_an_item(conn, sql_string, tuple([user_name]))
    if result is None:
        return None
    return _convert.verify_code_to_dict(result)
Beispiel #3
0
def _get_verify_code(conn, user):
    sql_string = "SELECT * FROM verify_tbl WHERE user_name = %s"
    result = _sql._get_an_item(conn, sql_string, tuple([user["userName"]]))
    return result
Beispiel #4
0
def _get_from_db(conn, data):
    sql_string = "SELECT * FROM task_tbl  WHERE user_name = %s AND ipv4 = %s"
    result = _sql._get_an_item(conn, sql_string, tuple([data["userName"],data["ipv4"]]))
    return result
Beispiel #5
0
def _get_list_new(conn):
    sql_string = "SELECT * FROM task_tbl WHERE status = 0 ORDER BY time_stamp DESC"
    result = _sql._get_an_item(conn, sql_string, None)
    return result
Beispiel #6
0
def _get_credits(conn, user_name):
    sql_string = """SELECT credits FROM user_tbl WHERE user_name = %s"""
    result = _sql._get_an_item(conn, sql_string, tuple([user_name]))
    return result
Beispiel #7
0
def _get_by_email(conn, email):
    sql_string = """SELECT user_name FROM user_tbl WHERE email = %s"""
    result = _sql._get_an_item(conn, sql_string, tuple([email]))
    return result
Beispiel #8
0
def _get_by_name(conn, user_name):
    sql_string = """SELECT * FROM user_tbl WHERE user_name = %s"""
    data = _sql._get_an_item(conn, sql_string, tuple([user_name]))
    if data is None:
        return None
    return _convert.user_list_to_dict(data)
Beispiel #9
0
def _check_exits(conn, port_id, cve_num):
    sql_string = "SELECT * FROM port_vuln_tbl  WHERE port_id = %s AND cve_num = %s"
    result = _sql._get_an_item(conn, sql_string, tuple([port_id, cve_num]))
    return result
Beispiel #10
0
def _check_exits_on_db(conn, host_ip, port_num):
    sql_string = "SELECT * FROM port_tbl p WHERE p.port_num = %s AND p.host_ip = %s"
    data = _sql._get_an_item(conn, sql_string, tuple([port_num,host_ip]))
    return data
Beispiel #11
0
def _get_by_id(conn, port):
    sql_string = "SELECT * FROM port_tbl p WHERE p.port_id = %s"
    data = _sql._get_an_item(conn, sql_string, tuple([port["port_id"]]))
    return data
Beispiel #12
0
def get_by_num(conn, cve_num):
    sql_string = "SELECT * FROM vuln_tbl  WHERE cve_num = %s"
    result = _sql._get_an_item(conn, sql_string, tuple([cve_num]))
    return result