Petschko / Java-RPG-Maker-MV-Decrypter

You can decrypt whole RPG-Maker MV Directories with this Program, it also has a GUI.
MIT License
376 stars 51 forks source link

Decryption of individual files via CLI not possible? #39

Closed RedAISkye closed 10 months ago

RedAISkye commented 2 years ago

I'm trying to decrypt only few files via CLI but even though I manually provide the encryption key, the tool wants the game directory. This is weird because it works fine for encrypting few files via CLI.

Here's the error I get:- Screenshot

Here's the code for my CLI:-

@echo off
title RPG Maker MV;MZ Decrypter ^| Command-Line Tool by RedAISkye
cls
set currentDir=%~dp0
cd /d %currentDir%
echo.
echo  RPG Maker MV;MZ Decrypter ^| Command-Line Tool by RedAISkye
echo.
echo.
echo  Enter project path: (Leave blank ^for default "%currentDir%input")
set /p projectPath=
echo.
if "%projectPath%"=="" (
    set projectPath=%currentDir%input
    echo  Enter encryption key: ^(Can't be left blank^)
) else (
    echo  Enter encryption key: ^(Leave blank ^for default "auto"^)
)
set /p encryptionKey=
if "%encryptionKey%"=="" set encryptionKey=auto
echo.
echo.
java -jar "RPG Maker MV Decrypter.jar" encrypt "%projectPath%" "%currentDir%output" true %encryptionKey%
java -jar "RPG Maker MV Decrypter.jar" decrypt "%projectPath%" "%currentDir%output" true %encryptionKey%
echo.
echo.
pause
Petschko commented 2 years ago

Hey, it seems you modified the code, please try this first with the original code.

Petschko commented 2 years ago

Also make sure, that the RPG-Maker dir you try to decrypt has the game.exe within your path, in your case: inside the "input" dir

RedAISkye commented 2 years ago

Hey, it seems you modified the code, please try this first with the original code.

The actual command isn't modified, the code uses dynamic variables so you don't need to manually edit the code in order to change directory/encryption key.

The output of the following code after user input would be: java -jar "RPG Maker MV Decrypter.jar" decrypt "D:\Program Files\RPG Maker\~Tools\RPGMaker MV Decrypter\input" "D:\Program Files\RPG Maker\~Tools\RPGMaker MV Decrypter\output" true 3b7a201a3e379fd9a7cf969ae6a4981d

Also make sure, that the RPG-Maker dir you try to decrypt has the game.exe within your path, in your case: inside the "input" dir

That's the issue, I can encrypt files individually outside the game directory fine but the same can't be done for decryption? Because, I only want to decrypt few files, not the whole game.

Petschko commented 2 years ago

It could be done without, when the encryption key is set, it seems to be an oversight from me. I should implement that

Petschko commented 1 year ago

Hey I was about to work on this issue today.

I noticed that this is already implemented~ Set the "true" value after the output dir to false - on true the decrypter want a valid RPG-Maker Dir while on false it get ignored^^

Should work like that: java -jar "RPG Maker MV Decrypter.jar" decrypt "D:\Program Files\RPG Maker\~Tools\RPGMaker MV Decrypter\input" "D:\Program Files\RPG Maker\~Tools\RPGMaker MV Decrypter\output" false 3b7a201a3e379fd9a7cf969ae6a4981d

RedAISkye commented 1 year ago

Hey I was about to work on this issue today.

I noticed that this is already implemented~ Set the "true" value after the output dir to false - on true the decrypter want a valid RPG-Maker Dir while on false it get ignored^^

You should add that info to the CLI's help message.

But, I tried that and now there's 2 issues. (Output of the code was exactly the same as yours)

  1. Encryption worked fine but it didn't set the file extension correctly: File "AoE_bartableAB.png" result was "AoEbartableAB.png" instead of "AoE_bartableAB.rpgmvp" (This is not an issue if encrypting with the value set to "true")

  2. Decryption still doesn't work, it instead throws a new error. Screenshot

Petschko commented 1 year ago

Oh its my bad, on DECRYPTING the value after the Output-Dir is to disable the verification.

App.showMessage(CMD.HELP_INDENT + "  (optional) [verifyRpgDir (false|true)]");
App.showMessage(CMD.HELP_INDENT + "                                   - Verifies if its a RPG-MV/MZ dir | Default: false");

On ENCRYPTION the value after the Output-Dir tells if the Target-Files are for RPG-Maker MV or MZ

App.showMessage(CMD.HELP_INDENT + "  (optional) [to MV (true|false)]  - Encrypts files for MV (MZ on false) | Default: true");

I wonder how we can solve this then? Maybe when an Encryption-Key is given it just ignores it by default?

RedAISkye commented 1 year ago

Oh its my bad, on DECRYPTING the value after the Output-Dir is to disable the verification.

App.showMessage(CMD.HELP_INDENT + "  (optional) [verifyRpgDir (false|true)]");
App.showMessage(CMD.HELP_INDENT + "                                   - Verifies if its a RPG-MV/MZ dir | Default: false");

On ENCRYPTION the value after the Output-Dir tells if the Target-Files are for RPG-Maker MV or MZ

App.showMessage(CMD.HELP_INDENT + "  (optional) [to MV (true|false)]  - Encrypts files for MV (MZ on false) | Default: true");

I wonder how we can solve this then? Maybe when an Encryption-Key is given it just ignores it by default?

Ah, I see.

An easy way to fix this is to simply not check the game directory by default regardless of if the encryption key is provided or not. And then add another command parameter like "validate" which will do the checking when the user wants to,

Petschko commented 1 year ago

Hm the idea behind the default validation is, that the Program doesnt run on directories which are may not RPG-Maker dirs. I had once someone, who complained that their desktop was deleted, because they set the Output-Dir to the desktop,. but had the option "clear output dir" on... I think about something, but the command like you use it should stay the same, maybe I add the option as last parameter

RedAISkye commented 1 year ago

Hm the idea behind the default validation is, that the Program doesnt run on directories which are may not RPG-Maker dirs. I had once someone, who complained that their desktop was deleted, because they set the Output-Dir to the desktop,. but had the option "clear output dir" on... I think about something, but the command like you use it should stay the same, maybe I add the option as last parameter

Oh, no, I was talking about the change exclusively for the CLI and not the GUI. But, I guess it's fine to keep it to only not check the directory when encryption is manually set.

To the other issue, I think it's necessary to show a list of all the files/folders that it finds in the "output dir" when that option is enabled before the deletion occurs so, the user must confirm first before the program proceeds with its action.

Petschko commented 1 year ago

I understand that the suggestion is for the CLI, in the GUI you have a global option to turn that off. Also I implement relative paths for the GUI and CLI, so I think its better to still keep these by default, I will add this parameter to ignore the check at the end of both commands

The other Problem is already "fixed", it shows a warning when that option is turned on (the deletion) by default its off.

Petschko commented 10 months ago

(This will be solved soon, probably in the release Tomorrow/Today)

To get updates in this Issue, look here: https://gitlab.com/Petschko/Java-RPG-Maker-MV-Decrypter/-/issues/39