Rizin
unix-like reverse engineering framework and cli tools
pyc.c File Reference
#include "pyc.h"
#include "marshal.h"

Go to the source code of this file.

Functions

bool pyc_get_sections_symbols (RzBinPycObj *pyc, RzList *sections, RzList *symbols, RzList *cobjs, RzBuffer *buf, ut32 magic)
 
static bool pyc_is_object (ut8 b, pyc_marshal_type type)
 
bool pyc_is_code (ut8 b, ut32 magic)
 

Function Documentation

◆ pyc_get_sections_symbols()

bool pyc_get_sections_symbols ( RzBinPycObj pyc,
RzList sections,
RzList symbols,
RzList cobjs,
RzBuffer buf,
ut32  magic 
)

Definition at line 8 of file pyc.c.

8  {
9  return get_sections_symbols_from_code_objects(pyc, buf, sections, symbols, cobjs, magic);
10 }
RzList * symbols(RzBinFile *bf)
Definition: bin_ne.c:102
RzList * sections(RzBinFile *bf)
Definition: bin_ne.c:110
voidpf void * buf
Definition: ioapi.h:138
bool get_sections_symbols_from_code_objects(RzBinPycObj *pyc, RzBuffer *buffer, RzList *sections, RzList *symbols, RzList *cobjs, ut32 magic)
Definition: marshal.c:1190

References get_sections_symbols_from_code_objects(), sections(), and symbols().

Referenced by symbols().

◆ pyc_is_code()

bool pyc_is_code ( ut8  b,
ut32  magic 
)

Definition at line 16 of file pyc.c.

16  {
17  if ((magic == 0x00949494 || magic == 0x0099be2a || magic == 0x0099be3a || magic == 0x00999901) && (pyc_is_object((b & ~FLAG_REF), TYPE_CODE_v0))) {
18  // TYPE_CODE_V0 for Python < 1.0
19  return true;
20  }
21  if (pyc_is_object((b & ~FLAG_REF), TYPE_CODE_v1)) {
22  return true;
23  }
24  return false;
25 }
@ FLAG_REF
Definition: marshal.h:47
@ TYPE_CODE_v1
Definition: marshal.h:18
@ TYPE_CODE_v0
Definition: marshal.h:17
static bool pyc_is_object(ut8 b, pyc_marshal_type type)
Definition: pyc.c:12
#define b(i)
Definition: sha256.c:42

References b, FLAG_REF, pyc_is_object(), TYPE_CODE_v0, and TYPE_CODE_v1.

Referenced by get_entrypoint().

◆ pyc_is_object()

static bool pyc_is_object ( ut8  b,
pyc_marshal_type  type 
)
static

Definition at line 12 of file pyc.c.

12  {
13  return b == type;
14 }
int type
Definition: mipsasm.c:17

References b, and type.

Referenced by pyc_is_code().