dissect.cstruct_legacy
dissect.cstruct_legacy copied to clipboard
A no-nonsense c-like structure parsing library for Python
``` struct some_struct { uint8 field_1; char field_2[2][SOME_CONSTANT]; char field_3[field_1 & 1 * 5]; // Some random expression to calculate array length Example field_4[2]; }; ``` char field_2 **[2]**[SOME_CONSTANT]; 
When the total size of the bitfields exceeds a type definition (such as the defined uint16 but the actual consecutively defined bitfields exceed 16 bits), or the fields are not...
The offset doesn't seem to change when a child structure is used, e.g. from the sample code in the README this is generated: ``` {'name': 'field_1', 'type': uint8, 'bits': None,...
Here is a simple struct with bitfields: ``` struct relocation_info { uint32 r_address; uint32 r_symbolname:24; uint32 r_pcrel:1; uint32 r_length:2; uint32 r_extern:1; uint32 r_type:4; } ``` After parsing (`result = cparser.relocation_info(data)`),...
Null termination removed. #10
stdint.h
Hi, Thanks for this project. Looks good for our purpose. Would be great to support types from stdint.h like uint8_t, int8_t, ... by default without adding them manually, or support...
When a char is passed a size of 0, the colors in the hex output do not come out correctly. Structure example: typedef struct _Quarantine_File_Info { char Header[7]; byte Data_Type1;...
Now: a = cparse.myEnum.e() will assign value of e into a. reference #14
e.g.: a = cparse.myEnum.e willl assign myEnum.e string into a.