ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Fri Aug 17, 2018 11:47 am

All times are UTC




Post new topic  Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Sun Feb 04, 2018 12:26 pm 

Joined: Sun Feb 04, 2018 12:04 pm
Posts: 6
Hi guys, I would like to modify my car's firmware.
I just want to modify the GPS voice instructions for my car, changing a .txt file where I think there are all the commands from where the TTS read all the voice directions.
OK. Inside the firmware files, there are a lot of .bin files, renaming them to .tar.gz I can see what is inside of most of them and I have found in one of them a .txt file what seem to be all the voice directions. So far so good.

That doesn't seem to me the right way to unpack a .bin file and later on I don't know how to repack it again. I have a research on the internet and I have found your great tool to unpack and repack files.

Now my problem is to find a proper script to use with quickbms. I have check with HxD editor and the first lines are like this
1F 8B 08 00 00 00 00 00 04 00 EC BD
Which after a little research again it seems to be a gzip file, which makes sense that changing the extension to .tar.gz I am able to see the content
I have tried to use this script from your web http://aluigi.altervista.org/bms/_gzip.bms but it doesn't do anything. It only copies my .bin file to the output folder.
Any idea how could I unpack and repack this .bin file?

If you guys need any more info, please just ask!!!


Top
   
PostPosted: Sun Feb 04, 2018 1:21 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8613
That pattern is for sure a gzip header with 2 bytes of deflate compressed data.
It's strange that the gzip decompressor in quickbms gives an error, upload the file and I will check what's wrong.
Maybe it's a fake header, don't know.


Top
   
PostPosted: Sun Feb 04, 2018 2:30 pm 

Joined: Sun Feb 04, 2018 12:04 pm
Posts: 6
It doesn't give me an error exactly, quickbms simply copy the input file into the output folder. but the program doesn't decompress the .bin file

Please have a look at the file attached.

As I said if I rename the .bin file to .tar.gz I can open an see the content of the file, but It doesn't seem to me the proper way to unpack the file, and later on I wouldn't know how to repack the file again.
If I could do it with your program if think it would be perfect


Attachments:
File comment: .bin firmware file
sd_dir.bin [3.82 MiB]
Downloaded 35 times
Top
   
PostPosted: Sun Feb 04, 2018 2:59 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8613
Honestly here the script perfectly decompresses the bin, and yes the bin is a tgz indeed and you can clearly extract all its files without any problem.
So you don't need a script, extract the tgz and re-tgz it again when you have finished your editing by using tar.
They are also known file formats like shared libraries, pvr and so on.

Am I missing something or what? :)

*edit* ah if you are on Windows tar is available on cygwin but I guess many archiving software like 7-zip support the creation of tar, for gzipping it you can use gzip or a script like "comtype gzip_compress ; get SIZE asize ; clog output.bin 0 SIZE SIZE"


Top
   
PostPosted: Sun Feb 04, 2018 3:43 pm 

Joined: Sun Feb 04, 2018 12:04 pm
Posts: 6
I don't know why it worked for you but not for me with quickbms. I will try again.
Which script did you use?

I can try to do it on Ubuntu on VMWare or with the installation disc
Wichi one would the full command to repack using tar? I don't know too much about Linux. But at the end of the process I will have a .tar file. Can I just rename it to .bin?

Thanks so much for your patience!!


Top
   
PostPosted: Sun Feb 04, 2018 4:37 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8613
The same _gzip.bms you used, the resulting file is over 10Mb while the original is less than 4Mb.

Anyway do the following.
Rename sd_dir.bin as sd_dir.bin.tgz
Open sd_dir.bin.tgz with 7-zip (I suggest 7-zip simply because it's open source and quite diffused, maybe you already have it, any other tool is ok) or use this script.
Extract the whole content in a new folder, they are about 432 files.
Check and edit the files you desire.
Now reuse 7-zip to create a tar archive, probably you can do it just by selecting the whole content of the folder (5 folders in your case) and selecting "7-zip->Add to archive", then select "tar" as archive format.
Then use the following script on the generated tar file:
Code:
comtype gzip_compress
get SIZE asize
clog sd_dir.bin 0 SIZE SIZE
That's all.


Top
   
PostPosted: Sun Feb 04, 2018 4:52 pm 

Joined: Sun Feb 04, 2018 12:04 pm
Posts: 6
Thank you SO SO much mate.
But you are gonna kill me

I understand everything, rename the file, extract the content, edit it and recompress again... I have no problem with that
and I guess that the final script that you have written is to equal the sizes of both files because one of them is about 4mb and the edited one is about 10mb.

But how can I use that script? I have to create a bms file and use it with quickbms.
This would be the command? > quickbms c:\yourscrpt.bms c:\fileafterediting.bin c:\final\sd_dir.bin

I am going to check the script that you have just sent me, try to edit it with the final script and save it and try to use it with quickbms

Thank you SO SO much and pardon me for my stubbornness


Top
   
PostPosted: Sun Feb 04, 2018 6:13 pm 

Joined: Sun Feb 04, 2018 12:04 pm
Posts: 6
I have done it but the final file is not exactly the same size as the original one. but It might work

I don't want to take advantage of you mate, but you could help me with another related thing...
NOw I have to check and change the crc to make a .bin valid for the firmwae, in order to avoid errors at the flashing time.
next to the .bin file there is another file with the same name but with the extension .bin.inf which contains the following data
CRC32: -1944217546
SIZE: 10638006
SIZE_1: 10923008
SIZE_2: 11333632
SIZE_4: 12124160
SIZE_8: 13762560
SIZE_16: 17121280
SIZE_32: 23986176

crc32 value I will have to edit it with the new crc value. But, what are all of these size values? and how can I figure out the new values ?


Top
   
PostPosted: Mon Feb 05, 2018 7:04 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8613
Regarding the script, even if you already solved it, it's just a text file so create a new text file, copy&paste those 3 lines and that's all. You don't even need to rename the txt file as bms.
Then you can launch quickbms with double-click or using it from the command-line as you did.
The alternative is using gzip, I tought that a quickbms script would have been easier, sorry :)

I'm not sure about what are those "SIZE" fields refer to because they don't match the size of sd_dir.bin or those of the files in it or the uncompressed sd_dir.bin or anything else.

Instead CRC32 matches and it's just the classic crc (0x77073096 polynomial) of sd_dir.bin, you can calculate it with hashcalc or any other checksum calculator existent.
Then convert the hex crc32 into decimal


Top
   
PostPosted: Mon Feb 05, 2018 8:54 am 

Joined: Sun Feb 04, 2018 12:04 pm
Posts: 6
Thank you SO much Aluigi. I do appreciate it.

I already did all the script thing, I even renamed it as .bms to use it (now I know that I can even use that script with a .txt file)

The only thing is that the file sizes don't match. Don't know why I thought that at the end the files sizes would match. but it is OK it is not a big deal

Thank you again!!!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 10 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited