当前位置: 首页>>代码示例>>Python>>正文


Python bottle.abort函数代码示例

本文整理汇总了Python中thirdparty.bottle.bottle.abort函数的典型用法代码示例。如果您正苦于以下问题:Python abort函数的具体用法?Python abort怎么用?Python abort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了abort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scan_log_limited

def scan_log_limited(taskid, start, end):
    """
    Retrieve a subset of log messages
    """
    global procs

    json_log_messages = {}

    if taskid not in tasks:
        abort(500, "Invalid task ID")

    # Temporary "protection" against SQL injection FTW ;)
    if not start.isdigit() or not end.isdigit() or end <= start:
        abort(500, "Invalid start or end value, must be digits")

    start = max(1, int(start))
    end = max(1, int(end))

    # Read a subset of log messages from the temporary I/O database
    procs[taskid].ipc_database_cursor.execute("SELECT id, time, level, message FROM logs WHERE id >= %d AND id <= %d" % (start, end))
    db_log_messages = procs[taskid].ipc_database_cursor.fetchall()

    for (id_, time_, level, message) in db_log_messages:
        json_log_messages[id_] = {"time": time_, "level": level, "message": message}

    return jsonize({"log": json_log_messages})
开发者ID:impoundking,项目名称:sqlmap-1,代码行数:26,代码来源:api.py

示例2: scan_output

def scan_output(taskid):
    """
    Read the standard output of sqlmap core execution
    """
    global procs
    global tasks

    json_stdout_message = []
    json_stderr_message = []

    if taskid not in tasks:
        abort(500, "Invalid task ID")

    # Read all stdout messages from the temporary I/O database
    procs[taskid].ipc_database_cursor.execute("SELECT message FROM stdout")
    db_stdout_messages = procs[taskid].ipc_database_cursor.fetchall()

    for message in db_stdout_messages:
        json_stdout_message.append(message)

    # Read all stderr messages from the temporary I/O database
    procs[taskid].ipc_database_cursor.execute("SELECT message FROM stderr")
    db_stderr_messages = procs[taskid].ipc_database_cursor.fetchall()

    for message in db_stderr_messages:
        json_stderr_message.append(message)

    return jsonize({"stdout": json_stdout_message, "stderr": json_stderr_message})
开发者ID:impoundking,项目名称:sqlmap-1,代码行数:28,代码来源:api.py

示例3: scan_start

def scan_start(taskid):
    """
    Launch a scan
    """
    global tasks

    if taskid not in tasks:
        abort(500, "Invalid task ID")

    # Initialize sqlmap engine's options with user's provided options
    # within the JSON request
    for key, value in request.json.items():
        tasks[taskid][key] = value

    # Overwrite output directory (oDir) value to a temporary directory
    tasks[taskid].oDir = tempfile.mkdtemp(prefix="sqlmap-")

    # Launch sqlmap engine in a separate thread
    logger.debug("starting a scan for task ID %s" % taskid)

    if _multiprocessing:
        #_multiprocessing.log_to_stderr(logging.DEBUG)
        p = _multiprocessing.Process(name=taskid, target=start_scan)
        p.daemon = True
        p.start()
        p.join()

    return jsonize({"success": True})
开发者ID:gtie,项目名称:sqlmap,代码行数:28,代码来源:api.py

示例4: scan_start

def scan_start(taskid):
    """
    Launch a scan
    """
    global tasks
    global procs
    global pipes

    if taskid not in tasks:
        abort(500, "Invalid task ID")

    # Initialize sqlmap engine's options with user's provided options
    # within the JSON request
    for key, value in request.json.items():
        tasks[taskid][key] = value

    # Overwrite output directory (oDir) value to a temporary directory
    tasks[taskid].oDir = tempfile.mkdtemp(prefix="sqlmap-")

    # Launch sqlmap engine in a separate thread
    logger.debug("starting a scan for task ID %s" % taskid)

    pipes[taskid] = os.pipe()

    # Provide sqlmap engine with the writable pipe for logging
    tasks[taskid]["fdLog"] = pipes[taskid][1]

    # Launch sqlmap engine
    procs[taskid] = execute("python sqlmap.py --pickled-options %s" % base64pickle(tasks[taskid]), shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)

    return jsonize({"success": True})
开发者ID:charl1,项目名称:sqlmap,代码行数:31,代码来源:api.py

示例5: option_list

def option_list(taskid):
    """
    List options for a certain task ID
    """
    if taskid not in tasks:
        abort(500, "Invalid task ID")

    return jsonize(tasks[taskid])
开发者ID:gtie,项目名称:sqlmap,代码行数:8,代码来源:api.py

示例6: task_list

def task_list(taskid):
    """
    List all active tasks
    """
    if is_admin(taskid):
        return jsonize({"tasks": tasks})
    else:
        abort(401)
开发者ID:gtie,项目名称:sqlmap,代码行数:8,代码来源:api.py

示例7: task_list

def task_list(taskid):
    """
    List task pull
    """
    if is_admin(taskid):
        logger.debug("Listed task pull")
        return jsonize({"tasks": tasks, "tasks_num": len(tasks)})
    else:
        abort(401)
开发者ID:simiaosimis,项目名称:sqlmap,代码行数:9,代码来源:api.py

示例8: scan_logstruct

def scan_logstruct(taskid):
    """
    Generic function to return the last N lines of structured output
    """
    if taskid not in tasks:
        abort(500, "Invalid task ID")

    output = LOG_RECORDER.get_logs(request.GET.get('start'),request.GET.get('end'))
    return jsonize({"logstruct": output})
开发者ID:gtie,项目名称:sqlmap,代码行数:9,代码来源:api.py

示例9: task_destroy

def task_destroy(taskid):
    """
    Destroy own task ID
    """
    if taskid in tasks and not is_admin(taskid):
        tasks.pop(taskid)
        return jsonize({"success": True})
    else:
        abort(500, "Invalid task ID")
开发者ID:gtie,项目名称:sqlmap,代码行数:9,代码来源:api.py

示例10: status

def status(taskid):
    """
    Verify the status of the API as well as the core
    """

    if is_admin(taskid):
        tasks_num = len(tasks)
        return jsonize({"tasks": tasks_num})
    else:
        abort(401)
开发者ID:seotwister,项目名称:sqlmap,代码行数:10,代码来源:api.py

示例11: scan_kill

def scan_kill(taskid):
    """
    Kill a scan
    """
    global tasks

    if taskid not in tasks:
        abort(500, "Invalid task ID")

    return jsonize({"success": tasks[taskid].engine_kill()})
开发者ID:bussiere,项目名称:sqlmap,代码行数:10,代码来源:api.py

示例12: task_destroy

def task_destroy(taskid):
    """
    Destroy own task ID
    """
    if taskid in tasks:
        tasks[taskid].clean_filesystem()
        tasks.pop(taskid)
        return jsonize({"success": True})
    else:
        abort(500, "Invalid task ID")
开发者ID:bussiere,项目名称:sqlmap,代码行数:10,代码来源:api.py

示例13: status

def status(taskid):
    """
    Verify the status of the API as well as the core
    """

    if is_admin(taskid):
        busy = kb.get("busyFlag")
        tasks_num = len(tasks)
        return jsonize({"busy": busy, "tasks": tasks_num})
    else:
        abort(401)
开发者ID:gtie,项目名称:sqlmap,代码行数:11,代码来源:api.py

示例14: task_delete

def task_delete(taskid):
    """
    Delete own task ID
    """
    if taskid in tasks:
        tasks[taskid].clean_filesystem()
        tasks.pop(taskid)

        logger.debug("Deleted task ID: %s" % taskid)
        return jsonize({"success": True})
    else:
        abort(500, "Invalid task ID")
开发者ID:simiaosimis,项目名称:sqlmap,代码行数:12,代码来源:api.py

示例15: option_set

def option_set(taskid):
    """
    Set an option (command line switch) for a certain task ID
    """
    global tasks

    if taskid not in tasks:
        abort(500, "Invalid task ID")

    for key, value in request.json.items():
        tasks[taskid][key] = value

    return jsonize({"success": True})
开发者ID:gtie,项目名称:sqlmap,代码行数:13,代码来源:api.py


注:本文中的thirdparty.bottle.bottle.abort函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。