smallworld-re 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smallworld/__init__.py +35 -0
- smallworld/analyses/__init__.py +14 -0
- smallworld/analyses/analysis.py +88 -0
- smallworld/analyses/code_coverage.py +31 -0
- smallworld/analyses/colorizer.py +682 -0
- smallworld/analyses/colorizer_summary.py +100 -0
- smallworld/analyses/field_detection/__init__.py +14 -0
- smallworld/analyses/field_detection/field_analysis.py +536 -0
- smallworld/analyses/field_detection/guards.py +26 -0
- smallworld/analyses/field_detection/hints.py +133 -0
- smallworld/analyses/field_detection/malloc.py +211 -0
- smallworld/analyses/forced_exec/__init__.py +3 -0
- smallworld/analyses/forced_exec/forced_exec.py +87 -0
- smallworld/analyses/underlays/__init__.py +4 -0
- smallworld/analyses/underlays/basic.py +13 -0
- smallworld/analyses/underlays/underlay.py +31 -0
- smallworld/analyses/unstable/__init__.py +4 -0
- smallworld/analyses/unstable/angr/__init__.py +0 -0
- smallworld/analyses/unstable/angr/base.py +12 -0
- smallworld/analyses/unstable/angr/divergence.py +274 -0
- smallworld/analyses/unstable/angr/model.py +383 -0
- smallworld/analyses/unstable/angr/nwbt.py +63 -0
- smallworld/analyses/unstable/angr/typedefs.py +170 -0
- smallworld/analyses/unstable/angr/utils.py +25 -0
- smallworld/analyses/unstable/angr/visitor.py +315 -0
- smallworld/analyses/unstable/angr_nwbt.py +106 -0
- smallworld/analyses/unstable/code_coverage.py +54 -0
- smallworld/analyses/unstable/code_reachable.py +44 -0
- smallworld/analyses/unstable/control_flow_tracer.py +71 -0
- smallworld/analyses/unstable/pointer_finder.py +90 -0
- smallworld/arch/__init__.py +0 -0
- smallworld/arch/aarch64_arch.py +286 -0
- smallworld/arch/amd64_arch.py +86 -0
- smallworld/arch/i386_arch.py +44 -0
- smallworld/emulators/__init__.py +14 -0
- smallworld/emulators/angr/__init__.py +7 -0
- smallworld/emulators/angr/angr.py +1652 -0
- smallworld/emulators/angr/default.py +15 -0
- smallworld/emulators/angr/exceptions.py +7 -0
- smallworld/emulators/angr/exploration/__init__.py +9 -0
- smallworld/emulators/angr/exploration/bounds.py +27 -0
- smallworld/emulators/angr/exploration/default.py +17 -0
- smallworld/emulators/angr/exploration/terminate.py +22 -0
- smallworld/emulators/angr/factory.py +55 -0
- smallworld/emulators/angr/machdefs/__init__.py +35 -0
- smallworld/emulators/angr/machdefs/aarch64.py +292 -0
- smallworld/emulators/angr/machdefs/amd64.py +192 -0
- smallworld/emulators/angr/machdefs/arm.py +387 -0
- smallworld/emulators/angr/machdefs/i386.py +221 -0
- smallworld/emulators/angr/machdefs/machdef.py +138 -0
- smallworld/emulators/angr/machdefs/mips.py +184 -0
- smallworld/emulators/angr/machdefs/mips64.py +189 -0
- smallworld/emulators/angr/machdefs/ppc.py +101 -0
- smallworld/emulators/angr/machdefs/riscv.py +261 -0
- smallworld/emulators/angr/machdefs/xtensa.py +255 -0
- smallworld/emulators/angr/memory/__init__.py +7 -0
- smallworld/emulators/angr/memory/default.py +10 -0
- smallworld/emulators/angr/memory/fixups.py +43 -0
- smallworld/emulators/angr/memory/memtrack.py +105 -0
- smallworld/emulators/angr/scratch.py +43 -0
- smallworld/emulators/angr/simos.py +53 -0
- smallworld/emulators/angr/utils.py +70 -0
- smallworld/emulators/emulator.py +1013 -0
- smallworld/emulators/hookable.py +252 -0
- smallworld/emulators/panda/__init__.py +5 -0
- smallworld/emulators/panda/machdefs/__init__.py +28 -0
- smallworld/emulators/panda/machdefs/aarch64.py +93 -0
- smallworld/emulators/panda/machdefs/amd64.py +71 -0
- smallworld/emulators/panda/machdefs/arm.py +89 -0
- smallworld/emulators/panda/machdefs/i386.py +36 -0
- smallworld/emulators/panda/machdefs/machdef.py +86 -0
- smallworld/emulators/panda/machdefs/mips.py +94 -0
- smallworld/emulators/panda/machdefs/mips64.py +91 -0
- smallworld/emulators/panda/machdefs/ppc.py +79 -0
- smallworld/emulators/panda/panda.py +575 -0
- smallworld/emulators/unicorn/__init__.py +13 -0
- smallworld/emulators/unicorn/machdefs/__init__.py +28 -0
- smallworld/emulators/unicorn/machdefs/aarch64.py +310 -0
- smallworld/emulators/unicorn/machdefs/amd64.py +326 -0
- smallworld/emulators/unicorn/machdefs/arm.py +321 -0
- smallworld/emulators/unicorn/machdefs/i386.py +137 -0
- smallworld/emulators/unicorn/machdefs/machdef.py +117 -0
- smallworld/emulators/unicorn/machdefs/mips.py +202 -0
- smallworld/emulators/unicorn/unicorn.py +684 -0
- smallworld/exceptions/__init__.py +5 -0
- smallworld/exceptions/exceptions.py +85 -0
- smallworld/exceptions/unstable/__init__.py +1 -0
- smallworld/exceptions/unstable/exceptions.py +25 -0
- smallworld/extern/__init__.py +4 -0
- smallworld/extern/ctypes.py +94 -0
- smallworld/extern/unstable/__init__.py +1 -0
- smallworld/extern/unstable/ghidra.py +129 -0
- smallworld/helpers.py +107 -0
- smallworld/hinting/__init__.py +8 -0
- smallworld/hinting/hinting.py +214 -0
- smallworld/hinting/hints.py +427 -0
- smallworld/hinting/unstable/__init__.py +2 -0
- smallworld/hinting/utils.py +19 -0
- smallworld/instructions/__init__.py +18 -0
- smallworld/instructions/aarch64.py +20 -0
- smallworld/instructions/arm.py +18 -0
- smallworld/instructions/bsid.py +67 -0
- smallworld/instructions/instructions.py +258 -0
- smallworld/instructions/mips.py +21 -0
- smallworld/instructions/x86.py +100 -0
- smallworld/logging.py +90 -0
- smallworld/platforms.py +95 -0
- smallworld/py.typed +0 -0
- smallworld/state/__init__.py +6 -0
- smallworld/state/cpus/__init__.py +32 -0
- smallworld/state/cpus/aarch64.py +563 -0
- smallworld/state/cpus/amd64.py +676 -0
- smallworld/state/cpus/arm.py +630 -0
- smallworld/state/cpus/cpu.py +71 -0
- smallworld/state/cpus/i386.py +239 -0
- smallworld/state/cpus/mips.py +374 -0
- smallworld/state/cpus/mips64.py +372 -0
- smallworld/state/cpus/powerpc.py +229 -0
- smallworld/state/cpus/riscv.py +357 -0
- smallworld/state/cpus/xtensa.py +80 -0
- smallworld/state/memory/__init__.py +7 -0
- smallworld/state/memory/code.py +70 -0
- smallworld/state/memory/elf/__init__.py +3 -0
- smallworld/state/memory/elf/elf.py +564 -0
- smallworld/state/memory/elf/rela/__init__.py +32 -0
- smallworld/state/memory/elf/rela/aarch64.py +27 -0
- smallworld/state/memory/elf/rela/amd64.py +32 -0
- smallworld/state/memory/elf/rela/arm.py +51 -0
- smallworld/state/memory/elf/rela/i386.py +32 -0
- smallworld/state/memory/elf/rela/mips.py +45 -0
- smallworld/state/memory/elf/rela/ppc.py +45 -0
- smallworld/state/memory/elf/rela/rela.py +63 -0
- smallworld/state/memory/elf/rela/riscv64.py +27 -0
- smallworld/state/memory/elf/rela/xtensa.py +15 -0
- smallworld/state/memory/elf/structs.py +55 -0
- smallworld/state/memory/heap.py +85 -0
- smallworld/state/memory/memory.py +181 -0
- smallworld/state/memory/stack/__init__.py +31 -0
- smallworld/state/memory/stack/aarch64.py +22 -0
- smallworld/state/memory/stack/amd64.py +42 -0
- smallworld/state/memory/stack/arm.py +66 -0
- smallworld/state/memory/stack/i386.py +22 -0
- smallworld/state/memory/stack/mips.py +34 -0
- smallworld/state/memory/stack/mips64.py +34 -0
- smallworld/state/memory/stack/ppc.py +34 -0
- smallworld/state/memory/stack/riscv.py +22 -0
- smallworld/state/memory/stack/stack.py +127 -0
- smallworld/state/memory/stack/xtensa.py +34 -0
- smallworld/state/models/__init__.py +6 -0
- smallworld/state/models/mmio.py +186 -0
- smallworld/state/models/model.py +163 -0
- smallworld/state/models/posix.py +455 -0
- smallworld/state/models/x86/__init__.py +2 -0
- smallworld/state/models/x86/microsoftcdecl.py +35 -0
- smallworld/state/models/x86/systemv.py +240 -0
- smallworld/state/state.py +962 -0
- smallworld/state/unstable/__init__.py +0 -0
- smallworld/state/unstable/elf.py +393 -0
- smallworld/state/x86_registers.py +30 -0
- smallworld/utils.py +935 -0
- smallworld_re-1.0.0.dist-info/LICENSE.txt +21 -0
- smallworld_re-1.0.0.dist-info/METADATA +189 -0
- smallworld_re-1.0.0.dist-info/RECORD +166 -0
- smallworld_re-1.0.0.dist-info/WHEEL +5 -0
- smallworld_re-1.0.0.dist-info/entry_points.txt +2 -0
- smallworld_re-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
import capstone
|
2
|
+
|
3
|
+
from ....platforms import Architecture, Byteorder
|
4
|
+
from .machdef import PandaMachineDef
|
5
|
+
|
6
|
+
|
7
|
+
class MIPSMachineDef(PandaMachineDef):
|
8
|
+
arch = Architecture.MIPS32
|
9
|
+
cs_arch = capstone.CS_ARCH_MIPS
|
10
|
+
cpu = "M14K"
|
11
|
+
|
12
|
+
# I'm going to define all the ones we are making possible as of now
|
13
|
+
# I need to submit a PR to change to X86 32 bit and to includ eflags
|
14
|
+
def __init__(self):
|
15
|
+
self._registers = {
|
16
|
+
"at": "at",
|
17
|
+
"1": "at",
|
18
|
+
"v0": "v0",
|
19
|
+
"2": "v0",
|
20
|
+
"v1": "v1",
|
21
|
+
"3": "v1",
|
22
|
+
"a0": "a0",
|
23
|
+
"4": "a0",
|
24
|
+
"a1": "a1",
|
25
|
+
"5": "a1",
|
26
|
+
"a2": "a2",
|
27
|
+
"6": "a2",
|
28
|
+
"a3": "a3",
|
29
|
+
"7": "a3",
|
30
|
+
"t0": "t0",
|
31
|
+
"8": "t0",
|
32
|
+
"t1": "t1",
|
33
|
+
"9": "t1",
|
34
|
+
"t2": "t2",
|
35
|
+
"10": "t2",
|
36
|
+
"t3": "t3",
|
37
|
+
"11": "t3",
|
38
|
+
"t4": "t4",
|
39
|
+
"12": "t4",
|
40
|
+
"t5": "t5",
|
41
|
+
"13": "t5",
|
42
|
+
"t6": "t6",
|
43
|
+
"14": "t6",
|
44
|
+
"t7": "t7",
|
45
|
+
"15": "t7",
|
46
|
+
"t8": "t8",
|
47
|
+
"24": "t8",
|
48
|
+
"t9": "t9",
|
49
|
+
"25": "t9",
|
50
|
+
"s0": "s0",
|
51
|
+
"16": "s0",
|
52
|
+
"s1": "s1",
|
53
|
+
"17": "s1",
|
54
|
+
"s2": "s2",
|
55
|
+
"18": "s2",
|
56
|
+
"s3": "s3",
|
57
|
+
"19": "s3",
|
58
|
+
"s4": "s4",
|
59
|
+
"20": "s4",
|
60
|
+
"s5": "s5",
|
61
|
+
"21": "s5",
|
62
|
+
"s6": "s6",
|
63
|
+
"22": "s6",
|
64
|
+
"s7": "s7",
|
65
|
+
"23": "s7",
|
66
|
+
"s8": "fp",
|
67
|
+
"fp": "fp",
|
68
|
+
"30": "fp",
|
69
|
+
"k0": "k0",
|
70
|
+
"26": "k0",
|
71
|
+
"k1": "k1",
|
72
|
+
"27": "k1",
|
73
|
+
"zero": "zero",
|
74
|
+
"0": "zero",
|
75
|
+
"gp": "gp",
|
76
|
+
"28": "gp",
|
77
|
+
"sp": "sp",
|
78
|
+
"29": "sp",
|
79
|
+
"ra": "ra",
|
80
|
+
"31": "ra",
|
81
|
+
"pc": "pc",
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
class MIPSELMachineDef(MIPSMachineDef):
|
86
|
+
panda_arch = "mipsel"
|
87
|
+
byteorder = Byteorder.LITTLE
|
88
|
+
cs_mode = capstone.CS_MODE_MIPS32 | capstone.CS_MODE_LITTLE_ENDIAN
|
89
|
+
|
90
|
+
|
91
|
+
class MIPSBEMachineDef(MIPSMachineDef):
|
92
|
+
panda_arch = "mips"
|
93
|
+
byteorder = Byteorder.BIG
|
94
|
+
cs_mode = capstone.CS_MODE_MIPS32 | capstone.CS_MODE_BIG_ENDIAN
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import capstone
|
2
|
+
|
3
|
+
from ....platforms import Architecture, Byteorder
|
4
|
+
from .machdef import PandaMachineDef
|
5
|
+
|
6
|
+
|
7
|
+
class MIPS64MachineDef(PandaMachineDef):
|
8
|
+
arch = Architecture.MIPS64
|
9
|
+
cs_arch = capstone.CS_ARCH_MIPS
|
10
|
+
|
11
|
+
# We don't need this
|
12
|
+
panda_arch = "mips64"
|
13
|
+
|
14
|
+
# I'm going to define all the ones we are making possible as of now
|
15
|
+
# I need to submit a PR to change to X86 32 bit and to includ eflags
|
16
|
+
def __init__(self):
|
17
|
+
self._registers = {
|
18
|
+
"at": "at",
|
19
|
+
"1": "at",
|
20
|
+
"v0": "v0",
|
21
|
+
"2": "v0",
|
22
|
+
"v1": "v1",
|
23
|
+
"3": "v1",
|
24
|
+
"a0": "a0",
|
25
|
+
"4": "a0",
|
26
|
+
"a1": "a1",
|
27
|
+
"5": "a1",
|
28
|
+
"a2": "a2",
|
29
|
+
"6": "a2",
|
30
|
+
"a3": "a3",
|
31
|
+
"7": "a3",
|
32
|
+
"a4": "a4",
|
33
|
+
"8": "a4",
|
34
|
+
"a5": "a5",
|
35
|
+
"9": "a5",
|
36
|
+
"a6": "a6",
|
37
|
+
"10": "a6",
|
38
|
+
"a7": "a7",
|
39
|
+
"11": "a7",
|
40
|
+
"t0": "t0",
|
41
|
+
"12": "t0",
|
42
|
+
"t1": "t1",
|
43
|
+
"13": "t1",
|
44
|
+
"t2": "t2",
|
45
|
+
"14": "t2",
|
46
|
+
"t3": "t3",
|
47
|
+
"15": "t3",
|
48
|
+
"t8": "t8",
|
49
|
+
"24": "t8",
|
50
|
+
"t9": "t9",
|
51
|
+
"25": "t9",
|
52
|
+
"s0": "s0",
|
53
|
+
"16": "s0",
|
54
|
+
"s1": "s1",
|
55
|
+
"17": "s1",
|
56
|
+
"s2": "s2",
|
57
|
+
"18": "s2",
|
58
|
+
"s3": "s3",
|
59
|
+
"19": "s3",
|
60
|
+
"s4": "s4",
|
61
|
+
"20": "s4",
|
62
|
+
"s5": "s5",
|
63
|
+
"21": "s5",
|
64
|
+
"s6": "s6",
|
65
|
+
"22": "s6",
|
66
|
+
"s7": "s7",
|
67
|
+
"23": "s7",
|
68
|
+
"s8": "s8",
|
69
|
+
"fp": "s8",
|
70
|
+
"30": "s8",
|
71
|
+
"k0": "k0",
|
72
|
+
"26": "k0",
|
73
|
+
"k1": "k1",
|
74
|
+
"27": "k1",
|
75
|
+
"zero": "zero",
|
76
|
+
"0": "zero",
|
77
|
+
"gp": "gp",
|
78
|
+
"28": "gp",
|
79
|
+
"sp": "sp",
|
80
|
+
"29": "sp",
|
81
|
+
"ra": "ra",
|
82
|
+
"31": "ra",
|
83
|
+
"pc": "pc",
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
class MIPS64BEMachineDef(MIPS64MachineDef):
|
88
|
+
byteorder = Byteorder.BIG
|
89
|
+
machine = "malta"
|
90
|
+
cpu = "MIPS64R2-generic"
|
91
|
+
cs_mode = capstone.CS_MODE_MIPS64 | capstone.CS_MODE_BIG_ENDIAN
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import capstone
|
2
|
+
|
3
|
+
from ....platforms import Architecture, Byteorder
|
4
|
+
from .machdef import PandaMachineDef
|
5
|
+
|
6
|
+
|
7
|
+
class PowerPCMachineDef(PandaMachineDef):
|
8
|
+
byteorder = Byteorder.BIG
|
9
|
+
|
10
|
+
cs_arch = capstone.CS_ARCH_PPC
|
11
|
+
cs_mode = capstone.CS_MODE_32 | capstone.CS_MODE_BIG_ENDIAN
|
12
|
+
|
13
|
+
panda_arch = "ppc"
|
14
|
+
|
15
|
+
# I'm going to define all the ones we are making possible as of now
|
16
|
+
# I need to submit a PR to change to X86 32 bit and to includ eflags
|
17
|
+
_registers_identity = {
|
18
|
+
"r0",
|
19
|
+
"r2",
|
20
|
+
"r3",
|
21
|
+
"r4",
|
22
|
+
"r5",
|
23
|
+
"r6",
|
24
|
+
"r7",
|
25
|
+
"r8",
|
26
|
+
"r9",
|
27
|
+
"r10",
|
28
|
+
"r11",
|
29
|
+
"r12",
|
30
|
+
"r13",
|
31
|
+
"r14",
|
32
|
+
"r15",
|
33
|
+
"r16",
|
34
|
+
"r17",
|
35
|
+
"r18",
|
36
|
+
"r19",
|
37
|
+
"r20",
|
38
|
+
"r21",
|
39
|
+
"r22",
|
40
|
+
"r23",
|
41
|
+
"r24",
|
42
|
+
"r25",
|
43
|
+
"r26",
|
44
|
+
"r27",
|
45
|
+
"r28",
|
46
|
+
"r29",
|
47
|
+
"r30",
|
48
|
+
"r31",
|
49
|
+
"cr0",
|
50
|
+
"cr1",
|
51
|
+
"cr2",
|
52
|
+
"cr3",
|
53
|
+
"cr4",
|
54
|
+
"cr5",
|
55
|
+
"cr6",
|
56
|
+
"cr7",
|
57
|
+
"pc",
|
58
|
+
"sp",
|
59
|
+
"lr",
|
60
|
+
"ctr",
|
61
|
+
}
|
62
|
+
_registers_mapping = {
|
63
|
+
"r1": "sp",
|
64
|
+
}
|
65
|
+
_registers = {i: j for i, j in _registers_mapping.items()}
|
66
|
+
_registers = _registers | {i: i for i in _registers_identity}
|
67
|
+
|
68
|
+
|
69
|
+
class PowerPC32MachineDef(PowerPCMachineDef):
|
70
|
+
arch = Architecture.POWERPC32
|
71
|
+
cs_mode = capstone.CS_MODE_32 | capstone.CS_MODE_BIG_ENDIAN
|
72
|
+
cpu = "ppc32"
|
73
|
+
|
74
|
+
|
75
|
+
# TODO: Do we have a panda PPC 64 bit cpu?
|
76
|
+
class PowerPC64MachineDef(PowerPCMachineDef):
|
77
|
+
arch = Architecture.POWERPC64
|
78
|
+
cs_mode = capstone.CS_MODE_64 | capstone.CS_MODE_BIG_ENDIAN
|
79
|
+
# cpu = "970"
|