ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Tue Sep 26, 2017 3:44 am

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Oct 09, 2016 7:35 pm 

Joined: Sun Oct 09, 2016 6:27 pm
Posts: 23
I have a bunch of .png files that start with 16bytes of ID string that should be removed from the result followed by 16 bytes of xored data and the rest of the file in plain format.
I managed to find the xor string but now I need help in writing the bms script to do the decryption that i plan to run using a .bat file.
Code:
for %%i in (*.ext) DO quickbms.exe -o script.bms "%%i" "%CD%\out"


Can anyone tell me what I'm missing? I prefer to learn how to do this myself than have someone give me the script but so far reading the quickbms.txt or other people scripts isn't helping.

Code:
idstring "\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**"
set KEY "0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x**"
get FSIZE asize
GoTo 16
GetDString FHEADER 16
Math FHEADER ^= KEY
get BNAME basename
string BNAME += ".png"
Math FSIZE -= 16
log BNAME 16 FSIZE


Last edited by bugmenot on Mon Oct 10, 2016 7:28 pm, edited 1 time in total.

Top
   
PostPosted: Sun Oct 09, 2016 9:33 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 6718
Try this:
Code:
# create the name
get BNAME basename
string BNAME += ".png"

# magic
idstring "\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**\x**"

# xor 16 bytes
savepos OFFSET
filexor "0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x** 0x**" OFFSET
log BNAME OFFSET 16
filexor ""

# append the rest
savepos OFFSET
math FSIZE - OFFSET
append
log BNAME OFFSET FSIZE
append


Top
   
PostPosted: Mon Oct 10, 2016 7:24 pm 

Joined: Sun Oct 09, 2016 6:27 pm
Posts: 23
aluigi wrote:
Try this:

Thanks, and feel free to post the script on you're page - after all you're the one who did the heavy lifting ;p

P.S. Is there a way to optimize the script or make it work faster?


Attachments:
mv.zip [1012 Bytes]
Downloaded 75 times
Top
   
PostPosted: Mon Oct 10, 2016 8:22 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 6718
There are no other ways to speed up the script, there are only few instructions without loops so it's fine.
I guess the slowness you have experienced is related to the calling of quickbms on every single file.

Try to use:
quickbmsexe -o -F "{}.rpgmv{}" RPGMakerMV.bms INPUT_FOLDER OUTPUT_FOLDER


Top
   
PostPosted: Sat Oct 29, 2016 8:29 pm 

Joined: Sun Oct 09, 2016 6:27 pm
Posts: 23
Unfortunately this will not keep the files sub-directory structure.


Top
   
PostPosted: Sat Oct 29, 2016 8:45 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 6718
In that case you can try one of the following two command-line options:
Code:
-d     automatically create an additional output folder with the name of the
       input folder and file processed, eg. models/mychar/mychar.arc/FILES,
       -d works also if input and output folders are the same (rename folder)

-D     similar to -d but will not create the folder with the filename
I added them some years ago just to maintain the original directory tree and they are two separate options for meeting the different needs of the users.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 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