Skip to content

Instantly share code, notes, and snippets.

@tomberek
Created August 10, 2019 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomberek/54636a74ac0ab00826a3125fb3eb79b7 to your computer and use it in GitHub Desktop.
Save tomberek/54636a74ac0ab00826a3125fb3eb79b7 to your computer and use it in GitHub Desktop.
meta:
id: catar
file-extension: catar
endian: le
license: CC0-1.0
seq:
- id: header
type: ca_format
repeat: eos
types:
ca_format:
seq:
- id: header
type: ca_format_header
- id: body
type:
switch-on: header.type1
cases:
'ca_type::ca_format_entry1': ca_format_entry
'ca_type::ca_format_user1': ca_format_user
'ca_type::ca_format_group1': ca_format_group
'ca_type::ca_format_filename1': ca_format_filename
'ca_type::ca_format_payload1': ca_format_payload
'ca_type::ca_format_goodbye1': ca_format_goodbye
ca_format_goodbye:
seq:
- id: items
type: ca_format_goodbye_item
repeat: until
repeat-until: _.hash == 0x57446fa533702943
ca_format_goodbye_item:
seq:
- id: offset
type: u8
- id: size
type: u8
- id: hash
type: u8
instances:
reference:
pos: _root._io.pos - offset - _parent._parent.header.size
size: size
ca_format_payload:
seq:
- id: data
size: _parent.header.size - 16
ca_format_file:
seq:
- id: filename
type: ca_format_filename
- id: entry
type: ca_format_entry
- id: payload
type: ca_format_payload
ca_format_user:
seq:
- id: name
encoding: UTF-8
type: strz
ca_format_group:
seq:
- id: name
encoding: UTF-8
type: strz
ca_format_filename:
seq:
- id: name
encoding: UTF-8
type: strz
ca_format_entry:
seq:
- id: feature_flags
type: u8
- id: mode
type: u8
- id: flags
type: u8
- id: uid
type: u8
- id: gid
type: u8
- id: mtime
type: u8
ca_format_header:
seq:
- id: size
type: u8
- id: type2
type: u4
enum: ca_type
- id: type1
type: u4
enum: ca_type
enums:
ca_type:
0x1396fabc: ca_format_entry1
0xea5bbb51: ca_format_entry2
0xf453131a: ca_format_user1
0xaeeaccb3: ca_format_user2
0x25eb6ac9: ca_format_group1
0x69396a52: ca_format_group2
0x6dbb6ebc: ca_format_filename1
0xb3161f0b: ca_format_filename2
0x8b9e1d93: ca_format_payload1
0xd6dcffc9: ca_format_payload2
0xdfd35c5e: ca_format_goodbye1
0x8327c403: ca_format_goodbye2
0x57446fa5: ca_format_goodbye_tail1
0x33702943: ca_format_goodybe_tail2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment