Пример #1
0
def test_identify():
    assert identify(File(b"tests/files/script.js")) == "js"
    assert identify(File(b"tests/files/script.wsf")) == "wsf"
    assert identify(File(b"tests/files/script.vbs")) == "vbs"
    assert identify(File(b"tests/files/script.ps1")) == "ps1"
    f = unpack(contents=open("tests/files/sample.jar", "rb").read())
    assert f.package == "jar"
    f = unpack(contents=open("tests/files/sample.apk", "rb").read())
    assert f.package == "apk"
    assert identify(File(b"tests/files/maldoc_office.htm")) == "doc"
    assert identify(File(b"tests/files/maldoc.xls")) == "xls"
    assert identify(File(b"tests/files/test.hta_")) == "hta"
Пример #2
0
def ident(f):
    """Identifies a file based on its contents."""
    package = identify(f)

    if package:
        f.preview = False
        f.package = package

        # Deselect the direct children.
        for child in f.children:
            child.selected = False
        return

    # Recursively enumerate further.
    for child in f.children:
        ident(child)
Пример #3
0
def test_shellcode64_plain():
    t = unpack(f(b"shellcode.zip"))
    assert identify(t.children[0]) == "Shellcode_x64"