laingame-net / lain_artbook_code

27 stars 4 forks source link

Add bruteforce script, got clear image & valid hqx #3

Closed h5vx closed 3 years ago

h5vx commented 3 years ago

Good news, everyone!

I wrote cool hqx bruteforce script and found 12 correct hqx inputs, but only 3 of them decoding to valid JPEG image. Sadly, binhex have only 2 bytes for CRC checksum, so there is many collisions. At least now we can filter for valid candidates asciicast

What have been done

  1. Mark important JPEG sections and add line numbers on rotated scan 2
  2. Fix innocent.jpg.hqx code (mostly scandata) in live-reloading environment => got clear image
  3. Add bruteforce script and it's self-documenting config file
  4. Add 3 valid hqx that produces valid jpeg

Result

innocent corrupted

TODO

How to setup live-reloading environment

Using entr and sxiv, you can setup live environment and instantly see image changes while editing binhex

Following instructions is for linux, I don't know how to do that on windows (should be easy, I guess)

  1. Use following command to automatically update JPEG when innocent.jpg.hqx is changed
    echo raw_files/innocent.jpg.hqx | entr -sr "scripts/decode.py raw_files/innocent.jpg.hqx raw_files/innocent.corrupted.jpg"
  2. Open the image via sxiv, it will reload image automatically. Optionally, you can run it in while loop, so if sxiv fails to open image, it will still trying to open it. In sxiv, set gamma to -30 by pressing { key to see bad blocks.
    while true; do sxiv raw_files/innocent.corrupted.jpg -z 300 -G -30 -b; done
  3. If you use vim, I recommend to use autosave plugin
mutr commented 3 years ago

So we have not only one image but many!?