cscg is loooong
This commit is contained in:
23
2026/cscg/misc/can-i-have-flag/fingerprint.py
Normal file
23
2026/cscg/misc/can-i-have-flag/fingerprint.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import struct
|
||||
|
||||
with open("digital-0.bin", "rb") as f:
|
||||
data = f.read()
|
||||
|
||||
# Skip header (already known to be mangled)
|
||||
offset = 16
|
||||
|
||||
# Try Version 0 interpretation
|
||||
v0_initial_state = struct.unpack_from('<I', data, offset)[0]
|
||||
v0_begin_time = struct.unpack_from('<d', data, offset + 4)[0]
|
||||
v0_end_time = struct.unpack_from('<d', data, offset + 12)[0]
|
||||
v0_num_trans = struct.unpack_from('<Q', data, offset + 20)[0]
|
||||
print(f"V0: init={v0_initial_state}, begin={v0_begin_time:.4f}, end={v0_end_time:.4f}, transitions={v0_num_trans}")
|
||||
|
||||
# Try Version 1 interpretation
|
||||
v1_chunk_count = struct.unpack_from('<Q', data, offset)[0]
|
||||
v1_initial_state = struct.unpack_from('<I', data, offset + 8)[0]
|
||||
v1_sample_rate = struct.unpack_from('<d', data, offset + 12)[0]
|
||||
v1_begin_time = struct.unpack_from('<d', data, offset + 20)[0]
|
||||
v1_end_time = struct.unpack_from('<d', data, offset + 28)[0]
|
||||
v1_num_trans = struct.unpack_from('<Q', data, offset + 36)[0]
|
||||
print(f"V1: chunks={v1_chunk_count}, init={v1_initial_state}, rate={v1_sample_rate:.0f}, begin={v1_begin_time:.4f}, end={v1_end_time:.4f}, transitions={v1_num_trans}")
|
||||
Reference in New Issue
Block a user