Exemple #1
0
def test_is32bit_process():
    p = Process()

    with chdir("cuckoo/data/analyzer/windows"):
        # Normally the user shouldn't be able to access the SYSTEM process.
        with pytest.raises(CuckooError) as e:
            p.is32bit(pid=4)
        e.match("process access denied$")
Exemple #2
0
def test_is32bit_process():
    p = Process()

    with chdir("cuckoo/data/analyzer/windows"):
        # Normally the user shouldn't be able to access the SYSTEM process.
        with pytest.raises(CuckooError) as e:
            p.is32bit(pid=4)
        e.match("process access denied$")
Exemple #3
0
def test_is32bit_process():
    p = Process()

    with chdir("cuckoo/data/analyzer/windows"):
        # Normally (i.e., when not Administrator) the user shouldn't be able
        # to access the lsass.exe process.
        with pytest.raises(CuckooError) as e:
            p.is32bit(process_name="lsass.exe")
        e.match("process access denied$")
Exemple #4
0
def test_is32bit_path():
    p = Process()

    mzdos0 = os.path.abspath("tests/files/mzdos0")
    icardres = os.path.abspath("tests/files/icardres.dll")

    with chdir("cuckoo/data/analyzer/windows"):
        # File not found.
        with pytest.raises(CuckooError) as e:
            p.is32bit(path="thisisnotafile")
        e.match("File not found")

        # No MZ header.
        with pytest.raises(CuckooError) as e:
            p.is32bit(path=__file__)
        e.match("returned by is32bit")
        e.match("Invalid DOS file")

        # This is a MZ-DOS executable rather than a PE file.
        assert p.is32bit(path=mzdos0) is True

        # TODO Add a 32-bit PE executable.

        # This is a 64-bit PE file.
        assert p.is32bit(path=icardres) is False
Exemple #5
0
def test_is32bit_path():
    p = Process()

    mzdos0 = os.path.abspath("tests/files/mzdos0")
    icardres = os.path.abspath("tests/files/icardres.dll")

    with chdir("cuckoo/data/analyzer/windows"):
        # File not found.
        with pytest.raises(CuckooError) as e:
            p.is32bit(path="thisisnotafile")
        e.match("File not found")

        # No MZ header.
        with pytest.raises(CuckooError) as e:
            p.is32bit(path=__file__)
        e.match("returned by is32bit")
        e.match("Invalid DOS file")

        # This is a MZ-DOS executable rather than a PE file.
        assert p.is32bit(path=mzdos0) is True

        # TODO Add a 32-bit PE executable.

        # This is a 64-bit PE file.
        assert p.is32bit(path=icardres) is False