• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python bottle.abort函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: option_get

def option_get(taskid):
    """
    Get the value of an option (command line switch) for a certain task ID
    """
    if taskid not in tasks:
        abort(500, "Invalid task ID")

    option = request.json.get("option", "")

    if option in tasks[taskid]:
        return jsonize({option: tasks[taskid][option]})
    else:
        return jsonize({option: None})
开发者ID:gtie,项目名称:sqlmap,代码行数:13,代码来源:api.py


示例17: scan_log

def scan_log(taskid):
    """
    Retrieve the log messages
    """
    if taskid not in tasks:
        abort(500, "Invalid task ID")

    LOGGER_OUTPUT.seek(0)
    output = LOGGER_OUTPUT.read()
    LOGGER_OUTPUT.flush()
    LOGGER_OUTPUT.truncate(0)

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


示例18: scan_kill

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

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

    tasks[taskid].engine_kill()

    logger.debug("Killed scan for task ID %s" % taskid)
    return jsonize({"success": True})
开发者ID:simiaosimis,项目名称:sqlmap,代码行数:13,代码来源:api.py


示例19: scan_delete

def scan_delete(taskid):
    """
    Delete a scan and corresponding temporary output directory
    """
    global tasks

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

    if "oDir" in tasks[taskid] and tasks[taskid].oDir is not None:
        shutil.rmtree(tasks[taskid].oDir)

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


示例20: scan_delete

def scan_delete(taskid):
    """
    Delete a scan and corresponding temporary output directory and IPC database
    """
    global tasks

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

    scan_stop(taskid)
    tasks[taskid].clean_filesystem()

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python chardet.detect函数代码示例发布时间:2022-05-27
下一篇:
Python settings.apply_settings函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap