File tree Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Expand file tree Collapse file tree 4 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,27 @@ static pyc_opcodes *get_pyc_opcodes(RArchSession *s) {
3737 return ops ;
3838}
3939
40- static RList * get_pyc_code_obj (RArchSession * as ) {
40+ #if 0
41+ struct pyc_version {
42+ ut32 magic ;
43+ const char * version ;
44+ const char * revision ;
45+ };
46+ typedef struct {
47+ ut64 code_start_offset ;
48+ struct pyc_version version ;
49+ RList * sections_cache ; // RList<RBinSection*>
50+ RList * interned_table ; // RList<char*>
51+ RList * cobjs ; // RList<pyc_code_object*>
52+ } RBinPycObj ;
53+ #endif
54+
55+ static inline RList * get_pyc_code_obj (RArchSession * as ) {
4156 RBin * b = as -> arch -> binb .bin ;
42- RBinPlugin * plugin = b -> cur && b -> cur -> bo ? b -> cur -> bo -> plugin : NULL ;
43- bool is_pyc = (plugin && strcmp (plugin -> meta .name , "pyc" ) == 0 );
44- return is_pyc ? b -> cur -> bo -> bin_obj : NULL ;
57+ RBinPlugin * plugin = R_UNWRAP4 (b , cur , bo , plugin );
58+ const bool is_pyc = (plugin && !strcmp (plugin -> meta .name , "pyc" ));
59+ RBinPycObj * pyc = is_pyc ? b -> cur -> bo -> bin_obj : NULL ;
60+ return pyc ? pyc -> cobjs : NULL ;
4561}
4662
4763static inline pyc_code_object * get_func (ut64 pc , RList * pyobj ) {
Original file line number Diff line number Diff line change 66#include <r_util.h>
77#include <r_asm.h>
88
9+ #include "../../bin/format/pyc/pyc_magic.h"
910#include "opcode.h"
1011
1112typedef struct {
Original file line number Diff line number Diff line change 1- /* radare - LGPL3 - Copyright 2016-2020 - c0riolis, x0urc3 */
1+ /* radare - LGPL3 - Copyright 2016-2025 - c0riolis, x0urc3 */
22
33#ifndef PYC_MAGIC_H
44#define PYC_MAGIC_H
55
66#include <r_types.h>
7+ #include <r_list.h>
78
89struct pyc_version {
910 ut32 magic ;
1011 const char * version ;
1112 const char * revision ;
1213};
14+ #if 1
15+ typedef struct {
16+ ut64 code_start_offset ;
17+ struct pyc_version version ;
18+ RList * sections_cache ; // RList<RBinSection*>
19+ RList * interned_table ; // RList<char*>
20+ RList * cobjs ; // RList<pyc_code_object*>
21+ } RBinPycObj ;
22+ #endif
1323
1424struct pyc_version get_pyc_version (ut32 magic );
1525
Original file line number Diff line number Diff line change 33#include <r_bin.h>
44#include "../format/pyc/pyc.h"
55
6+ #if 0
67typedef struct {
78 ut64 code_start_offset ;
89 struct pyc_version version ;
910 RList * sections_cache ; // RList<RBinSection*>
1011 RList * interned_table ; // RList<char*>
1112 RList * cobjs ; // RList<pyc_code_object*>
1213} RBinPycObj ;
14+ #endif
1315
1416static bool check (RBinFile * bf , RBuffer * b ) {
1517 if (r_buf_size (b ) > 4 ) {
You can’t perform that action at this time.
0 commit comments