lief 0.16.7__cp314-cp314-win32.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.

Potentially problematic release.


This version of lief might be problematic. Click here for more details.

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