lico-n / ZygiskUnityCriwareKeylogger

Extracts CriWare encryption keys for Unity games via Zygisk.
MIT License
23 stars 4 forks source link

No CriwareKey for hca files is logged while opening Blue Archive app in Bilibili server #1

Closed ljgit428 closed 11 months ago

ljgit428 commented 11 months ago

@lico-n The story scenario voicelines for Blue Archive in Bilibili are stored as files of .acb and .awb extensions. After I extracted them, they are encoded .hca files, and I need to find the key code to extract the wav files. After using ZygiskUnityCriwareKeylogger in Nox, I can only see the app is initialized, but there is no key logged with command adb logcat -s ZygiskUnityCriwareKeylogger. Here is the screen shot for the log I have. Snipaste_2023-11-02_07-39-49

The Magisk version I use is Magisk Delta 25306. I cannot install Magius app of any other versions with Zygisk working on Nox. Any suggestions/recommendations? Snipaste_2023-11-02_07-56-39

lico-n commented 11 months ago

It's only tested with 64-bit emulators. Which nox emulator are you using? If you are using the default one, then that is 32-bit android 7 which is pretty old. Try a more up to date one with 64-bit

ljgit428 commented 11 months ago

@lico-n I try to use ldplayer9, so now I have the logs ready, but I cannot find the key. I really appreciate your timely reply.

image

I am sure that CriWareDrypterConfig initialized by CriWareDrypter class function has the field key. Snipaste_2023-11-03_18-52-58 Snipaste_2023-11-03_18-53-09

ljgit428 commented 11 months ago

You are welcomed to try this app with your own setup. I still can’t get the key code.

APP Download Link: https://pkg.biligame.com/games/ylda_1.6.1_20230725_053258_fa4ed.apk

lico-n commented 11 months ago

Most games are implementing the Initialize with 4 params (key, authenticationFile, enableAtomDecryption, enableManaDecryption).

I have not encountered a game doing the Initialize with the CriwareDecrypterConfig which is why it is also not implemented yet. I would need a sample game to test it with.

This game is not calling the Initialize with CriwareDecrypterConfig either. I justed tested it.

The one with the 4 params is called once with a 0 key but that is probably for the usm's. The one with the 1 config param is never called.

At least until the login screen where I stopped because I can't be bothered with real id verification. It is for example possible that initialization happens later, there are games that are doing per file keys etc which would mean they would initialize when the corresponding file is actually loaded.

You can try the module version below. It would log Initialize (CriWareDecrypterConfig) called if it detected such a call (without extracting the key for now). Unless confirmed that this is the case, I won't bother figuring out how to get through the bilibili login myself.

Also this module really only covers the generic encryption for Criware. If there is any custom encryption happening, then it won't be covered by this module.

ZygiskUnityCriwareKeylogger-v1.0.0-zygisk-release.zip

ljgit428 commented 11 months ago

No problem. I have a real account with bilibili login, and I’ll try it out

ljgit428 commented 11 months ago

@lico-n I also got the same 0 key while initializing CriwareDecrypter. The call Initialize (CriWareDecrypterConfig) is not detected, but I did not find a video .usm file in the app. I tried .\hca.exe -c -a 00000000 -b 00000000 sample.hca but that does not work for any of the hca files.

Snipaste_2023-11-05_06-41-10 Snipaste_2023-11-05_06-42-54

ljgit428 commented 11 months ago

@lico-n This is the screenshot where the decoder failed to decode the hca file:

`E:\collection\Azurlane\HCADecoder.v1.21>hca.exe -c -a 00000000 -b 00000000 E:\co llection\BlueArchive\test_vgmt_acb_ext_11000\awb\Main_11000_003.hca E:\collection\BlueArchive\test_vgmt_acb_ext_11000\awb\Main_11000_003.hca を復号 化中...

E:\collection\Azurlane\HCADecoder.v1.21>hca.exe E:\collection\BlueArchive\test_ vgmt_acb_ext_11000\awb\Main_11000_003.hca E:\collection\BlueArchive\test_vgmt_acb_ext_11000\awb\Main_11000_003.hca をデコ ード中... Error: デコードに失敗しました。`

Snipaste_2023-11-05_07-54-32

lico-n commented 11 months ago

Upload some samples for encrypted acb/awb?

ljgit428 commented 11 months ago

@lico-n Here is a complete version of acb/awb files: https://drive.google.com/file/d/1uae1Hin__-hw1e0ibRfj3S3CD1z91e5Z/view?usp=sharing

lico-n commented 11 months ago

The reason why you don't see any Initialize calls is because these are not encrypted.

You are probably just using a tool that has not the proper support for the file format.

Try using https://github.com/vgmstream/vgmstream or if you like to do it programatically https://github.com/Youjose/PyCriCodecs

ljgit428 commented 11 months ago

@lico-n Great! It is working using the Foobar2000 component from vgmstream(https://github.com/vgmstream/vgmstream) Thanks a lot for help!

Snipaste_2023-11-06_08-29-06