lief 0.16.5__cp310-cp310-win32.whl → 0.16.7__cp310-cp310-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/__init__.pyi CHANGED
@@ -2,6 +2,9 @@ from collections.abc import Sequence
2
2
  import enum
3
3
  import io
4
4
  import lief
5
+ import lief.ELF
6
+ import lief.MachO
7
+ import lief.PE
5
8
  import os
6
9
  from typing import Iterator, Optional, Union, overload
7
10
 
@@ -23,208 +26,126 @@ from . import (
23
26
  )
24
27
 
25
28
 
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: ...
29
+ __tag__: str = ...
60
30
 
61
- def __next__(self) -> Symbol: ...
31
+ __commit__: str = ...
62
32
 
63
- class it_relocations:
64
- def __getitem__(self, arg: int, /) -> Relocation: ...
33
+ __is_tagged__: bool = ...
65
34
 
66
- def __len__(self) -> int: ...
35
+ def disable_leak_warning() -> None: ...
67
36
 
68
- def __iter__(self) -> Binary.it_relocations: ...
37
+ def demangle(mangled: str) -> Optional[str]: ...
69
38
 
70
- def __next__(self) -> Relocation: ...
39
+ __extended__: bool = ...
71
40
 
72
- @property
73
- def debug_info(self) -> DebugInfo: ...
41
+ class range_t:
42
+ low: int
74
43
 
75
- @property
76
- def format(self) -> Binary.FORMATS: ...
44
+ high: int
77
45
 
78
46
  @property
79
- def is_pie(self) -> bool: ...
47
+ def size(self) -> int: ...
80
48
 
81
- @property
82
- def has_nx(self) -> bool: ...
49
+ def __repr__(self) -> str: ...
83
50
 
84
- @property
85
- def header(self) -> Header: ...
51
+ def __str__(self) -> str: ...
86
52
 
87
- @property
88
- def entrypoint(self) -> int: ...
53
+ class debug_location_t:
54
+ line: int
89
55
 
90
- def remove_section(self, name: str, clear: bool = False) -> None: ...
56
+ file: str
91
57
 
92
- @property
93
- def sections(self) -> Binary.it_sections: ...
58
+ def __repr__(self) -> str: ...
94
59
 
95
- @property
96
- def relocations(self) -> Binary.it_relocations: ...
60
+ class PLATFORMS(enum.Enum):
61
+ @staticmethod
62
+ def from_value(arg: int, /) -> PLATFORMS: ...
97
63
 
98
- @property
99
- def exported_functions(self) -> list[Function]: ...
64
+ def __eq__(self, arg, /) -> bool: ...
100
65
 
101
- @property
102
- def imported_functions(self) -> list[Function]: ...
66
+ def __ne__(self, arg, /) -> bool: ...
103
67
 
104
- @property
105
- def libraries(self) -> list[Union[str,bytes]]: ...
68
+ def __int__(self) -> int: ...
106
69
 
107
- @property
108
- def symbols(self) -> Binary.it_symbols: ...
70
+ UNKNOWN = 3
109
71
 
110
- def has_symbol(self, symbol_name: str) -> bool: ...
72
+ LINUX = 1
111
73
 
112
- def get_symbol(self, symbol_name: str) -> Symbol: ...
74
+ ANDROID = 2
113
75
 
114
- def get_function_address(self, function_name: str) -> Union[int, lief_errors]: ...
76
+ WINDOWS = 3
115
77
 
116
- @overload
117
- def patch_address(self, address: int, patch_value: Sequence[int], va_type: Binary.VA_TYPES = Binary.VA_TYPES.AUTO) -> None: ...
78
+ IOS = 4
118
79
 
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: ...
80
+ OSX = 5
121
81
 
122
- def get_content_from_virtual_address(self, virtual_address: int, size: int, va_type: Binary.VA_TYPES = Binary.VA_TYPES.AUTO) -> memoryview: ...
82
+ def current_platform() -> PLATFORMS: ...
123
83
 
124
- def get_int_from_virtual_address(self, address: int, interger_size: int, type: Binary.VA_TYPES = Binary.VA_TYPES.AUTO) -> Optional[int]: ...
84
+ class Object:
85
+ def __hash__(self) -> int: ...
125
86
 
126
- @property
127
- def abstract(self) -> lief.Binary: ...
87
+ def __eq__(self, arg, /) -> bool: ...
128
88
 
129
- @property
130
- def concrete(self) -> lief.ELF.Binary | lief.PE.Binary | lief.MachO.Binary: ...
89
+ class ok_t:
90
+ def __bool__(self) -> bool: ...
131
91
 
92
+ class ok_error_t:
132
93
  @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]: ...
94
+ def is_error(self) -> bool: ...
138
95
 
139
96
  @property
140
- def imagebase(self) -> int: ...
97
+ def is_value(self) -> bool: ...
141
98
 
142
99
  @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
100
+ def error(self) -> lief_errors: ...
176
101
 
177
102
  @property
178
- def format(self) -> DebugInfo.FORMAT: ...
103
+ def value(self) -> ok_t: ...
179
104
 
180
- class Function(Symbol):
181
- @overload
182
- def __init__(self) -> None: ...
105
+ def __bool__(self) -> bool: ...
183
106
 
184
- @overload
185
- def __init__(self, arg: str, /) -> None: ...
107
+ class lief_errors(enum.Enum):
108
+ read_error = 1
186
109
 
187
- @overload
188
- def __init__(self, arg: int, /) -> None: ...
110
+ not_found = 2
189
111
 
190
- @overload
191
- def __init__(self, arg0: str, arg1: int, /) -> None: ...
112
+ not_implemented = 3
192
113
 
193
- class FLAGS(enum.Flag):
194
- @staticmethod
195
- def from_value(arg: int, /) -> Function.FLAGS: ...
114
+ not_supported = 4
196
115
 
197
- def __eq__(self, arg, /) -> bool: ...
116
+ corrupted = 5
198
117
 
199
- def __ne__(self, arg, /) -> bool: ...
118
+ conversion_error = 6
200
119
 
201
- def __int__(self) -> int: ...
120
+ read_out_of_bound = 7
202
121
 
203
- NONE = 0
122
+ asn1_bad_tag = 8
204
123
 
205
- IMPORTED = 16
124
+ file_error = 9
206
125
 
207
- EXPORTED = 8
126
+ file_format_error = 10
208
127
 
209
- CONSTRUCTOR = 1
128
+ parsing_error = 11
210
129
 
211
- DESTRUCTOR = 2
130
+ build_error = 12
212
131
 
213
- DEBUG_INFO = 4
132
+ data_too_large = 13
214
133
 
215
- def add(self, flag: Function.FLAGS) -> Function: ...
134
+ require_extended_version = 14
216
135
 
217
- def has(self, flag: Function.FLAGS) -> bool: ...
136
+ @overload
137
+ def hash(arg: Object, /) -> int: ... # type: ignore
218
138
 
219
- @property
220
- def flags(self) -> Function.FLAGS: ...
139
+ @overload
140
+ def hash(arg: Sequence[int], /) -> int: ... # type: ignore
221
141
 
222
- @property
223
- def flags_list(self) -> list[Function.FLAGS]: ...
142
+ @overload
143
+ def hash(arg: bytes, /) -> int: ... # type: ignore
224
144
 
225
- address: int
145
+ @overload
146
+ def hash(arg: str, /) -> int: ... # type: ignore
226
147
 
227
- def __str__(self) -> str: ...
148
+ def to_json(arg: Object, /) -> str: ...
228
149
 
229
150
  class Header(Object):
230
151
  class ARCHITECTURES(enum.Enum):
@@ -261,6 +182,8 @@ class Header(Object):
261
182
 
262
183
  LOONGARCH = 11
263
184
 
185
+ PPC64 = 12
186
+
264
187
  class ENDIANNESS(enum.Enum):
265
188
  @staticmethod
266
189
  def from_value(arg: int, /) -> Header.ENDIANNESS: ...
@@ -343,45 +266,145 @@ class Header(Object):
343
266
 
344
267
  def __str__(self) -> str: ...
345
268
 
346
- class Object:
347
- def __hash__(self) -> int: ...
348
-
349
- def __eq__(self, arg, /) -> bool: ...
269
+ class Binary(Object):
270
+ class VA_TYPES(enum.Enum):
271
+ AUTO = 0
350
272
 
351
- class PLATFORMS(enum.Enum):
352
- @staticmethod
353
- def from_value(arg: int, /) -> PLATFORMS: ...
273
+ VA = 2
354
274
 
355
- def __eq__(self, arg, /) -> bool: ...
275
+ RVA = 1
356
276
 
357
- def __ne__(self, arg, /) -> bool: ...
277
+ class FORMATS(enum.Enum):
278
+ UNKNOWN = 0
358
279
 
359
- def __int__(self) -> int: ...
280
+ ELF = 1
360
281
 
361
- UNKNOWN = 3
282
+ PE = 2
362
283
 
363
- LINUX = 1
284
+ MACHO = 3
364
285
 
365
- ANDROID = 2
286
+ OAT = 4
366
287
 
367
- WINDOWS = 3
288
+ class it_sections:
289
+ def __getitem__(self, arg: int, /) -> Section: ...
368
290
 
369
- IOS = 4
291
+ def __len__(self) -> int: ...
370
292
 
371
- OSX = 5
293
+ def __iter__(self) -> Binary.it_sections: ...
372
294
 
373
- class Relocation(Object):
374
- address: int
295
+ def __next__(self) -> Section: ...
375
296
 
376
- size: int
297
+ class it_symbols:
298
+ def __getitem__(self, arg: int, /) -> Symbol: ...
377
299
 
378
- def __str__(self) -> str: ...
300
+ def __len__(self) -> int: ...
379
301
 
380
- class Section(Object):
381
- name: Union[str, bytes]
302
+ def __iter__(self) -> Binary.it_symbols: ...
382
303
 
383
- @property
384
- def fullname(self) -> bytes: ...
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: ...
385
408
 
386
409
  size: int
387
410
 
@@ -420,150 +443,132 @@ class Symbol(Object):
420
443
 
421
444
  def __str__(self) -> str: ...
422
445
 
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
446
  @overload
445
- def hash(arg: Object, /) -> int: ... # type: ignore
447
+ def parse(raw: bytes) -> Optional[Binary]: ...
446
448
 
447
449
  @overload
448
- def hash(arg: Sequence[int], /) -> int: ... # type: ignore
450
+ def parse(filepath: str) -> Optional[Binary]: ...
449
451
 
450
452
  @overload
451
- def hash(arg: bytes, /) -> int: ... # type: ignore
453
+ def parse(obj: Union[io.IOBase | os.PathLike]) -> Optional[Binary]: ...
452
454
 
453
- @overload
454
- def hash(arg: str, /) -> int: ... # type: ignore
455
+ class Relocation(Object):
456
+ address: int
455
457
 
456
- @overload
457
- def is_art(path: str) -> bool: ...
458
+ size: int
458
459
 
459
- @overload
460
- def is_art(raw: Sequence[int]) -> bool: ...
460
+ def __str__(self) -> str: ...
461
461
 
462
- @overload
463
- def is_dex(path: str) -> bool: ...
462
+ class Function(Symbol):
463
+ @overload
464
+ def __init__(self) -> None: ...
464
465
 
465
- @overload
466
- def is_dex(raw: Sequence[int]) -> bool: ...
466
+ @overload
467
+ def __init__(self, arg: str, /) -> None: ...
467
468
 
468
- @overload
469
- def is_elf(filename: str) -> bool: ...
469
+ @overload
470
+ def __init__(self, arg: int, /) -> None: ...
470
471
 
471
- @overload
472
- def is_elf(raw: Sequence[int]) -> bool: ...
472
+ @overload
473
+ def __init__(self, arg0: str, arg1: int, /) -> None: ...
473
474
 
474
- @overload
475
- def is_macho(filename: str) -> bool: ...
475
+ class FLAGS(enum.Flag):
476
+ @staticmethod
477
+ def from_value(arg: int, /) -> Function.FLAGS: ...
476
478
 
477
- @overload
478
- def is_macho(raw: Sequence[int]) -> bool: ...
479
+ def __eq__(self, arg, /) -> bool: ...
479
480
 
480
- @overload
481
- def is_oat(binary: ELF.Binary) -> bool: ...
481
+ def __ne__(self, arg, /) -> bool: ...
482
482
 
483
- @overload
484
- def is_oat(path: str) -> bool: ...
483
+ def __int__(self) -> int: ...
485
484
 
486
- @overload
487
- def is_oat(raw: Sequence[int]) -> bool: ...
485
+ NONE = 0
488
486
 
489
- @overload
490
- def is_pe(file: str) -> bool: ...
487
+ IMPORTED = 16
491
488
 
492
- @overload
493
- def is_pe(raw: Sequence[int]) -> bool: ...
489
+ EXPORTED = 8
494
490
 
495
- @overload
496
- def is_vdex(path: str) -> bool: ...
491
+ CONSTRUCTOR = 1
497
492
 
498
- @overload
499
- def is_vdex(raw: Sequence[int]) -> bool: ...
493
+ DESTRUCTOR = 2
500
494
 
501
- class lief_errors(enum.Enum):
502
- read_error = 1
495
+ DEBUG_INFO = 4
503
496
 
504
- not_found = 2
497
+ def add(self, flag: Function.FLAGS) -> Function: ...
505
498
 
506
- not_implemented = 3
499
+ def has(self, flag: Function.FLAGS) -> bool: ...
507
500
 
508
- not_supported = 4
501
+ @property
502
+ def flags(self) -> Function.FLAGS: ...
509
503
 
510
- corrupted = 5
504
+ @property
505
+ def flags_list(self) -> list[Function.FLAGS]: ...
511
506
 
512
- conversion_error = 6
507
+ address: int
513
508
 
514
- read_out_of_bound = 7
509
+ def __str__(self) -> str: ...
515
510
 
516
- asn1_bad_tag = 8
511
+ class DebugInfo:
512
+ class FORMAT(enum.Enum):
513
+ @staticmethod
514
+ def from_value(arg: int, /) -> DebugInfo.FORMAT: ...
517
515
 
518
- file_error = 9
516
+ def __eq__(self, arg, /) -> bool: ...
519
517
 
520
- file_format_error = 10
518
+ def __ne__(self, arg, /) -> bool: ...
521
519
 
522
- parsing_error = 11
520
+ def __int__(self) -> int: ...
523
521
 
524
- build_error = 12
522
+ UNKNOWN = 0
525
523
 
526
- data_too_large = 13
524
+ DWARF = 1
527
525
 
528
- require_extended_version = 14
526
+ PDB = 2
529
527
 
530
- class ok_error_t:
531
528
  @property
532
- def is_error(self) -> bool: ...
529
+ def format(self) -> DebugInfo.FORMAT: ...
533
530
 
534
- @property
535
- def is_value(self) -> bool: ...
531
+ @overload
532
+ def is_elf(filename: str) -> bool: ...
536
533
 
537
- @property
538
- def error(self) -> lief_errors: ...
534
+ @overload
535
+ def is_elf(raw: Sequence[int]) -> bool: ...
539
536
 
540
- @property
541
- def value(self) -> ok_t: ...
537
+ @overload
538
+ def is_pe(file: str) -> bool: ...
542
539
 
543
- def __bool__(self) -> bool: ...
540
+ @overload
541
+ def is_pe(raw: Sequence[int]) -> bool: ...
544
542
 
545
- class ok_t:
546
- def __bool__(self) -> bool: ...
543
+ @overload
544
+ def is_macho(filename: str) -> bool: ...
547
545
 
548
546
  @overload
549
- def parse(raw: bytes) -> Optional[Binary]: ...
547
+ def is_macho(raw: Sequence[int]) -> bool: ...
550
548
 
551
549
  @overload
552
- def parse(filepath: str) -> Optional[Binary]: ...
550
+ def is_oat(binary: ELF.Binary) -> bool: ...
553
551
 
554
552
  @overload
555
- def parse(obj: Union[io.IOBase | os.PathLike]) -> Optional[Binary]: ...
553
+ def is_oat(path: str) -> bool: ...
556
554
 
557
- class range_t:
558
- low: int
555
+ @overload
556
+ def is_oat(raw: Sequence[int]) -> bool: ...
559
557
 
560
- high: int
558
+ @overload
559
+ def is_dex(path: str) -> bool: ...
561
560
 
562
- @property
563
- def size(self) -> int: ...
561
+ @overload
562
+ def is_dex(raw: Sequence[int]) -> bool: ...
564
563
 
565
- def __repr__(self) -> str: ...
564
+ @overload
565
+ def is_vdex(path: str) -> bool: ...
566
566
 
567
- def __str__(self) -> str: ...
567
+ @overload
568
+ def is_vdex(raw: Sequence[int]) -> bool: ...
568
569
 
569
- def to_json(arg: Object, /) -> str: ...
570
+ @overload
571
+ def is_art(path: str) -> bool: ...
572
+
573
+ @overload
574
+ def is_art(raw: Sequence[int]) -> bool: ...
lief/_lief.pyd CHANGED
Binary file