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.
lief/__init__.pyi ADDED
@@ -0,0 +1,600 @@
1
+ from collections.abc import Sequence
2
+ import enum
3
+ import io
4
+ import lief
5
+ import lief.ELF
6
+ import lief.MachO
7
+ import lief.PE
8
+ import os
9
+ from typing import Iterator, Optional, Union, overload
10
+
11
+ from . import (
12
+ ART as ART,
13
+ Android as Android,
14
+ COFF as COFF,
15
+ DEX as DEX,
16
+ ELF as ELF,
17
+ MachO as MachO,
18
+ OAT as OAT,
19
+ PE as PE,
20
+ VDEX as VDEX,
21
+ assembly as assembly,
22
+ dsc as dsc,
23
+ dwarf as dwarf,
24
+ logging as logging,
25
+ objc as objc,
26
+ pdb as pdb
27
+ )
28
+
29
+
30
+ __tag__: str = ...
31
+
32
+ __commit__: str = ...
33
+
34
+ __is_tagged__: bool = ...
35
+
36
+ class lief_version_t:
37
+ major: int
38
+
39
+ minor: int
40
+
41
+ patch: int
42
+
43
+ id: int
44
+
45
+ def __repr__(self) -> str: ...
46
+
47
+ def __str__(self) -> str: ...
48
+
49
+ def disable_leak_warning() -> None: ...
50
+
51
+ def demangle(mangled: str) -> Optional[str]: ...
52
+
53
+ def dump(buffer: memoryview, title: str = '', prefix: str = '', limit: int = 0) -> str: ...
54
+
55
+ def extended_version_info() -> str: ...
56
+
57
+ def extended_version() -> lief_version_t: ...
58
+
59
+ __extended__: bool = ...
60
+
61
+ class range_t:
62
+ low: int
63
+
64
+ high: int
65
+
66
+ @property
67
+ def size(self) -> int: ...
68
+
69
+ def __repr__(self) -> str: ...
70
+
71
+ def __str__(self) -> str: ...
72
+
73
+ class debug_location_t:
74
+ line: int
75
+
76
+ file: str
77
+
78
+ def __repr__(self) -> str: ...
79
+
80
+ class PLATFORMS(enum.Enum):
81
+ @staticmethod
82
+ def from_value(arg: int, /) -> PLATFORMS: ...
83
+
84
+ def __eq__(self, arg, /) -> bool: ...
85
+
86
+ def __ne__(self, arg, /) -> bool: ...
87
+
88
+ def __int__(self) -> int: ...
89
+
90
+ UNKNOWN = 3
91
+
92
+ LINUX = 1
93
+
94
+ ANDROID = 2
95
+
96
+ WINDOWS = 3
97
+
98
+ IOS = 4
99
+
100
+ OSX = 5
101
+
102
+ def current_platform() -> PLATFORMS: ...
103
+
104
+ class Object:
105
+ def __hash__(self) -> int: ...
106
+
107
+ def __eq__(self, arg, /) -> bool: ...
108
+
109
+ class ok_t:
110
+ def __bool__(self) -> bool: ...
111
+
112
+ class ok_error_t:
113
+ @property
114
+ def is_error(self) -> bool: ...
115
+
116
+ @property
117
+ def is_value(self) -> bool: ...
118
+
119
+ @property
120
+ def error(self) -> lief_errors: ...
121
+
122
+ @property
123
+ def value(self) -> ok_t: ...
124
+
125
+ def __bool__(self) -> bool: ...
126
+
127
+ class lief_errors(enum.Enum):
128
+ read_error = 1
129
+
130
+ not_found = 2
131
+
132
+ not_implemented = 3
133
+
134
+ not_supported = 4
135
+
136
+ corrupted = 5
137
+
138
+ conversion_error = 6
139
+
140
+ read_out_of_bound = 7
141
+
142
+ asn1_bad_tag = 8
143
+
144
+ file_error = 9
145
+
146
+ file_format_error = 10
147
+
148
+ parsing_error = 11
149
+
150
+ build_error = 12
151
+
152
+ data_too_large = 13
153
+
154
+ require_extended_version = 14
155
+
156
+ @overload
157
+ def hash(arg: Object, /) -> int: ... # type: ignore
158
+
159
+ @overload
160
+ def hash(arg: Sequence[int], /) -> int: ... # type: ignore
161
+
162
+ @overload
163
+ def hash(arg: bytes, /) -> int: ... # type: ignore
164
+
165
+ @overload
166
+ def hash(arg: str, /) -> int: ... # type: ignore
167
+
168
+ def to_json(arg: Object, /) -> str: ...
169
+
170
+ class Header(Object):
171
+ class ARCHITECTURES(enum.Enum):
172
+ @staticmethod
173
+ def from_value(arg: int, /) -> Header.ARCHITECTURES: ...
174
+
175
+ def __eq__(self, arg, /) -> bool: ...
176
+
177
+ def __ne__(self, arg, /) -> bool: ...
178
+
179
+ def __int__(self) -> int: ...
180
+
181
+ UNKNOWN = 0
182
+
183
+ ARM = 1
184
+
185
+ ARM64 = 2
186
+
187
+ MIPS = 3
188
+
189
+ X86 = 4
190
+
191
+ X86_64 = 5
192
+
193
+ PPC = 6
194
+
195
+ SPARC = 7
196
+
197
+ SYSZ = 8
198
+
199
+ XCORE = 9
200
+
201
+ RISCV = 10
202
+
203
+ LOONGARCH = 11
204
+
205
+ PPC64 = 12
206
+
207
+ class ENDIANNESS(enum.Enum):
208
+ @staticmethod
209
+ def from_value(arg: int, /) -> Header.ENDIANNESS: ...
210
+
211
+ def __eq__(self, arg, /) -> bool: ...
212
+
213
+ def __ne__(self, arg, /) -> bool: ...
214
+
215
+ def __int__(self) -> int: ...
216
+
217
+ UNKNOWN = 0
218
+
219
+ BIG = 1
220
+
221
+ LITTLE = 2
222
+
223
+ class MODES(enum.Enum):
224
+ @staticmethod
225
+ def from_value(arg: int, /) -> Header.MODES: ...
226
+
227
+ def __eq__(self, arg, /) -> bool: ...
228
+
229
+ def __ne__(self, arg, /) -> bool: ...
230
+
231
+ def __int__(self) -> int: ...
232
+
233
+ NONE = 0
234
+
235
+ BITS_16 = 1
236
+
237
+ BITS_32 = 2
238
+
239
+ BITS_64 = 4
240
+
241
+ THUMB = 8
242
+
243
+ ARM64E = 16
244
+
245
+ class OBJECT_TYPES(enum.Enum):
246
+ @staticmethod
247
+ def from_value(arg: int, /) -> Header.OBJECT_TYPES: ...
248
+
249
+ def __eq__(self, arg, /) -> bool: ...
250
+
251
+ def __ne__(self, arg, /) -> bool: ...
252
+
253
+ def __int__(self) -> int: ...
254
+
255
+ UNKNOWN = 0
256
+
257
+ EXECUTABLE = 1
258
+
259
+ LIBRARY = 2
260
+
261
+ OBJECT = 3
262
+
263
+ @property
264
+ def architecture(self) -> Header.ARCHITECTURES: ...
265
+
266
+ @property
267
+ def modes(self) -> Header.MODES: ...
268
+
269
+ @property
270
+ def modes_list(self) -> list[Header.MODES]: ...
271
+
272
+ @property
273
+ def entrypoint(self) -> int: ...
274
+
275
+ @property
276
+ def object_type(self) -> Header.OBJECT_TYPES: ...
277
+
278
+ @property
279
+ def endianness(self) -> Header.ENDIANNESS: ...
280
+
281
+ @property
282
+ def is_32(self) -> bool: ...
283
+
284
+ @property
285
+ def is_64(self) -> bool: ...
286
+
287
+ def __str__(self) -> str: ...
288
+
289
+ class Binary(Object):
290
+ class VA_TYPES(enum.Enum):
291
+ AUTO = 0
292
+
293
+ RVA = 1
294
+
295
+ VA = 2
296
+
297
+ class FORMATS(enum.Enum):
298
+ UNKNOWN = 0
299
+
300
+ ELF = 1
301
+
302
+ PE = 2
303
+
304
+ MACHO = 3
305
+
306
+ OAT = 4
307
+
308
+ class it_sections:
309
+ def __getitem__(self, arg: int, /) -> Section: ...
310
+
311
+ def __len__(self) -> int: ...
312
+
313
+ def __iter__(self) -> Binary.it_sections: ...
314
+
315
+ def __next__(self) -> Section: ...
316
+
317
+ class it_symbols:
318
+ def __getitem__(self, arg: int, /) -> Symbol: ...
319
+
320
+ def __len__(self) -> int: ...
321
+
322
+ def __iter__(self) -> Binary.it_symbols: ...
323
+
324
+ def __next__(self) -> Symbol: ...
325
+
326
+ class it_relocations:
327
+ def __getitem__(self, arg: int, /) -> Relocation: ...
328
+
329
+ def __len__(self) -> int: ...
330
+
331
+ def __iter__(self) -> Binary.it_relocations: ...
332
+
333
+ def __next__(self) -> Relocation: ...
334
+
335
+ @property
336
+ def debug_info(self) -> DebugInfo: ...
337
+
338
+ @property
339
+ def format(self) -> Binary.FORMATS: ...
340
+
341
+ @property
342
+ def is_pie(self) -> bool: ...
343
+
344
+ @property
345
+ def has_nx(self) -> bool: ...
346
+
347
+ @property
348
+ def header(self) -> Header: ...
349
+
350
+ @property
351
+ def entrypoint(self) -> int: ...
352
+
353
+ def remove_section(self, name: str, clear: bool = False) -> None: ...
354
+
355
+ @property
356
+ def sections(self) -> Binary.it_sections: ...
357
+
358
+ @property
359
+ def relocations(self) -> Binary.it_relocations: ...
360
+
361
+ @property
362
+ def exported_functions(self) -> list[Function]: ...
363
+
364
+ @property
365
+ def imported_functions(self) -> list[Function]: ...
366
+
367
+ @property
368
+ def libraries(self) -> list[Union[str,bytes]]: ...
369
+
370
+ @property
371
+ def symbols(self) -> Binary.it_symbols: ...
372
+
373
+ def has_symbol(self, symbol_name: str) -> bool: ...
374
+
375
+ def get_symbol(self, symbol_name: str) -> Symbol: ...
376
+
377
+ def get_function_address(self, function_name: str) -> Union[int, lief_errors]: ...
378
+
379
+ @overload
380
+ def patch_address(self, address: int, patch_value: Sequence[int], va_type: Binary.VA_TYPES = Binary.VA_TYPES.AUTO) -> None: ...
381
+
382
+ @overload
383
+ def patch_address(self, address: int, patch_value: int, size: int = 8, va_type: Binary.VA_TYPES = Binary.VA_TYPES.AUTO) -> None: ...
384
+
385
+ def get_content_from_virtual_address(self, virtual_address: int, size: int, va_type: Binary.VA_TYPES = Binary.VA_TYPES.AUTO) -> memoryview: ...
386
+
387
+ def get_int_from_virtual_address(self, address: int, interger_size: int, type: Binary.VA_TYPES = Binary.VA_TYPES.AUTO) -> Optional[int]: ...
388
+
389
+ @property
390
+ def abstract(self) -> lief.Binary: ...
391
+
392
+ @property
393
+ def concrete(self) -> lief.ELF.Binary | lief.PE.Binary | lief.MachO.Binary: ...
394
+
395
+ @property
396
+ def ctor_functions(self) -> list[Function]: ...
397
+
398
+ def xref(self, virtual_address: int) -> list[int]: ...
399
+
400
+ def offset_to_virtual_address(self, offset: int, slide: int = 0) -> Union[int, lief_errors]: ...
401
+
402
+ @property
403
+ def imagebase(self) -> int: ...
404
+
405
+ @property
406
+ def original_size(self) -> int: ...
407
+
408
+ @overload
409
+ def disassemble(self, address: int) -> Iterator[Optional[assembly.Instruction]]: ...
410
+
411
+ @overload
412
+ def disassemble(self, address: int, size: int) -> Iterator[Optional[assembly.Instruction]]: ...
413
+
414
+ @overload
415
+ def disassemble(self, function_name: str) -> Iterator[Optional[assembly.Instruction]]: ...
416
+
417
+ def disassemble_from_bytes(self, buffer: bytes, address: int = 0) -> Iterator[Optional[assembly.Instruction]]: ...
418
+
419
+ def assemble(self, address: int, assembly: str, config: assembly.AssemblerConfig = ...) -> bytes: ...
420
+
421
+ @property
422
+ def page_size(self) -> int: ...
423
+
424
+ def load_debug_info(self, path: Union[str | os.PathLike]) -> DebugInfo: ...
425
+
426
+ def __str__(self) -> str: ...
427
+
428
+ class Section(Object):
429
+ name: Union[str, bytes]
430
+
431
+ @property
432
+ def fullname(self) -> bytes: ...
433
+
434
+ size: int
435
+
436
+ offset: int
437
+
438
+ virtual_address: int
439
+
440
+ content: memoryview
441
+
442
+ @property
443
+ def entropy(self) -> float: ...
444
+
445
+ @overload
446
+ def search(self, number: int, pos: int = 0, size: int = 0) -> Optional[int]: ...
447
+
448
+ @overload
449
+ def search(self, str: str, pos: int = 0) -> Optional[int]: ...
450
+
451
+ @overload
452
+ def search(self, bytes: bytes, pos: int = 0) -> Optional[int]: ...
453
+
454
+ @overload
455
+ def search_all(self, number: int, size: int = 0) -> list[int]: ...
456
+
457
+ @overload
458
+ def search_all(self, str: str) -> list[int]: ...
459
+
460
+ def __str__(self) -> str: ...
461
+
462
+ class Symbol(Object):
463
+ name: Union[str, bytes]
464
+
465
+ value: int
466
+
467
+ size: int
468
+
469
+ def __str__(self) -> str: ...
470
+
471
+ def parse(obj: Union[str | io.IOBase | os.PathLike | bytes | list[int]]) -> PE.Binary | OAT.Binary | ELF.Binary | MachO.Binary | COFF.Binary | None: ...
472
+
473
+ class Relocation(Object):
474
+ address: int
475
+
476
+ size: int
477
+
478
+ def __str__(self) -> str: ...
479
+
480
+ class Function(Symbol):
481
+ @overload
482
+ def __init__(self) -> None: ...
483
+
484
+ @overload
485
+ def __init__(self, arg: str, /) -> None: ...
486
+
487
+ @overload
488
+ def __init__(self, arg: int, /) -> None: ...
489
+
490
+ @overload
491
+ def __init__(self, arg0: str, arg1: int, /) -> None: ...
492
+
493
+ class FLAGS(enum.Flag):
494
+ @staticmethod
495
+ def from_value(arg: int, /) -> Function.FLAGS: ...
496
+
497
+ def __eq__(self, arg, /) -> bool: ...
498
+
499
+ def __ne__(self, arg, /) -> bool: ...
500
+
501
+ def __int__(self) -> int: ...
502
+
503
+ NONE = 0
504
+
505
+ IMPORTED = 16
506
+
507
+ EXPORTED = 8
508
+
509
+ CONSTRUCTOR = 1
510
+
511
+ DESTRUCTOR = 2
512
+
513
+ DEBUG_INFO = 4
514
+
515
+ def add(self, flag: Function.FLAGS) -> Function: ...
516
+
517
+ def has(self, flag: Function.FLAGS) -> bool: ...
518
+
519
+ @property
520
+ def flags(self) -> Function.FLAGS: ...
521
+
522
+ @property
523
+ def flags_list(self) -> list[Function.FLAGS]: ...
524
+
525
+ address: int
526
+
527
+ def __str__(self) -> str: ...
528
+
529
+ class DebugInfo:
530
+ class FORMAT(enum.Enum):
531
+ @staticmethod
532
+ def from_value(arg: int, /) -> DebugInfo.FORMAT: ...
533
+
534
+ def __eq__(self, arg, /) -> bool: ...
535
+
536
+ def __ne__(self, arg, /) -> bool: ...
537
+
538
+ def __int__(self) -> int: ...
539
+
540
+ UNKNOWN = 0
541
+
542
+ DWARF = 1
543
+
544
+ PDB = 2
545
+
546
+ @property
547
+ def format(self) -> DebugInfo.FORMAT: ...
548
+
549
+ def find_function_address(self, name: str) -> int | None: ...
550
+
551
+ def is_pdb(file: Union[str | os.PathLike]) -> bool: ...
552
+
553
+ def is_shared_cache(file: Union[str | os.PathLike]) -> bool: ...
554
+
555
+ @overload
556
+ def is_elf(filename: Union[str | os.PathLike]) -> bool: ...
557
+
558
+ @overload
559
+ def is_elf(raw: Sequence[int]) -> bool: ...
560
+
561
+ @overload
562
+ def is_pe(file: Union[str | os.PathLike]) -> bool: ...
563
+
564
+ @overload
565
+ def is_pe(raw: Sequence[int]) -> bool: ...
566
+
567
+ @overload
568
+ def is_macho(filename: Union[str | os.PathLike]) -> bool: ...
569
+
570
+ @overload
571
+ def is_macho(raw: Sequence[int]) -> bool: ...
572
+
573
+ @overload
574
+ def is_oat(binary: ELF.Binary) -> bool: ...
575
+
576
+ @overload
577
+ def is_oat(path: str) -> bool: ...
578
+
579
+ @overload
580
+ def is_oat(raw: Sequence[int]) -> bool: ...
581
+
582
+ @overload
583
+ def is_dex(path: str) -> bool: ...
584
+
585
+ @overload
586
+ def is_dex(raw: Sequence[int]) -> bool: ...
587
+
588
+ @overload
589
+ def is_vdex(path: str) -> bool: ...
590
+
591
+ @overload
592
+ def is_vdex(raw: Sequence[int]) -> bool: ...
593
+
594
+ @overload
595
+ def is_art(path: str) -> bool: ...
596
+
597
+ @overload
598
+ def is_art(raw: Sequence[int]) -> bool: ...
599
+
600
+ def is_coff(file: Union[str | os.PathLike]) -> bool: ...
lief/_lief.so ADDED
Binary file
@@ -0,0 +1,121 @@
1
+ import enum
2
+ from typing import Iterator, Optional, Union
3
+
4
+ from . import (
5
+ aarch64 as aarch64,
6
+ arm as arm,
7
+ ebpf as ebpf,
8
+ mips as mips,
9
+ powerpc as powerpc,
10
+ riscv as riscv,
11
+ x86 as x86
12
+ )
13
+ import lief
14
+
15
+
16
+ class Engine:
17
+ pass
18
+
19
+ class Instruction:
20
+ class MemoryAccess(enum.Flag):
21
+ @staticmethod
22
+ def from_value(arg: int, /) -> Instruction.MemoryAccess: ...
23
+
24
+ def __eq__(self, arg, /) -> bool: ...
25
+
26
+ def __ne__(self, arg, /) -> bool: ...
27
+
28
+ def __int__(self) -> int: ...
29
+
30
+ NONE = 0
31
+
32
+ READ = 1
33
+
34
+ WRITE = 2
35
+
36
+ @property
37
+ def address(self) -> int: ...
38
+
39
+ @property
40
+ def size(self) -> int: ...
41
+
42
+ @property
43
+ def mnemonic(self) -> str: ...
44
+
45
+ def to_string(self, with_address: bool = True) -> str: ...
46
+
47
+ @property
48
+ def raw(self) -> bytes: ...
49
+
50
+ @property
51
+ def is_call(self) -> bool: ...
52
+
53
+ @property
54
+ def is_terminator(self) -> bool: ...
55
+
56
+ @property
57
+ def is_branch(self) -> bool: ...
58
+
59
+ @property
60
+ def is_syscall(self) -> bool: ...
61
+
62
+ @property
63
+ def is_memory_access(self) -> bool: ...
64
+
65
+ @property
66
+ def is_move_reg(self) -> bool: ...
67
+
68
+ @property
69
+ def is_add(self) -> bool: ...
70
+
71
+ @property
72
+ def is_trap(self) -> bool: ...
73
+
74
+ @property
75
+ def is_barrier(self) -> bool: ...
76
+
77
+ @property
78
+ def is_return(self) -> bool: ...
79
+
80
+ @property
81
+ def is_indirect_branch(self) -> bool: ...
82
+
83
+ @property
84
+ def is_conditional_branch(self) -> bool: ...
85
+
86
+ @property
87
+ def is_unconditional_branch(self) -> bool: ...
88
+
89
+ @property
90
+ def is_compare(self) -> bool: ...
91
+
92
+ @property
93
+ def is_move_immediate(self) -> bool: ...
94
+
95
+ @property
96
+ def is_bitcast(self) -> bool: ...
97
+
98
+ @property
99
+ def memory_access(self) -> Instruction.MemoryAccess: ...
100
+
101
+ @property
102
+ def branch_target(self) -> Union[int, lief.lief_errors]: ...
103
+
104
+ def __str__(self) -> str: ...
105
+
106
+ class AssemblerConfig:
107
+ def __init__(self) -> None: ...
108
+
109
+ class DIALECT(enum.Enum):
110
+ DEFAULT_DIALECT = 0
111
+
112
+ X86_INTEL = 1
113
+
114
+ X86_ATT = 2
115
+
116
+ @staticmethod
117
+ def default_config() -> AssemblerConfig: ...
118
+
119
+ dialect: AssemblerConfig.DIALECT
120
+
121
+ def resolve_symbol(self, name: str) -> int | None: ...