resilar / crchack

Reversing CRC for fun and profit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User-friendlier way to specify mutable bits for alphanumerical output

resilar opened this issue · comments

Proposed behavior:

  • -b 03FFFFC0@1024 selects 20 bits at position 1024
  • -b 80@30:40 selects 10 MSBs between positions 30 and 40
  • -b 2@0:-1:1 selects all bits except the first (apply at every bit position)

After implementing this, bit numbering could be changed to MSB -> LSB which is more intuitive IMO.

This AND-bitmask proposal sucks. Better approaches exist. For instance, we could expand a switch -b [59-68].[0-5] to 10 x 6 = 60 switches selecting the 6 least significant bits of 10 consecutive bytes starting at the byte position 59. This would make solving, for example, Google CTF 2018 (Quals) task "Tape, misc, 355p" much less annoying; the current solution looks like crap and is painful to write:

$ printf ': You probably just want the flag.  So here it is: CTF{dZXi__________PIUTYMI}. :' > flag
$ crchack -b 59.0:69:1 -b 59.1:69:1 -b 59.2:69:1 -b 59.3:69:1 -b 59.4:69:1 -b 59.5:69:1 -w64 -p0x42F0E1EBA9EA3693 -rR flag 0x30d498cbfb871112
: You probably just want the flag.  So here it is: CTF{dZXicOXLaMumrTPIUTYMI}. :

Instead of requiring those 6 ugly command-line -b options, we could simply accept a single one -b [59-68].[0-5] (or even -b 59.[0-5]:69:1) and expand it to achieve the same result.

I'm keeping this issue open, but changing the title.