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


Python files.Folders类代码示例

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


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

示例1: test_multiple_folders

 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,代码行数:7,代码来源:test_utils.py

示例2: test_copy_folder

    def test_copy_folder(self):
        """Tests recursive folder copy"""
        dirpath = tempfile.mkdtemp()
        set_cwd(dirpath)

        Folders.copy("tests/files/sample_analysis_storage", dirpath)
        assert os.path.isfile("%s/reports/report.json" % dirpath)
开发者ID:consen,项目名称:cuckoo,代码行数:7,代码来源:test_utils.py

示例3: test_create_temp

 def test_create_temp(self):
     """Test creation of temporary directory."""
     dirpath1 = Folders.create_temp("/tmp")
     dirpath2 = Folders.create_temp("/tmp")
     assert os.path.exists(dirpath1)
     assert os.path.exists(dirpath2)
     assert dirpath1 != dirpath2
开发者ID:consen,项目名称:cuckoo,代码行数:7,代码来源:test_utils.py

示例4: test_migration_203_204

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,代码行数:29,代码来源:test_config.py

示例5: test_create_tuple

    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,代码行数:7,代码来源:test_utils.py

示例6: test_migration_201_202

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,代码行数:25,代码来源:test_config.py

示例7: create_folders

    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,代码行数:8,代码来源:resultserver.py

示例8: test_am_init_duplicate_analysis

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,代码行数:8,代码来源:test_scheduler.py

示例9: test_delete_invld

    def test_delete_invld(self):
        """Test deletion of a folder we can't access."""
        dirpath = tempfile.mkdtemp()

        os.chmod(dirpath, 0)
        with pytest.raises(CuckooOperationalError):
            Folders.delete(dirpath)

        os.chmod(dirpath, 0775)
        Folders.delete(dirpath)
开发者ID:consen,项目名称:cuckoo,代码行数:10,代码来源:test_utils.py

示例10: test_migration_200_201

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,代码行数:10,代码来源:test_config.py

示例11: test_migration_100_110

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,代码行数:10,代码来源:test_config.py

示例12: test_migration_203_204

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,代码行数:10,代码来源:test_config.py

示例13: test_migration_204_205

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,代码行数:10,代码来源:test_config.py

示例14: test_temp_conf

    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,代码行数:10,代码来源:test_utils.py

示例15: setup

    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,代码行数:11,代码来源:test_qemu.py


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