takeshixx / redstar-tools

Tools for Red Star OS (붉은별)
361 stars 35 forks source link

Add python 2 tools to extract watermarks, generate a hosts watermark,… #4

Open dfj opened 8 years ago

dfj commented 8 years ago

… and add README

takeshixx commented 8 years ago

Thanks for the pull request @dfj. However, the wm_decrypt.py script is already compatible with Python 2, so I think a dedicated Python 2 version of the script would make no sense. If you encounter any problems with the script feel free to send pull requests for it or open an issue. I've changed the shebang interpreter to just "python".

Unfortunately there are some errors in the pull request. The major one is the format of the watermarks:

[24 byte watermark a]..[24 byte watermark n][1 byte checksum][6 byte EOF mark]

The right format would look like this:

[24 byte watermark a]..[24 byte watermark n][4 byte length][3 byte EOF mark]

The EOF sequence is just the three ASCII chars "EOF". The 4 Bytes before that denote the total length of all watermarks (only the watermarks, without the length itself and the "EOF" string) as a 4 Byte little endian integer. So this will allow roughly 178956970 (2**32/24) watermarks to be included in this format.

In regards to the proper format, the wm_gen.py script also works with the wrong watermark format. However, I think a script that extracts/generates the serial in the watermark from a Red Star instance would be a handy tool to check where a watermark is coming from. But I would have to have a further look in the opprc binary to see how it exactly generates the watermark.

dfj commented 8 years ago

Thanks for the great feedback! Hopefully I've now got it in a better state to merge.