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