Rizin
unix-like reverse engineering framework and cli tools
marshal.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2016 c0riolis
2 // SPDX-FileCopyrightText: 2016 Tardy
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #ifndef MARSHAL_H
6 #define MARSHAL_H
7 
8 #include <rz_util.h>
9 #include <rz_types.h>
10 #include "pyc_magic.h"
11 
12 typedef enum {
13  TYPE_ASCII = 'a',
17  TYPE_CODE_v0 = 'C',
18  TYPE_CODE_v1 = 'c',
19  TYPE_COMPLEX = 'x',
20  TYPE_DICT = '{',
22  TYPE_FALSE = 'F',
23  TYPE_FLOAT = 'f',
25  TYPE_INT64 = 'I',
27  TYPE_INT = 'i',
28  TYPE_LIST = '[',
29  TYPE_LONG = 'l',
30  TYPE_NONE = 'N',
31  TYPE_NULL = '0',
32  TYPE_REF = 'r',
33  TYPE_SET = '<',
39  TYPE_STRING = 's',
40  TYPE_TRUE = 'T',
41  TYPE_TUPLE = '(',
42  TYPE_UNICODE = 'u',
43  TYPE_UNKNOWN = '?',
45 
46 typedef enum {
47  FLAG_REF = '\x80',
49 
50 typedef struct {
52  void *data;
53 } pyc_object;
54 
55 typedef struct {
75 
76 typedef struct pyc_context {
78  struct pyc_version version;
79  /* used from marshall.c */
83  RzList *refs; // If you don't have a good reason, do not change this. And also checkout !refs in get_code_object()
87 
90 
91 #endif
RzList * symbols(RzBinFile *bf)
Definition: bin_ne.c:102
RzList * sections(RzBinFile *bf)
Definition: bin_ne.c:110
uint32_t ut32
pyc_marshal_flag
Definition: marshal.h:46
@ FLAG_REF
Definition: marshal.h:47
pyc_marshal_type
Definition: marshal.h:12
@ TYPE_NONE
Definition: marshal.h:30
@ TYPE_STRINGREF
Definition: marshal.h:38
@ TYPE_INT64
Definition: marshal.h:25
@ TYPE_SHORT_ASCII
Definition: marshal.h:35
@ TYPE_NULL
Definition: marshal.h:31
@ TYPE_BINARY_FLOAT
Definition: marshal.h:16
@ TYPE_FLOAT
Definition: marshal.h:23
@ TYPE_LIST
Definition: marshal.h:28
@ TYPE_BINARY_COMPLEX
Definition: marshal.h:15
@ TYPE_TUPLE
Definition: marshal.h:41
@ TYPE_TRUE
Definition: marshal.h:40
@ TYPE_LONG
Definition: marshal.h:29
@ TYPE_INT
Definition: marshal.h:27
@ TYPE_UNKNOWN
Definition: marshal.h:43
@ TYPE_DICT
Definition: marshal.h:20
@ TYPE_UNICODE
Definition: marshal.h:42
@ TYPE_SMALL_TUPLE
Definition: marshal.h:36
@ TYPE_INTERNED
Definition: marshal.h:26
@ TYPE_ELLIPSIS
Definition: marshal.h:21
@ TYPE_COMPLEX
Definition: marshal.h:19
@ TYPE_CODE_v1
Definition: marshal.h:18
@ TYPE_ASCII_INTERNED
Definition: marshal.h:14
@ TYPE_REF
Definition: marshal.h:32
@ TYPE_FALSE
Definition: marshal.h:22
@ TYPE_SET
Definition: marshal.h:33
@ TYPE_CODE_v0
Definition: marshal.h:17
@ TYPE_STRING
Definition: marshal.h:39
@ TYPE_FROZENSET
Definition: marshal.h:24
@ TYPE_ASCII
Definition: marshal.h:13
@ TYPE_STOPITER
Definition: marshal.h:37
@ TYPE_SHORT_ASCII_INTERNED
Definition: marshal.h:34
ut64 get_code_object_addr(RzBinPycObj *pyc, RzBuffer *buffer, ut32 magic)
Definition: marshal.c:981
bool get_sections_symbols_from_code_objects(RzBinPycObj *pyc, RzBuffer *buffer, RzList *sections, RzList *symbols, RzList *objs, ut32 magic)
Definition: marshal.c:1190
struct pyc_context RzBinPycObj
#define st64
Definition: rz_types_base.h:10
Definition: buffer.h:15
ut32 kwonlyargcount
Definition: marshal.h:58
pyc_object * names
Definition: marshal.h:64
ut32 stacksize
Definition: marshal.h:60
ut32 posonlyargcount
Definition: marshal.h:57
st64 end_offset
Definition: marshal.h:73
ut32 firstlineno
Definition: marshal.h:70
pyc_object * varnames
Definition: marshal.h:65
pyc_object * freevars
Definition: marshal.h:66
pyc_object * code
Definition: marshal.h:62
ut32 nlocals
Definition: marshal.h:59
st64 start_offset
Definition: marshal.h:72
pyc_object * filename
Definition: marshal.h:68
pyc_object * cellvars
Definition: marshal.h:67
pyc_object * lnotab
Definition: marshal.h:71
pyc_object * name
Definition: marshal.h:69
pyc_object * consts
Definition: marshal.h:63
ut32 argcount
Definition: marshal.h:56
ut32 symbols_ordinal
Definition: marshal.h:85
RzList * refs
Definition: marshal.h:83
ut64 code_start_offset
Definition: marshal.h:77
RzList * sections_cache
Definition: marshal.h:81
RzList * interned_table
Definition: marshal.h:80
ut32 magic_int
Definition: marshal.h:84
RzList * shared
Definition: marshal.h:82
void * data
Definition: marshal.h:52
pyc_marshal_type type
Definition: marshal.h:51
ut32 magic
Definition: pyc_magic.h:11
ut64(WINAPI *w32_GetEnabledXStateFeatures)()