lief 0.17.3__cp38-cp38-musllinux_1_2_x86_64.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.
@@ -0,0 +1,32 @@
1
+ from typing import Iterator, Optional, Union
2
+
3
+ import lief.assembly.x86
4
+
5
+
6
+ class Immediate(lief.assembly.x86.Operand):
7
+ @property
8
+ def value(self) -> int: ...
9
+
10
+ class Register(lief.assembly.x86.Operand):
11
+ @property
12
+ def value(self) -> lief.assembly.x86.REG: ...
13
+
14
+ class Memory(lief.assembly.x86.Operand):
15
+ @property
16
+ def base(self) -> lief.assembly.x86.REG: ...
17
+
18
+ @property
19
+ def scaled_register(self) -> lief.assembly.x86.REG: ...
20
+
21
+ @property
22
+ def segment_register(self) -> lief.assembly.x86.REG: ...
23
+
24
+ @property
25
+ def scale(self) -> int: ...
26
+
27
+ @property
28
+ def displacement(self) -> int: ...
29
+
30
+ class PCRelative(lief.assembly.x86.Operand):
31
+ @property
32
+ def value(self) -> int: ...
lief/dsc/__init__.pyi ADDED
@@ -0,0 +1,226 @@
1
+ from collections.abc import Sequence
2
+ import enum
3
+ import os
4
+ from typing import Iterator, Optional, Union, overload
5
+
6
+ import lief
7
+ import lief.MachO
8
+ import lief.assembly
9
+
10
+
11
+ @overload
12
+ def enable_cache() -> bool: ...
13
+
14
+ @overload
15
+ def enable_cache(target_cache_dir: Union[str | os.PathLike]) -> bool: ...
16
+
17
+ class DyldSharedCache:
18
+ class VERSION(enum.Enum):
19
+ UNKNOWN = 0
20
+
21
+ DYLD_95_3 = 1
22
+
23
+ DYLD_195_5 = 2
24
+
25
+ DYLD_239_3 = 3
26
+
27
+ DYLD_360_14 = 4
28
+
29
+ DYLD_421_1 = 5
30
+
31
+ DYLD_832_7_1 = 6
32
+
33
+ DYLD_940 = 7
34
+
35
+ DYLD_1042_1 = 8
36
+
37
+ DYLD_1231_3 = 9
38
+
39
+ DYLD_1284_13 = 10
40
+
41
+ UNRELEASED = 11
42
+
43
+ class PLATFORM(enum.Enum):
44
+ UNKNOWN = 0
45
+
46
+ MACOS = 1
47
+
48
+ IOS = 2
49
+
50
+ TVOS = 3
51
+
52
+ WATCHOS = 4
53
+
54
+ BRIDGEOS = 5
55
+
56
+ IOSMAC = 6
57
+
58
+ IOS_SIMULATOR = 7
59
+
60
+ TVOS_SIMULATOR = 8
61
+
62
+ WATCHOS_SIMULATOR = 9
63
+
64
+ DRIVERKIT = 10
65
+
66
+ VISIONOS = 11
67
+
68
+ VISIONOS_SIMULATOR = 12
69
+
70
+ FIRMWARE = 13
71
+
72
+ SEPOS = 14
73
+
74
+ ANY = 4294967295
75
+
76
+ class ARCH(enum.Enum):
77
+ UNKNOWN = 0
78
+
79
+ I386 = 1
80
+
81
+ X86_64 = 2
82
+
83
+ X86_64H = 3
84
+
85
+ ARMV5 = 4
86
+
87
+ ARMV6 = 5
88
+
89
+ ARMV7 = 6
90
+
91
+ ARM64 = 7
92
+
93
+ ARM64E = 8
94
+
95
+ @staticmethod
96
+ def from_path(path: str, arch: str = '') -> Optional[DyldSharedCache]: ...
97
+
98
+ @staticmethod
99
+ def from_files(files: Sequence[str]) -> Optional[DyldSharedCache]: ...
100
+
101
+ @property
102
+ def filename(self) -> str: ...
103
+
104
+ @property
105
+ def version(self) -> DyldSharedCache.VERSION: ...
106
+
107
+ @property
108
+ def filepath(self) -> str: ...
109
+
110
+ @property
111
+ def load_address(self) -> int: ...
112
+
113
+ @property
114
+ def arch_name(self) -> str: ...
115
+
116
+ @property
117
+ def platform(self) -> DyldSharedCache.PLATFORM: ...
118
+
119
+ @property
120
+ def arch(self) -> DyldSharedCache.ARCH: ...
121
+
122
+ @property
123
+ def has_subcaches(self) -> bool: ...
124
+
125
+ def find_lib_from_va(self, virtual_address: int) -> Optional[Dylib]: ...
126
+
127
+ def find_lib_from_path(self, path: str) -> Optional[Dylib]: ...
128
+
129
+ def find_lib_from_name(self, name: str) -> Optional[Dylib]: ...
130
+
131
+ @property
132
+ def libraries(self) -> Sequence[Optional[Dylib]]: ...
133
+
134
+ @property
135
+ def mapping_info(self) -> Sequence[Optional[MappingInfo]]: ...
136
+
137
+ @property
138
+ def subcaches(self) -> Sequence[Optional[SubCache]]: ...
139
+
140
+ def get_content_from_va(self, addr: int, size: int) -> bytes: ...
141
+
142
+ def cache_for_address(self, address: int) -> Optional[DyldSharedCache]: ...
143
+
144
+ @property
145
+ def main_cache(self) -> Optional[DyldSharedCache]: ...
146
+
147
+ def find_subcache(self, filename: str) -> Optional[DyldSharedCache]: ...
148
+
149
+ def va_to_offset(self, virtual_address: int) -> Union[int, lief.lief_errors]: ...
150
+
151
+ def disassemble(self, arg: int, /) -> Iterator[Optional[lief.assembly.Instruction]]: ...
152
+
153
+ def enable_caching(self, target_dir: str) -> None: ...
154
+
155
+ def flush_cache(self) -> None: ...
156
+
157
+ @overload
158
+ def load(files: Sequence[str]) -> Optional[DyldSharedCache]: ...
159
+
160
+ @overload
161
+ def load(path: Union[str | os.PathLike], arch: str = '') -> Optional[DyldSharedCache]: ...
162
+
163
+ class Dylib:
164
+ class extract_opt_t:
165
+ def __init__(self) -> None: ...
166
+
167
+ pack: bool
168
+
169
+ fix_branches: bool
170
+
171
+ fix_memory: bool
172
+
173
+ fix_relocations: bool
174
+
175
+ fix_objc: bool
176
+
177
+ create_dyld_chained_fixup_cmd: bool
178
+
179
+ @property
180
+ def path(self) -> str: ...
181
+
182
+ @property
183
+ def address(self) -> int: ...
184
+
185
+ @property
186
+ def modtime(self) -> int: ...
187
+
188
+ @property
189
+ def inode(self) -> int: ...
190
+
191
+ @property
192
+ def padding(self) -> int: ...
193
+
194
+ def get(self, opt: Dylib.extract_opt_t = ...) -> Optional[lief.MachO.Binary]: ...
195
+
196
+ class SubCache:
197
+ @property
198
+ def uuid(self) -> list[int]: ...
199
+
200
+ @property
201
+ def vm_offset(self) -> int: ...
202
+
203
+ @property
204
+ def suffix(self) -> str: ...
205
+
206
+ @property
207
+ def cache(self) -> Optional[DyldSharedCache]: ...
208
+
209
+ class MappingInfo:
210
+ @property
211
+ def address(self) -> int: ...
212
+
213
+ @property
214
+ def size(self) -> int: ...
215
+
216
+ @property
217
+ def end_address(self) -> int: ...
218
+
219
+ @property
220
+ def file_offset(self) -> int: ...
221
+
222
+ @property
223
+ def max_prot(self) -> int: ...
224
+
225
+ @property
226
+ def init_prot(self) -> int: ...
@@ -0,0 +1,306 @@
1
+ import enum
2
+ import os
3
+ from typing import Iterator, Optional, Union, overload
4
+
5
+ from . import (
6
+ editor as editor,
7
+ parameters as parameters,
8
+ types as types
9
+ )
10
+ import lief
11
+ import lief.assembly
12
+
13
+
14
+ def load(path: Union[str | os.PathLike]) -> Optional[DebugInfo]: ...
15
+
16
+ class Scope:
17
+ class TYPE(enum.Enum):
18
+ UNKNOWN = 0
19
+
20
+ UNION = 1
21
+
22
+ CLASS = 2
23
+
24
+ STRUCT = 3
25
+
26
+ NAMESPACE = 4
27
+
28
+ FUNCTION = 5
29
+
30
+ COMPILATION_UNIT = 6
31
+
32
+ @property
33
+ def name(self) -> str: ...
34
+
35
+ @property
36
+ def parent(self) -> Optional[Scope]: ...
37
+
38
+ @property
39
+ def type(self) -> Scope.TYPE: ...
40
+
41
+ def chained(self, sep: str = '::') -> str: ...
42
+
43
+ class Type:
44
+ class KIND(enum.Enum):
45
+ UNKNOWN = 0
46
+
47
+ UNSPECIFIED = 1
48
+
49
+ BASE = 2
50
+
51
+ CONST_KIND = 3
52
+
53
+ CLASS = 4
54
+
55
+ ARRAY = 5
56
+
57
+ POINTER = 6
58
+
59
+ STRUCT = 7
60
+
61
+ UNION = 8
62
+
63
+ TYPEDEF = 9
64
+
65
+ REF = 10
66
+
67
+ SET_TYPE = 11
68
+
69
+ STRING = 12
70
+
71
+ SUBROUTINE = 13
72
+
73
+ POINTER_MEMBER = 14
74
+
75
+ PACKED = 15
76
+
77
+ FILE = 16
78
+
79
+ THROWN = 17
80
+
81
+ VOLATILE = 18
82
+
83
+ RESTRICT = 19
84
+
85
+ INTERFACE = 20
86
+
87
+ SHARED = 21
88
+
89
+ RVALREF = 22
90
+
91
+ TEMPLATE_ALIAS = 23
92
+
93
+ COARRAY = 24
94
+
95
+ DYNAMIC = 25
96
+
97
+ ATOMIC = 26
98
+
99
+ IMMUTABLE = 27
100
+
101
+ ENUM = 28
102
+
103
+ @property
104
+ def kind(self) -> Type.KIND: ...
105
+
106
+ @property
107
+ def name(self) -> Optional[str]: ...
108
+
109
+ @property
110
+ def size(self) -> Optional[int]: ...
111
+
112
+ @property
113
+ def location(self) -> lief.debug_location_t: ...
114
+
115
+ @property
116
+ def is_unspecified(self) -> bool: ...
117
+
118
+ @property
119
+ def scope(self) -> Optional[Scope]: ...
120
+
121
+ class Variable:
122
+ @property
123
+ def name(self) -> str: ...
124
+
125
+ @property
126
+ def linkage_name(self) -> str: ...
127
+
128
+ @property
129
+ def address(self) -> Optional[int]: ...
130
+
131
+ @property
132
+ def size(self) -> Optional[int]: ...
133
+
134
+ @property
135
+ def is_constexpr(self) -> bool: ...
136
+
137
+ @property
138
+ def debug_location(self) -> lief.debug_location_t: ...
139
+
140
+ @property
141
+ def type(self) -> Optional[Type]: ...
142
+
143
+ @property
144
+ def scope(self) -> Optional[Scope]: ...
145
+
146
+ class Function:
147
+ @property
148
+ def name(self) -> str: ...
149
+
150
+ @property
151
+ def linkage_name(self) -> str: ...
152
+
153
+ @property
154
+ def address(self) -> Optional[int]: ...
155
+
156
+ @property
157
+ def variables(self) -> Iterator[Optional[Variable]]: ...
158
+
159
+ @property
160
+ def is_artificial(self) -> bool: ...
161
+
162
+ @property
163
+ def is_external(self) -> bool: ...
164
+
165
+ @property
166
+ def size(self) -> int: ...
167
+
168
+ @property
169
+ def ranges(self) -> list[lief.range_t]: ...
170
+
171
+ @property
172
+ def debug_location(self) -> lief.debug_location_t: ...
173
+
174
+ @property
175
+ def type(self) -> Optional[Type]: ...
176
+
177
+ @property
178
+ def parameters(self) -> list[Optional[Parameter]]: ...
179
+
180
+ @property
181
+ def thrown_types(self) -> list[Optional[Type]]: ...
182
+
183
+ @property
184
+ def scope(self) -> Optional[Scope]: ...
185
+
186
+ @property
187
+ def instructions(self) -> Iterator[Optional[lief.assembly.Instruction]]: ...
188
+
189
+ class Parameter:
190
+ @property
191
+ def name(self) -> str: ...
192
+
193
+ @property
194
+ def type(self) -> Optional[Type]: ...
195
+
196
+ class CompilationUnit:
197
+ class Language:
198
+ class LANG(enum.Enum):
199
+ @staticmethod
200
+ def from_value(arg: int, /) -> CompilationUnit.Language.LANG: ...
201
+
202
+ def __eq__(self, arg, /) -> bool: ...
203
+
204
+ def __ne__(self, arg, /) -> bool: ...
205
+
206
+ def __int__(self) -> int: ...
207
+
208
+ UNKNOWN = 0
209
+
210
+ C = 1
211
+
212
+ CPP = 2
213
+
214
+ RUST = 3
215
+
216
+ DART = 4
217
+
218
+ MODULA = 5
219
+
220
+ FORTRAN = 6
221
+
222
+ SWIFT = 7
223
+
224
+ D = 8
225
+
226
+ JAVA = 9
227
+
228
+ COBOL = 10
229
+
230
+ lang: CompilationUnit.Language.LANG
231
+
232
+ version: int
233
+
234
+ @property
235
+ def name(self) -> str: ...
236
+
237
+ @property
238
+ def producer(self) -> str: ...
239
+
240
+ @property
241
+ def compilation_dir(self) -> str: ...
242
+
243
+ @property
244
+ def language(self) -> CompilationUnit.Language: ...
245
+
246
+ @property
247
+ def low_address(self) -> int: ...
248
+
249
+ @property
250
+ def high_address(self) -> int: ...
251
+
252
+ @property
253
+ def size(self) -> int: ...
254
+
255
+ @property
256
+ def ranges(self) -> list[lief.range_t]: ...
257
+
258
+ @overload
259
+ def find_function(self, name: str) -> Optional[Function]: ...
260
+
261
+ @overload
262
+ def find_function(self, addr: int) -> Optional[Function]: ...
263
+
264
+ @overload
265
+ def find_variable(self, addr: int) -> Optional[Variable]: ...
266
+
267
+ @overload
268
+ def find_variable(self, name: str) -> Optional[Variable]: ...
269
+
270
+ @property
271
+ def types(self) -> Iterator[Optional[Type]]: ...
272
+
273
+ @property
274
+ def functions(self) -> Iterator[Optional[Function]]: ...
275
+
276
+ @property
277
+ def imported_functions(self) -> Iterator[Optional[Function]]: ...
278
+
279
+ @property
280
+ def variables(self) -> Iterator[Optional[Variable]]: ...
281
+
282
+ class DebugInfo(lief.DebugInfo):
283
+ @overload
284
+ def find_function(self, name: str) -> Optional[Function]: ...
285
+
286
+ @overload
287
+ def find_function(self, addr: int) -> Optional[Function]: ...
288
+
289
+ @overload
290
+ def find_variable(self, addr: int) -> Optional[Variable]: ...
291
+
292
+ @overload
293
+ def find_variable(self, name: str) -> Optional[Variable]: ...
294
+
295
+ def find_type(self, name: str) -> Optional[Type]: ...
296
+
297
+ @property
298
+ def compilation_units(self) -> Iterator[Optional[CompilationUnit]]: ...
299
+
300
+ class Editor:
301
+ @staticmethod
302
+ def from_binary(bin: lief.Binary) -> Optional[Editor]: ...
303
+
304
+ def create_compilation_unit(self) -> Optional[editor.CompilationUnit]: ...
305
+
306
+ def write(self, output: Union[str | os.PathLike]) -> None: ...
@@ -0,0 +1,138 @@
1
+ from collections.abc import Sequence
2
+ import enum
3
+ from typing import Iterator, Optional, Union, overload
4
+
5
+
6
+ class Type:
7
+ def pointer_to(self) -> Optional[PointerType]: ...
8
+
9
+ class PointerType(Type):
10
+ pass
11
+
12
+ class EnumType(Type):
13
+ class Value:
14
+ pass
15
+
16
+ def set_size(self, size: int) -> EnumType: ...
17
+
18
+ def add_value(self, name: str, value: int) -> Optional[EnumType.Value]: ...
19
+
20
+ class BaseType(Type):
21
+ class ENCODING(enum.Enum):
22
+ NONE = 0
23
+
24
+ ADDRESS = 1
25
+
26
+ SIGNED = 2
27
+
28
+ SIGNED_CHAR = 3
29
+
30
+ UNSIGNED = 4
31
+
32
+ UNSIGNED_CHAR = 5
33
+
34
+ BOOLEAN = 6
35
+
36
+ FLOAT = 7
37
+
38
+ class ArrayType(Type):
39
+ pass
40
+
41
+ class FunctionType(Type):
42
+ class Parameter:
43
+ pass
44
+
45
+ def set_return_type(self, type: Type) -> FunctionType: ...
46
+
47
+ def add_parameter(self, type: Type) -> Optional[FunctionType.Parameter]: ...
48
+
49
+ class TypeDef(Type):
50
+ pass
51
+
52
+ class StructType(Type):
53
+ class TYPE(enum.Enum):
54
+ CLASS = 0
55
+
56
+ STRUCT = 1
57
+
58
+ UNION = 2
59
+
60
+ class Member:
61
+ pass
62
+
63
+ def set_size(self, size: int) -> StructType: ...
64
+
65
+ def add_member(self, name: str, type: Type, offset: int = -1) -> Optional[StructType.Member]: ...
66
+
67
+ class Function:
68
+ class range_t:
69
+ @overload
70
+ def __init__(self) -> None: ...
71
+
72
+ @overload
73
+ def __init__(self, start: int, end: int) -> None: ...
74
+
75
+ start: int
76
+
77
+ end: int
78
+
79
+ class Parameter:
80
+ pass
81
+
82
+ class LexicalBlock:
83
+ pass
84
+
85
+ class Label:
86
+ pass
87
+
88
+ def set_address(self, addr: int) -> Function: ...
89
+
90
+ def set_low_high(self, low: int, high: int) -> Function: ...
91
+
92
+ def set_ranges(self, ranges: Sequence[Function.range_t]) -> Function: ...
93
+
94
+ def set_external(self) -> Function: ...
95
+
96
+ def set_return_type(self, type: Type) -> Function: ...
97
+
98
+ def add_parameter(self, name: str, type: Type) -> Optional[Function.Parameter]: ...
99
+
100
+ def create_stack_variable(self, name: str) -> Optional[Variable]: ...
101
+
102
+ def add_lexical_block(self, start: int, end: int) -> Optional[Function.LexicalBlock]: ...
103
+
104
+ def add_label(self, addr: int, label: str) -> Optional[Function.Label]: ...
105
+
106
+ class Variable:
107
+ def set_addr(self, addr: int) -> Variable: ...
108
+
109
+ def set_stack_offset(self, offset: int) -> Variable: ...
110
+
111
+ def set_external(self) -> Variable: ...
112
+
113
+ def set_type(self, type: Type) -> Variable: ...
114
+
115
+ class CompilationUnit:
116
+ def set_producer(self, arg: str, /) -> CompilationUnit: ...
117
+
118
+ def create_function(self, name: str) -> Optional[Function]: ...
119
+
120
+ def create_variable(self, name: str) -> Optional[Variable]: ...
121
+
122
+ def create_generic_type(self, name: str) -> Optional[Type]: ...
123
+
124
+ def create_enum(self, name: str) -> Optional[EnumType]: ...
125
+
126
+ def create_typedef(self, name: str, ty: Type) -> Optional[TypeDef]: ...
127
+
128
+ def create_structure(self, name: str, kind: StructType.TYPE = StructType.TYPE.STRUCT) -> Optional[StructType]: ...
129
+
130
+ def create_base_type(self, name: str, size: int, encoding: BaseType.ENCODING = BaseType.ENCODING.NONE) -> Optional[BaseType]: ...
131
+
132
+ def create_function_type(self, name: str) -> Optional[FunctionType]: ...
133
+
134
+ def create_pointer_type(self, ty: Type) -> Optional[PointerType]: ...
135
+
136
+ def create_void_type(self) -> Optional[Type]: ...
137
+
138
+ def create_array(self, name: str, ty: Type, count: int) -> Optional[ArrayType]: ...
@@ -0,0 +1,14 @@
1
+ from typing import Iterator, Optional, Union
2
+
3
+ import lief.dwarf
4
+
5
+
6
+ class Formal(lief.dwarf.Parameter):
7
+ @property
8
+ def type(self) -> Optional[lief.dwarf.Type]: ...
9
+
10
+ class TemplateValue(lief.dwarf.Parameter):
11
+ pass
12
+
13
+ class TemplateType(lief.dwarf.Parameter):
14
+ pass