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


Python Database.view_machine方法代码示例

本文整理汇总了Python中lib.cuckoo.core.database.Database.view_machine方法的典型用法代码示例。如果您正苦于以下问题:Python Database.view_machine方法的具体用法?Python Database.view_machine怎么用?Python Database.view_machine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.cuckoo.core.database.Database的用法示例。


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

示例1: main

# 需要导入模块: from lib.cuckoo.core.database import Database [as 别名]
# 或者: from lib.cuckoo.core.database.Database import view_machine [as 别名]
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("vmname", type=str, help="Name of the Virtual Machine.")
    parser.add_argument("--debug", action="store_true", help="Debug log in case of errors.")
    parser.add_argument("--add", action="store_true", help="Add a Virtual Machine.")
    parser.add_argument("--delete", action="store_true", help="Delete a Virtual Machine.")
    parser.add_argument("--ip", type=str, help="Static IP Address.")
    parser.add_argument("--platform", type=str, default="windows", help="Guest Operating System.")
    parser.add_argument("--options", type=str, help="Machine options.")
    parser.add_argument("--tags", type=str, help="Tags for this Virtual Machine.")
    parser.add_argument("--interface", type=str, help="Sniffer interface for this machine.")
    parser.add_argument("--snapshot", type=str, help="Specific Virtual Machine Snapshot to use.")
    parser.add_argument("--resultserver", type=str, help="IP:Port of the Result Server.")
    args = parser.parse_args()

    logging.basicConfig()
    log = logging.getLogger()

    if args.debug:
        log.setLevel(logging.DEBUG)

    db = Database()
    conf = Config()

    if args.resultserver:
        resultserver_ip, resultserver_port = args.resultserver.split(":")
    else:
        resultserver_ip = conf.resultserver.ip
        resultserver_port = conf.resultserver.port

    if args.add:
        if db.view_machine(args.vmname):
            sys.exit("A Virtual Machine with this name already exists!")

        db.add_machine(
            args.vmname,
            args.vmname,
            args.ip,
            args.platform,
            args.options,
            args.tags,
            args.interface,
            args.snapshot,
            resultserver_ip,
            int(resultserver_port),
        )
        db.unlock_machine(args.vmname)

        update_conf(conf.cuckoo.machinery, args, action="add")

    if args.delete:
        # TODO Add a db.del_machine() function for runtime modification.
        update_conf(conf.cuckoo.machinery, args, action="delete")
开发者ID:Cyber-Forensic,项目名称:cuckooml,代码行数:55,代码来源:machine.py


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