Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IDA 7.[4-5] *.idb and *.i64 and some fix #97

Merged
merged 5 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added tests/data/v7.4/x32/kernel32.idb
Binary file not shown.
Binary file added tests/data/v7.4/x64/kernel32.i64
Binary file not shown.
Binary file added tests/data/v7.5/x32/kernel32.idb
Binary file not shown.
Binary file added tests/data/v7.5/x64/kernel32.i64
Binary file not shown.
5 changes: 5 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def rundebug(request):
750: "v7.5",
}
DefaultKern32Specs = [
(500, 32, None),
(630, 32, None),
(630, 64, None),
(640, 32, None),
Expand All @@ -132,6 +133,10 @@ def rundebug(request):
(720, 64, None),
(730, 32, None),
(730, 64, None),
(740, 32, None),
(740, 64, None),
(750, 32, None),
(750, 64, None),
]


Expand Down
2 changes: 2 additions & 0 deletions tests/test_analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
import sys

import idb.analysis
from fixtures import *
Expand Down Expand Up @@ -299,6 +300,7 @@ def test_xrefs(kernel32_idb, version, bitness, expected):
)


@pytest.mark.skipif(six.PY2, reason="it consumes too much memory")
@kern32_test()
def test_fixups(kernel32_idb, version, bitness, expected):
fixups = idb.analysis.Fixups(kernel32_idb).fixups
Expand Down
8 changes: 3 additions & 5 deletions tests/test_idaapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,19 +556,17 @@ def test_get_mnem(kernel32_idb, version, bitness, expected):

@kern32_test()
def test_functions(kernel32_idb, version, bitness, expected):
if version <= 500:
return

api = idb.IDAPython(kernel32_idb)

funcs = api.idautils.Functions()
# exact number of detected functions varies by IDA version,
# but the first and last addresses should remain constant.
assert funcs[0] == 0x68901010
assert funcs[-1] == 0x689BD410
assert funcs[-1] == 0x689BD410 if version > 500 else 0x689CD6BA

# this is a function chunk. should not be reported.
assert 0x689018E5 not in funcs
if version > 500:
assert 0x689018E5 not in funcs


@kern32_test()
Expand Down
10 changes: 5 additions & 5 deletions tests/test_netnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ def test_valobj(kernel32_idb, version, bitness, expected):
# Out[29]: 'Z:\\home\\user\\Downloads\\kernel32\\kernel32.dll\x00'
root = idb.netnode.Netnode(kernel32_idb, ROOT_NODEID)
assert root.value_exists() is True
if version > 500:
assert root.valobj().endswith(b"kernel32.dll\x00")
assert root.valstr().endswith("kernel32.dll")
else:
if version >= 740 or version == 500:
assert root.valobj().endswith(
b"ba1bc09b7bb290656582b4e4d896105caf00825b557ce45621e76741cd5dc262\x00"
)
assert root.valstr().endswith(
"ba1bc09b7bb290656582b4e4d896105caf00825b557ce45621e76741cd5dc262"
)
else:
assert root.valobj().endswith(b"kernel32.dll\x00")
assert root.valstr().endswith("kernel32.dll")


@kern32_test(
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_alts(kernel32_idb, version, bitness, expected):
uint(-1),
]
else:
alts == [
assert alts == [
uint(-5),
uint(-4),
uint(-3),
Expand Down