#.json opening as binary?

46 messages · Page 1 of 1 (latest)

sick gulchBOT
#

@clever sun

Braille Uploaded Some Code

im not familiar with javascript really, but i was under the impression that .json's literally couldnt do binary at all. ive run this file through every converter, decoder, and translator i can find but nothing is able to make any sense of it. i read an obscure post from 2017 where someone had a similar issue involving a null character but this doesnt appear to be the case. can anyone smarter than me help me decode this into a regular .json thats readable?

Uploaded these files to a Gist
silver perch
#

Where on earth did you get that?

clever sun
#

its a save file for a game

#

im trying to convert it from the android version of it to the pc version of it

#

but to do that i need to be able to actually see it as a normal .json

#

sorry im screwing up the uploads here didnt mean to make a mess

frail shoal
#

I feel like the game is just using json as a file format to save custom encoded content

clever sun
#

the only thing i can think is that its compressed, or being used as something other than a json to store text data. right now im converting it to hex to see if i can find a compression file signiture

frail shoal
#

What game is it?

clever sun
#

20 minutes until dawn

#

the pc version just stores saves as a human readable json, which makes me think they probably didnt create a bunch of custom stuff for the mobile port but honestly im too much of a scrub to really know

frail shoal
#

Converting to hexadecimal gives the header of 57 b0 which isn't a file signature that I'm aware of

clever sun
#

yeah i just hit that wall myself

#

the developer has been inactive for months so its not like hed be likely to respond if i asked him directly

#

if its just compressed to binary and has a library converting it back for use, what are the odds that ill be able to decode it?

frail shoal
#

I mean, you'd have to figure out what the encoding/compression is first

#

Then figure out if it's reversed stuff, or not, and what the offsets are

#

For example, here's the offsets/name data for Elden Ring saves:
name1 = data[0x1901D0E : 0x1901D0E + 32].decode("utf-16").strip('\x00')

clever sun
#

i mean, most likely the file reads out to something like {"points":7143,"characterUnlocks":{"unlocks":[true,false,false,false,false,true,false,false,false,false,false]},"gunUnlocks":{"unlocks":[false,true,false,false,false,false,false]},"runeUnlocks":{"unlocks":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"swordRuneSelections":[-1,-1,-1,-1],"shieldRuneSelections":[-1,-1,-1,-1],"difficultyUnlocked":0,"characterHighestClear":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"gunHighestClear":[-1,-1,-1,-1,-1,-1,-1,-1],"playedGame":true,"checkedRunes":true}

#

the variables would be a little different, but the overall format and names should be the same

frail shoal
#

Hmm

{ in binary is 01111011

clever sun
#

in utf8?

frail shoal
#

Yeah

clever sun
#

:O

#

it became readable!

#

with a null character between every letter, but i can regex tht away

frail shoal
#

You got it readable?

clever sun
#

youre a genius, we are badass movie hackers

#

yeah i just converted binary to a string and cut out the 0101

#

i had been getting outputs saying there was an uneven number of binary digits but i never could figure out where they were, i suppose i should have looked at the top first

#

hang on let me clean it up and ill post the output

#

{"points":1388,"difficultyUnlocked":2,"achieveFinish":[0,5,6],"LastUseHero":101,"LsatUseGun":202,"nextAdRefreshTime":1675836000,"watchUnlockHeroCount":10,"watchUnlockGunCount":10,"watchUnlockDailyGiftCount":0,"TrialCouponsCount":0,"RebirthCouponsCount":0,"AdGetTrialCouponsCount":10,"AdGetRebirthCouponsCount":10,"DailyFreeRebirh":1,"RuneOnSelect":[2006,2001,2007],"SaveRuneDatas":[{"AssetsId":1001,"Lv":0},{"AssetsId":1002,"Lv":0},{"AssetsId":1003,"Lv":0},{"AssetsId":1004,"Lv":0},{"AssetsId":1005,"Lv":0},{"AssetsId":1006,"Lv":0},{"AssetsId":1007,"Lv":0},{"AssetsId":1008,"Lv":0},{"AssetsId":1009,"Lv":0},{"AssetsId":1010,"Lv":0},{"AssetsId":1011,"Lv":0},{"AssetsId":1012,"Lv":0},{"AssetsId":2001,"Lv":5},{"AssetsId":2002,"Lv":0},{"AssetsId":2003,"Lv":5},{"AssetsId":2004,"Lv":0},{"AssetsId":2005,"Lv":0},{"AssetsId":2006,"Lv":5},{"AssetsId":2007,"Lv":3},{"AssetsId":2008,"Lv":0},{"AssetsId":2009,"Lv":0},{"AssetsId":2010,"Lv":0},{"AssetsId":2011,"Lv":0},{"AssetsId":2012,"Lv":0}],"AssetsUnlocks":[206,106,203,102,202,104,201,205,204,107,103,105,101,207],"GHDiffClearDatas":[{"AssetsId":207,"DiffLv":-1},{"AssetsId":202,"DiffLv":1},{"AssetsId":204,"DiffLv":-1},{"AssetsId":203,"DiffLv":-1},{"AssetsId":201,"DiffLv":-1},{"AssetsId":205,"DiffLv":-1},{"AssetsId":206,"DiffLv":0},{"AssetsId":208,"DiffLv":-1},{"AssetsId":102,"DiffLv":0},{"AssetsId":105,"DiffLv":-1},{"AssetsId":103,"DiffLv":-1},{"AssetsId":107,"DiffLv":-1},{"AssetsId":104,"DiffLv":1},{"AssetsId":101,"DiffLv":-1},{"AssetsId":106,"DiffLv":-1},{"AssetsId":108,"DiffLv":-1},{"AssetsId":109,"DiffLv":-1}],"shopIds":[],"adNums":[],"curMapId":0,"curBulletId":0,"curWingId":0,"winCount":0}

frail shoal
#

There you go, heh

#

So it's zeropadded to 12 digits

#

With a 0101 custom lead

clever sun
#

no idea what that means :D

frail shoal
#

11111111 -> Zeropadded to 12 -> 000011111111

clever sun
#

oh i see what youre saying

#

well cool, thanks so much

#

that was a fun little puzzle, wouldnt have solved it withoutcha

frail shoal
#

Oh nvm it was literally just a 0101 leader

clever sun
#

i wonder what problem that solved for the developer

#

maybe he just obfuscated editing the save since you can fuck with ads and p2w stuff

frail shoal
#

Prob trying to enforce non-editable save files

clever sun
#

i thought maybe that at first but i figured it wasnt that since the pc saves are plaintext, but i just realized it has like premium currency and ad mechanics on android