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


Python Folders.create方法代码示例

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


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

示例1: test_migration_201_202

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_migration_201_202():
    set_cwd(tempfile.mkdtemp())
    Folders.create(cwd(), "conf")
    Files.create(cwd("conf"), "virtualbox.conf", """
[virtualbox]
machines = cuckoo1, cuckoo2
[cuckoo1]
platform = windows
[cuckoo2]
platform = windows
""")
    # Except for virtualbox.
    machineries = (
        "avd", "esx", "kvm", "physical", "qemu",
        "vmware", "vsphere", "xenserver",
    )
    for machinery in machineries:
        Files.create(
            cwd("conf"), "%s.conf" % machinery,
            "[%s]\nmachines =" % machinery
        )
    cfg = Config.from_confdir(cwd("conf"), loose=True)
    cfg = migrate(cfg, "2.0.1", "2.0.2")
    assert cfg["virtualbox"]["cuckoo1"]["osprofile"] is None
    assert cfg["virtualbox"]["cuckoo2"]["osprofile"] is None
开发者ID:consen,项目名称:cuckoo,代码行数:27,代码来源:test_config.py

示例2: test_migration_203_204

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_migration_203_204():
    set_cwd(tempfile.mkdtemp())
    Folders.create(cwd(), "conf")
    Files.create(cwd("conf"), "processing.conf", """
[dumptls]
enabled = on
""")
    Files.create(cwd("conf"), "qemu.conf", """
[qemu]
machines = ubuntu32, ubuntu64
[ubuntu32]
arch = x86
[ubuntu64]
arch = x64
    """)
    cfg = Config.from_confdir(cwd("conf"), loose=True)
    cfg = migrate(cfg, "2.0.3", "2.0.4")
    assert cfg["processing"]["extracted"]["enabled"] is True
    # Except for qemu.
    machineries = (
        "avd", "esx", "kvm", "physical", "virtualbox",
        "vmware", "vsphere", "xenserver",
    )
    for machinery in machineries:
        Files.create(
            cwd("conf"), "%s.conf" % machinery, "[%s]\nmachines =" % machinery
        )
    assert cfg["qemu"]["ubuntu32"]["enable_kvm"] is False
    assert cfg["qemu"]["ubuntu32"]["snapshot"] is None
开发者ID:consen,项目名称:cuckoo,代码行数:31,代码来源:test_config.py

示例3: test_multiple_folders

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
 def test_multiple_folders(self):
     """Tests multiple folders creation."""
     Folders.create(self.tmp_dir, ["foo", "bar"])
     assert os.path.exists(os.path.join(self.tmp_dir, "foo"))
     assert os.path.exists(os.path.join(self.tmp_dir, "bar"))
     os.rmdir(os.path.join(self.tmp_dir, "foo"))
     os.rmdir(os.path.join(self.tmp_dir, "bar"))
开发者ID:consen,项目名称:cuckoo,代码行数:9,代码来源:test_utils.py

示例4: test_create_tuple

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
    def test_create_tuple(self):
        dirpath = tempfile.mkdtemp()
        Folders.create(dirpath, "foo")
        Files.create((dirpath, "foo"), "a.txt", "bar")

        filepath = os.path.join(dirpath, "foo", "a.txt")
        assert open(filepath, "rb").read() == "bar"
开发者ID:consen,项目名称:cuckoo,代码行数:9,代码来源:test_utils.py

示例5: test_am_init_duplicate_analysis

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_am_init_duplicate_analysis():
    am = am_init()

    Folders.create(cwd(analysis=1234))
    assert am.init() is False

    # Manually disable per-task logging initiated by init().
    task_log_stop(1234)
开发者ID:consen,项目名称:cuckoo,代码行数:10,代码来源:test_scheduler.py

示例6: create_folders

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
    def create_folders(self):
        folders = "shots", "files", "logs", "buffer", "extracted"

        try:
            Folders.create(self.storagepath, folders)
        except CuckooOperationalError as e:
            log.error("Issue creating analyses folders: %s", e)
            return False
开发者ID:MAECProject,项目名称:cuckoo,代码行数:10,代码来源:resultserver.py

示例7: test_migration_204_205

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_migration_204_205():
    set_cwd(tempfile.mkdtemp())
    Folders.create(cwd(), "conf")
    Files.create(cwd("conf"), "auxiliary.conf", """
[mitm]
script = mitm.py
""")
    cfg = Config.from_confdir(cwd("conf"), loose=True)
    cfg = migrate(cfg, "2.0.4", "2.0.5")
    assert cfg["auxiliary"]["mitm"]["script"] == "stuff/mitm.py"
开发者ID:consen,项目名称:cuckoo,代码行数:12,代码来源:test_config.py

示例8: test_migration_200_201

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_migration_200_201():
    set_cwd(tempfile.mkdtemp())
    Folders.create(cwd(), "conf")
    Files.create(cwd("conf"), "memory.conf", """
[mask]
pid_generic =
""")
    cfg = Config.from_confdir(cwd("conf"), loose=True)
    cfg = migrate(cfg, "2.0.0", "2.0.1")
    assert cfg["memory"]["mask"]["pid_generic"] == []
开发者ID:consen,项目名称:cuckoo,代码行数:12,代码来源:test_config.py

示例9: test_migration_100_110

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_migration_100_110():
    set_cwd(tempfile.mkdtemp())
    Folders.create(cwd(), "conf")
    Files.create(cwd("conf"), "cuckoo.conf", """
[cuckoo]
delete_original = on
""")
    cfg = Config.from_confdir(cwd("conf"), loose=True)
    cfg = migrate(cfg, "1.0.0", "1.1.0")
    assert cfg["cuckoo"]["cuckoo"]["tmppath"] == "/tmp"
开发者ID:consen,项目名称:cuckoo,代码行数:12,代码来源:test_config.py

示例10: test_temp_conf

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
    def test_temp_conf(self):
        dirpath = tempfile.mkdtemp()
        set_cwd(dirpath)

        Folders.create(dirpath, "conf")
        with open(os.path.join(dirpath, "conf", "cuckoo.conf"), "wb") as f:
            f.write("[cuckoo]\ntmppath = %s" % dirpath)

        filepath = Files.temp_put("foo")
        assert filepath.startswith(os.path.join(dirpath, "cuckoo-tmp"))
开发者ID:consen,项目名称:cuckoo,代码行数:12,代码来源:test_utils.py

示例11: test_migration_203_204

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_migration_203_204():
    set_cwd(tempfile.mkdtemp())
    Folders.create(cwd(), "conf")
    Files.create(cwd("conf"), "processing.conf", """
[dumptls]
enabled = on
""")
    cfg = Config.from_confdir(cwd("conf"), loose=True)
    cfg = migrate(cfg, "2.0.3", "2.0.4")
    assert cfg["processing"]["extracted"]["enabled"] is True
开发者ID:jgajek,项目名称:cuckoo,代码行数:12,代码来源:test_config.py

示例12: setup

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
    def setup(self):
        set_cwd(tempfile.mkdtemp())
        Folders.create(cwd(), "conf")
        write_cuckoo_conf()

        with mock.patch("cuckoo.common.abstracts.Database") as p:
            p.return_value = mock.MagicMock()
            self.m = QEMU()

        self.m.db.clean_machines.assert_called_once()
        self.m.set_options(Config("qemu"))
开发者ID:LetMeR00t,项目名称:cuckoo,代码行数:13,代码来源:test_qemu.py

示例13: test_create_temp_conf

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
    def test_create_temp_conf(self):
        """Test creation of temporary directory with configuration."""
        dirpath = tempfile.mkdtemp()
        set_cwd(dirpath)

        Folders.create(dirpath, "conf")
        with open(os.path.join(dirpath, "conf", "cuckoo.conf"), "wb") as f:
            f.write("[cuckoo]\ntmppath = %s" % dirpath)

        dirpath2 = Folders.create_temp()
        assert dirpath2.startswith(os.path.join(dirpath, "cuckoo-tmp"))
开发者ID:consen,项目名称:cuckoo,代码行数:13,代码来源:test_utils.py

示例14: setup

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
    def setup(self):
        set_cwd(tempfile.mkdtemp())
        Folders.create(cwd(), "conf")

        self.vbox_path = cwd("conf", "virtualbox.conf")
        open(self.vbox_path, "wb").write(VIRTUALBOX_CONFIG_EXAMPLE)
        self.virtualbox = Config(file_name="virtualbox", cfg=self.vbox_path)

        filepath = cwd("conf", "cuckoo.conf")
        open(filepath, "wb").write(CUCKOO_CONFIG_EXAMPLE)
        self.cuckoo = Config(file_name="cuckoo", cfg=filepath)
开发者ID:consen,项目名称:cuckoo,代码行数:13,代码来源:test_config.py

示例15: test_invalid_section

# 需要导入模块: from cuckoo.common.files import Folders [as 别名]
# 或者: from cuckoo.common.files.Folders import create [as 别名]
def test_invalid_section():
    set_cwd(tempfile.mkdtemp())
    Folders.create(cwd(), "conf")

    Files.create(cwd("conf"), "cuckoo.conf", "[invalid_section]\nfoo = bar")
    with pytest.raises(CuckooConfigurationError) as e:
        Config("cuckoo", strict=True)
    e.match("Config section.*not found")

    Files.create(cwd("conf"), "cuckoo.conf", "[cuckoo]\ninvalid = entry")
    with pytest.raises(CuckooConfigurationError) as e:
        config("cuckoo:invalid:entry", strict=True)
    e.match("No such configuration value exists")
开发者ID:consen,项目名称:cuckoo,代码行数:15,代码来源:test_config.py


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