feat: scripts

This commit is contained in:
2025-04-05 16:57:26 +08:00
parent bd4fe63cdc
commit 3e996ffab3
62 changed files with 4905 additions and 0 deletions

36
scripts/decrypt.js Normal file
View File

@@ -0,0 +1,36 @@
#! /usr/bin/env runjs
requireJAR('bcprov-ext-jdk15on-154.jar');
requireJAR('crypto-1.0.jar');
var FileOutputStream = Packages.java.io.FileOutputStream;
var DecryptTool = Packages.me.hatter.tools.crypto.stream.DecryptTool;
var main = () => {
if ($ARGS.length != 3) {
xprintln('[ERROR] parameter error, decrypt.js AES_KEY FILE_NAME_ENC FILE_NAME');
return;
}
var k = __.bytes.fromHex($ARGS[0]).bytes();
var encF = $$.rFile($ARGS[1]);
var dstF = $$.rFile($ARGS[2]);
if (encF.notExists()) {
xprintln('[ERROR] Enc file not exists.');
return;
}
if (dstF.exists()) {
xprintln('[ERROR] Dest file exists.');
return;
}
var is = encF.inputStream();
var dt = new DecryptTool(is, k);
var os = dstF.outputStream();
xprintln('[INFO] Descrypt ' + encF.file() + ' -> ' + dstF.file() + ' ...');
dt.decrypt(os);
os.close();
is.close();
xprintln('[OK] Decrypt file finished.');
};
main();