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.
Files changed (166) hide show
  1. smallworld/__init__.py +35 -0
  2. smallworld/analyses/__init__.py +14 -0
  3. smallworld/analyses/analysis.py +88 -0
  4. smallworld/analyses/code_coverage.py +31 -0
  5. smallworld/analyses/colorizer.py +682 -0
  6. smallworld/analyses/colorizer_summary.py +100 -0
  7. smallworld/analyses/field_detection/__init__.py +14 -0
  8. smallworld/analyses/field_detection/field_analysis.py +536 -0
  9. smallworld/analyses/field_detection/guards.py +26 -0
  10. smallworld/analyses/field_detection/hints.py +133 -0
  11. smallworld/analyses/field_detection/malloc.py +211 -0
  12. smallworld/analyses/forced_exec/__init__.py +3 -0
  13. smallworld/analyses/forced_exec/forced_exec.py +87 -0
  14. smallworld/analyses/underlays/__init__.py +4 -0
  15. smallworld/analyses/underlays/basic.py +13 -0
  16. smallworld/analyses/underlays/underlay.py +31 -0
  17. smallworld/analyses/unstable/__init__.py +4 -0
  18. smallworld/analyses/unstable/angr/__init__.py +0 -0
  19. smallworld/analyses/unstable/angr/base.py +12 -0
  20. smallworld/analyses/unstable/angr/divergence.py +274 -0
  21. smallworld/analyses/unstable/angr/model.py +383 -0
  22. smallworld/analyses/unstable/angr/nwbt.py +63 -0
  23. smallworld/analyses/unstable/angr/typedefs.py +170 -0
  24. smallworld/analyses/unstable/angr/utils.py +25 -0
  25. smallworld/analyses/unstable/angr/visitor.py +315 -0
  26. smallworld/analyses/unstable/angr_nwbt.py +106 -0
  27. smallworld/analyses/unstable/code_coverage.py +54 -0
  28. smallworld/analyses/unstable/code_reachable.py +44 -0
  29. smallworld/analyses/unstable/control_flow_tracer.py +71 -0
  30. smallworld/analyses/unstable/pointer_finder.py +90 -0
  31. smallworld/arch/__init__.py +0 -0
  32. smallworld/arch/aarch64_arch.py +286 -0
  33. smallworld/arch/amd64_arch.py +86 -0
  34. smallworld/arch/i386_arch.py +44 -0
  35. smallworld/emulators/__init__.py +14 -0
  36. smallworld/emulators/angr/__init__.py +7 -0
  37. smallworld/emulators/angr/angr.py +1652 -0
  38. smallworld/emulators/angr/default.py +15 -0
  39. smallworld/emulators/angr/exceptions.py +7 -0
  40. smallworld/emulators/angr/exploration/__init__.py +9 -0
  41. smallworld/emulators/angr/exploration/bounds.py +27 -0
  42. smallworld/emulators/angr/exploration/default.py +17 -0
  43. smallworld/emulators/angr/exploration/terminate.py +22 -0
  44. smallworld/emulators/angr/factory.py +55 -0
  45. smallworld/emulators/angr/machdefs/__init__.py +35 -0
  46. smallworld/emulators/angr/machdefs/aarch64.py +292 -0
  47. smallworld/emulators/angr/machdefs/amd64.py +192 -0
  48. smallworld/emulators/angr/machdefs/arm.py +387 -0
  49. smallworld/emulators/angr/machdefs/i386.py +221 -0
  50. smallworld/emulators/angr/machdefs/machdef.py +138 -0
  51. smallworld/emulators/angr/machdefs/mips.py +184 -0
  52. smallworld/emulators/angr/machdefs/mips64.py +189 -0
  53. smallworld/emulators/angr/machdefs/ppc.py +101 -0
  54. smallworld/emulators/angr/machdefs/riscv.py +261 -0
  55. smallworld/emulators/angr/machdefs/xtensa.py +255 -0
  56. smallworld/emulators/angr/memory/__init__.py +7 -0
  57. smallworld/emulators/angr/memory/default.py +10 -0
  58. smallworld/emulators/angr/memory/fixups.py +43 -0
  59. smallworld/emulators/angr/memory/memtrack.py +105 -0
  60. smallworld/emulators/angr/scratch.py +43 -0
  61. smallworld/emulators/angr/simos.py +53 -0
  62. smallworld/emulators/angr/utils.py +70 -0
  63. smallworld/emulators/emulator.py +1013 -0
  64. smallworld/emulators/hookable.py +252 -0
  65. smallworld/emulators/panda/__init__.py +5 -0
  66. smallworld/emulators/panda/machdefs/__init__.py +28 -0
  67. smallworld/emulators/panda/machdefs/aarch64.py +93 -0
  68. smallworld/emulators/panda/machdefs/amd64.py +71 -0
  69. smallworld/emulators/panda/machdefs/arm.py +89 -0
  70. smallworld/emulators/panda/machdefs/i386.py +36 -0
  71. smallworld/emulators/panda/machdefs/machdef.py +86 -0
  72. smallworld/emulators/panda/machdefs/mips.py +94 -0
  73. smallworld/emulators/panda/machdefs/mips64.py +91 -0
  74. smallworld/emulators/panda/machdefs/ppc.py +79 -0
  75. smallworld/emulators/panda/panda.py +575 -0
  76. smallworld/emulators/unicorn/__init__.py +13 -0
  77. smallworld/emulators/unicorn/machdefs/__init__.py +28 -0
  78. smallworld/emulators/unicorn/machdefs/aarch64.py +310 -0
  79. smallworld/emulators/unicorn/machdefs/amd64.py +326 -0
  80. smallworld/emulators/unicorn/machdefs/arm.py +321 -0
  81. smallworld/emulators/unicorn/machdefs/i386.py +137 -0
  82. smallworld/emulators/unicorn/machdefs/machdef.py +117 -0
  83. smallworld/emulators/unicorn/machdefs/mips.py +202 -0
  84. smallworld/emulators/unicorn/unicorn.py +684 -0
  85. smallworld/exceptions/__init__.py +5 -0
  86. smallworld/exceptions/exceptions.py +85 -0
  87. smallworld/exceptions/unstable/__init__.py +1 -0
  88. smallworld/exceptions/unstable/exceptions.py +25 -0
  89. smallworld/extern/__init__.py +4 -0
  90. smallworld/extern/ctypes.py +94 -0
  91. smallworld/extern/unstable/__init__.py +1 -0
  92. smallworld/extern/unstable/ghidra.py +129 -0
  93. smallworld/helpers.py +107 -0
  94. smallworld/hinting/__init__.py +8 -0
  95. smallworld/hinting/hinting.py +214 -0
  96. smallworld/hinting/hints.py +427 -0
  97. smallworld/hinting/unstable/__init__.py +2 -0
  98. smallworld/hinting/utils.py +19 -0
  99. smallworld/instructions/__init__.py +18 -0
  100. smallworld/instructions/aarch64.py +20 -0
  101. smallworld/instructions/arm.py +18 -0
  102. smallworld/instructions/bsid.py +67 -0
  103. smallworld/instructions/instructions.py +258 -0
  104. smallworld/instructions/mips.py +21 -0
  105. smallworld/instructions/x86.py +100 -0
  106. smallworld/logging.py +90 -0
  107. smallworld/platforms.py +95 -0
  108. smallworld/py.typed +0 -0
  109. smallworld/state/__init__.py +6 -0
  110. smallworld/state/cpus/__init__.py +32 -0
  111. smallworld/state/cpus/aarch64.py +563 -0
  112. smallworld/state/cpus/amd64.py +676 -0
  113. smallworld/state/cpus/arm.py +630 -0
  114. smallworld/state/cpus/cpu.py +71 -0
  115. smallworld/state/cpus/i386.py +239 -0
  116. smallworld/state/cpus/mips.py +374 -0
  117. smallworld/state/cpus/mips64.py +372 -0
  118. smallworld/state/cpus/powerpc.py +229 -0
  119. smallworld/state/cpus/riscv.py +357 -0
  120. smallworld/state/cpus/xtensa.py +80 -0
  121. smallworld/state/memory/__init__.py +7 -0
  122. smallworld/state/memory/code.py +70 -0
  123. smallworld/state/memory/elf/__init__.py +3 -0
  124. smallworld/state/memory/elf/elf.py +564 -0
  125. smallworld/state/memory/elf/rela/__init__.py +32 -0
  126. smallworld/state/memory/elf/rela/aarch64.py +27 -0
  127. smallworld/state/memory/elf/rela/amd64.py +32 -0
  128. smallworld/state/memory/elf/rela/arm.py +51 -0
  129. smallworld/state/memory/elf/rela/i386.py +32 -0
  130. smallworld/state/memory/elf/rela/mips.py +45 -0
  131. smallworld/state/memory/elf/rela/ppc.py +45 -0
  132. smallworld/state/memory/elf/rela/rela.py +63 -0
  133. smallworld/state/memory/elf/rela/riscv64.py +27 -0
  134. smallworld/state/memory/elf/rela/xtensa.py +15 -0
  135. smallworld/state/memory/elf/structs.py +55 -0
  136. smallworld/state/memory/heap.py +85 -0
  137. smallworld/state/memory/memory.py +181 -0
  138. smallworld/state/memory/stack/__init__.py +31 -0
  139. smallworld/state/memory/stack/aarch64.py +22 -0
  140. smallworld/state/memory/stack/amd64.py +42 -0
  141. smallworld/state/memory/stack/arm.py +66 -0
  142. smallworld/state/memory/stack/i386.py +22 -0
  143. smallworld/state/memory/stack/mips.py +34 -0
  144. smallworld/state/memory/stack/mips64.py +34 -0
  145. smallworld/state/memory/stack/ppc.py +34 -0
  146. smallworld/state/memory/stack/riscv.py +22 -0
  147. smallworld/state/memory/stack/stack.py +127 -0
  148. smallworld/state/memory/stack/xtensa.py +34 -0
  149. smallworld/state/models/__init__.py +6 -0
  150. smallworld/state/models/mmio.py +186 -0
  151. smallworld/state/models/model.py +163 -0
  152. smallworld/state/models/posix.py +455 -0
  153. smallworld/state/models/x86/__init__.py +2 -0
  154. smallworld/state/models/x86/microsoftcdecl.py +35 -0
  155. smallworld/state/models/x86/systemv.py +240 -0
  156. smallworld/state/state.py +962 -0
  157. smallworld/state/unstable/__init__.py +0 -0
  158. smallworld/state/unstable/elf.py +393 -0
  159. smallworld/state/x86_registers.py +30 -0
  160. smallworld/utils.py +935 -0
  161. smallworld_re-1.0.0.dist-info/LICENSE.txt +21 -0
  162. smallworld_re-1.0.0.dist-info/METADATA +189 -0
  163. smallworld_re-1.0.0.dist-info/RECORD +166 -0
  164. smallworld_re-1.0.0.dist-info/WHEEL +5 -0
  165. smallworld_re-1.0.0.dist-info/entry_points.txt +2 -0
  166. smallworld_re-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,240 @@
1
+ from .... import platforms
2
+ from ..model import Model
3
+ from ..posix import (
4
+ BasenameModel,
5
+ CallocModel,
6
+ DaemonModel,
7
+ FlockModel,
8
+ Getopt_longModel,
9
+ GetpagesizeModel,
10
+ GetppidModel,
11
+ GetsModel,
12
+ MallocModel,
13
+ Open64Model,
14
+ OpenModel,
15
+ PthreadCondInitModel,
16
+ PthreadCondSignalModel,
17
+ PthreadCondWaitModel,
18
+ PthreadCreateModel,
19
+ PthreadMutexInitModel,
20
+ PthreadMutexLockModel,
21
+ PthreadMutexUnlockModel,
22
+ PtraceModel,
23
+ PutsModel,
24
+ RandModel,
25
+ RandomModel,
26
+ SleepModel,
27
+ SrandModel,
28
+ SrandomModel,
29
+ StrcatModel,
30
+ StrcpyModel,
31
+ StrdupModel,
32
+ StrlenModel,
33
+ StrncatModel,
34
+ StrncpyModel,
35
+ StrnlenModel,
36
+ SysconfModel,
37
+ TimeModel,
38
+ UnlinkModel,
39
+ WriteModel,
40
+ )
41
+
42
+
43
+ class AMD64SystemVModel(Model):
44
+ platform = platforms.Platform(
45
+ platforms.Architecture.X86_64, platforms.Byteorder.LITTLE
46
+ )
47
+
48
+ abi = platforms.ABI.SYSTEMV
49
+
50
+ argument1 = "rdi"
51
+ argument2 = "rsi"
52
+ argument3 = "rdx"
53
+ argument4 = "rcx"
54
+ argument5 = "r8"
55
+ argument6 = "r9"
56
+ return_val = "rax"
57
+
58
+
59
+ class AMD64SystemVBasenameModel(AMD64SystemVModel, BasenameModel):
60
+ pass
61
+
62
+
63
+ class AMD64SystemVCallocModel(AMD64SystemVModel, CallocModel):
64
+ pass
65
+
66
+
67
+ class AMD64SystemVDaemonModel(AMD64SystemVModel, DaemonModel):
68
+ pass
69
+
70
+
71
+ class AMD64SystemVFlockModel(AMD64SystemVModel, FlockModel):
72
+ pass
73
+
74
+
75
+ class AMD64SystemVGetopt_longModel(AMD64SystemVModel, Getopt_longModel):
76
+ pass
77
+
78
+
79
+ class AMD64SystemVGetpagesizeModel(AMD64SystemVModel, GetpagesizeModel):
80
+ pass
81
+
82
+
83
+ class AMD64SystemVGetppidModel(AMD64SystemVModel, GetppidModel):
84
+ pass
85
+
86
+
87
+ class AMD64SystemVGetsModel(AMD64SystemVModel, GetsModel):
88
+ pass
89
+
90
+
91
+ class AMD64SystemVMallocModel(AMD64SystemVModel, MallocModel):
92
+ pass
93
+
94
+
95
+ class AMD64SystemVOpenModel(AMD64SystemVModel, OpenModel):
96
+ pass
97
+
98
+
99
+ class AMD64SystemVOpen64Model(AMD64SystemVModel, Open64Model):
100
+ pass
101
+
102
+
103
+ class AMD64SystemVPutsModel(AMD64SystemVModel, PutsModel):
104
+ pass
105
+
106
+
107
+ class AMD64SystemVPthreadCondInitModel(AMD64SystemVModel, PthreadCondInitModel):
108
+ pass
109
+
110
+
111
+ class AMD64SystemVPthreadCondSignalModel(AMD64SystemVModel, PthreadCondSignalModel):
112
+ pass
113
+
114
+
115
+ class AMD64SystemVPthreadCondWaitModel(AMD64SystemVModel, PthreadCondWaitModel):
116
+ pass
117
+
118
+
119
+ class AMD64SystemVPthreadCreateModel(AMD64SystemVModel, PthreadCreateModel):
120
+ pass
121
+
122
+
123
+ class AMD64SystemVPthreadMutexInitModel(AMD64SystemVModel, PthreadMutexInitModel):
124
+ pass
125
+
126
+
127
+ class AMD64SystemVPthreadMutexLockModel(AMD64SystemVModel, PthreadMutexLockModel):
128
+ pass
129
+
130
+
131
+ class AMD64SystemVPthreadMutexUnlockModel(AMD64SystemVModel, PthreadMutexUnlockModel):
132
+ pass
133
+
134
+
135
+ class AMD64SystemVPtraceModel(AMD64SystemVModel, PtraceModel):
136
+ pass
137
+
138
+
139
+ class AMD64SystemVRandModel(AMD64SystemVModel, RandModel):
140
+ pass
141
+
142
+
143
+ class AMD64SystemVRandomModel(AMD64SystemVModel, RandomModel):
144
+ pass
145
+
146
+
147
+ class AMD64SystemVSleepModel(AMD64SystemVModel, SleepModel):
148
+ pass
149
+
150
+
151
+ class AMD64SystemVSrandModel(AMD64SystemVModel, SrandModel):
152
+ pass
153
+
154
+
155
+ class AMD64SystemVSrandomModel(AMD64SystemVModel, SrandomModel):
156
+ pass
157
+
158
+
159
+ class AMD64SystemVStrcatModel(AMD64SystemVModel, StrcatModel):
160
+ pass
161
+
162
+
163
+ class AMD64SystemVStrncatModel(AMD64SystemVModel, StrncatModel):
164
+ pass
165
+
166
+
167
+ class AMD64SystemVStrcpyModel(AMD64SystemVModel, StrcpyModel):
168
+ pass
169
+
170
+
171
+ class AMD64SystemVStrncpyModel(AMD64SystemVModel, StrncpyModel):
172
+ pass
173
+
174
+
175
+ class AMD64SystemVStrdupModel(AMD64SystemVModel, StrdupModel):
176
+ pass
177
+
178
+
179
+ class AMD64SystemVStrlenModel(AMD64SystemVModel, StrlenModel):
180
+ pass
181
+
182
+
183
+ class AMD64SystemVStrnlenModel(AMD64SystemVModel, StrnlenModel):
184
+ pass
185
+
186
+
187
+ class AMD64SystemVSysconfModel(AMD64SystemVModel, SysconfModel):
188
+ pass
189
+
190
+
191
+ class AMD64SystemVTimeModel(AMD64SystemVModel, TimeModel):
192
+ pass
193
+
194
+
195
+ class AMD64SystemVUnlinkModel(AMD64SystemVModel, UnlinkModel):
196
+ pass
197
+
198
+
199
+ class AMD64SystemVWriteModel(AMD64SystemVModel, WriteModel):
200
+ pass
201
+
202
+
203
+ __all__ = [
204
+ "AMD64SystemVBasenameModel",
205
+ "AMD64SystemVCallocModel",
206
+ "AMD64SystemVDaemonModel",
207
+ "AMD64SystemVFlockModel",
208
+ "AMD64SystemVGetopt_longModel",
209
+ "AMD64SystemVGetpagesizeModel",
210
+ "AMD64SystemVGetppidModel",
211
+ "AMD64SystemVGetsModel",
212
+ "AMD64SystemVMallocModel",
213
+ "AMD64SystemVOpenModel",
214
+ "AMD64SystemVOpen64Model",
215
+ "AMD64SystemVPutsModel",
216
+ "AMD64SystemVPthreadCondInitModel",
217
+ "AMD64SystemVPthreadCondSignalModel",
218
+ "AMD64SystemVPthreadCondWaitModel",
219
+ "AMD64SystemVPthreadCreateModel",
220
+ "AMD64SystemVPthreadMutexInitModel",
221
+ "AMD64SystemVPthreadMutexLockModel",
222
+ "AMD64SystemVPthreadMutexUnlockModel",
223
+ "AMD64SystemVPtraceModel",
224
+ "AMD64SystemVRandModel",
225
+ "AMD64SystemVRandomModel",
226
+ "AMD64SystemVSleepModel",
227
+ "AMD64SystemVSrandModel",
228
+ "AMD64SystemVSrandomModel",
229
+ "AMD64SystemVStrcatModel",
230
+ "AMD64SystemVStrncatModel",
231
+ "AMD64SystemVStrcpyModel",
232
+ "AMD64SystemVStrncpyModel",
233
+ "AMD64SystemVStrdupModel",
234
+ "AMD64SystemVStrlenModel",
235
+ "AMD64SystemVStrnlenModel",
236
+ "AMD64SystemVSysconfModel",
237
+ "AMD64SystemVTimeModel",
238
+ "AMD64SystemVUnlinkModel",
239
+ "AMD64SystemVWriteModel",
240
+ ]