RED HAT
DIIDevHeads IoT Integration Server
•Created by electro_coco on 8/16/2024 in #code-review
How can I recover binary data from the INTDATA file using the provided C structure?
@electro_coco Start by writing a function to
read
the INTDATA
file and convert the hex-ASCII
data back into binary
. This will give you the raw data blocks that match the flashdata
structure, once you have the binary
data, you’ll need to parse
it into flashdata
structures. For each block
, check the filename_id
. If it’s not 0002
, discard
the block, next, validate
the block by checking data_length
. If data_length
is greater than 2048-14
, discard
the block, for valid blocks
, extract the data records
using the number_records
and data_length
fields. You’ll need to carefully parse the <length
>, <flags
>, <len2
>, and <data
> fields from the data array.10 replies