Encrypted heightmap

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
praetorian1980
Posts: 7
Joined: Thu Apr 23, 2020 1:10 pm

Encrypted heightmap

Post by praetorian1980 »

I would like to ask for help extracting and reimporting map files. I know that the map format inside the encrypted file is in (jp2) as can be seen from the header or metadata inside the file but other than that I have no idea where to start.

Thanks
Last edited by praetorian1980 on Thu Apr 23, 2020 7:14 pm, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Encrypted heightmap

Post by aluigi »

Better to upload the original file.
praetorian1980
Posts: 7
Joined: Thu Apr 23, 2020 1:10 pm

Re: Encrypted heightmap

Post by praetorian1980 »

Attached.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Encrypted heightmap

Post by aluigi »

Just for dumping the jp2:

Code: Select all

findloc OFFSET binary "jP  "
math OFFSET - 8
goto OFFSET
get SIZE long
savepos OFFSET
get NAME basename
string NAME + ".jp2"
log NAME OFFSET SIZE

I don't know if other hgt files have more files inside, if you have a bigger hgt I can check it.
praetorian1980
Posts: 7
Joined: Thu Apr 23, 2020 1:10 pm

Re: Encrypted heightmap

Post by praetorian1980 »

aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Encrypted heightmap

Post by aluigi »

Same format so it's ok to use the script.
praetorian1980
Posts: 7
Joined: Thu Apr 23, 2020 1:10 pm

Re: Encrypted heightmap

Post by praetorian1980 »

aluigi wrote:Same format so it's ok to use the script.


Do you mean this code that you posted earlier?

findloc OFFSET binary "jP "
math OFFSET - 8
goto OFFSET
get SIZE long
savepos OFFSET
get NAME basename
string NAME + ".jp2"
log NAME OFFSET SIZE


Is it possible to reimport back into the hgt?
praetorian1980
Posts: 7
Joined: Thu Apr 23, 2020 1:10 pm

Re: Encrypted heightmap

Post by praetorian1980 »

In the zip there is also a ter file. Are you able to extract its contents?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Encrypted heightmap

Post by aluigi »

I don't know what type of file is that.
It starts with "version" and I guess it's related to "terrain"
praetorian1980
Posts: 7
Joined: Thu Apr 23, 2020 1:10 pm

Re: Encrypted heightmap

Post by praetorian1980 »

I think that the hgt are imported using a codec called jasper, but I don't know how to build it from github.
praetorian1980
Posts: 7
Joined: Thu Apr 23, 2020 1:10 pm

Re: Encrypted heightmap

Post by praetorian1980 »

I have one question:

I tried comparing a file generated from xnconvert which uses jasper jp2 codecs, with the that hgt file, but I can't decypher what's written in the header. I think, from what I saw, that the hgt file is just a regular jp2 image exported from a jasper codec app in a particular export setting and has a header added to it with information that appears to be, among other things, georeference for the map. If only I could understand what's written in there, I could manually edit the header of new images exported with this codec. Please help.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Encrypted heightmap

Post by aluigi »

There are various 32bit fields in the header and I'm not sure what they mean.