Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
mlgmxyysd
Posts: 3
Joined: Wed Mar 20, 2019 12:04 am

Re: Angry Birds Classic LUA (Android)

Post by mlgmxyysd »

LolHacksRule wrote:ABClassic or other game? You have to make the game's APK debuggable, clone the APK decompiled on your computer, fake Android.mk, connect your device to your computer, call NDK-GDB (from Android SDK), use breakpoints on application functions that call for loading LUA files, load a level, you should hit the breakpoint, do x/4x and x/s on the given addresses and one should give you the encryption key. The current key works fine for me, I'll try that file (and script entirely) and see if there's a problem... UPDATE: That file works fine for decryption (just delete the 9 header bytes) and open as an archive, try updating OpenSSL or use the BMS script. You can decompile with "java -jar unluac.jar level766.lua > level766_decomp.lua".

BMS script is not work, I use OpenSSL.
And, how to recompile levels to apk?
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic LUA (Android)

Post by LolHacksRule »

Not sure about LZMA repacking... Sorry. These files use LZMA compression I have no clue about, I tried to mess with them but got stuck at the loading screen... You can try reimport.bat if the filesize is smaller or if you want to risk it, use reimport2.bat on a bigger file.
mlgmxyysd
Posts: 3
Joined: Wed Mar 20, 2019 12:04 am

Re: Angry Birds Classic LUA (Android)

Post by mlgmxyysd »

LolHacksRule wrote:Not sure about LZMA repacking... Sorry. These files use LZMA compression I have no clue about, I tried to mess with them but got stuck at the loading screen... You can try reimport.bat if the filesize is smaller or if you want to risk it, use reimport2.bat on a bigger file.


I write a tool to un/repack, it must use lzma and encrypt.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic LUA (Android)

Post by LolHacksRule »

Neat.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic LUA (Android)

Post by LolHacksRule »

Will the script be updated to support decryption of ABFriends and ABStella's assets using the keys I provided? Thanks.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Angry Birds Classic LUA (Android)

Post by aluigi »

If you have new keys you can add them very easily.

Current:

Code: Select all

...
putarray 0 -1 "4FzZOae60yAmxTClzdgfcr4BAbPIgj7X"
putarray 0 -1 ""
...

New

Code: Select all

...
putarray 0 -1 "4FzZOae60yAmxTClzdgfcr4BAbPIgj7X"
putarray 0 -1 "newnewnewnewnew"
putarray 0 -1 ""
...
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic LUA (Android)

Post by LolHacksRule »

I did that, I get errors when using the script when it finds a duplicate file...
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Angry Birds Classic LUA (Android)

Post by aluigi »

duplicate files aren't a problem, just select 'a' for automatic renaming
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic LUA (Android)

Post by LolHacksRule »

Ok.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by LolHacksRule »

There's an issue with using the script on ABClassic v2.0.0's (PC?) scripts. They aren't packed in archives at all, just encrypted and compiled.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by aluigi »

LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by LolHacksRule »

Some builds of games use plaintext, unencrypted ZIPs (JSONs). Not saying any problems but it's a fact.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by LolHacksRule »

The only key we don't know is for ABFriends' CDN assets.
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by LolHacksRule »

Stupid question, how would I do it in reverse? ie: Encrypt all decrypted 7Z files using a specific key?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by aluigi »

The script is quite complex and it's an archive, not just a file->encrypt->file.
Anyway the re-encryption happens when you replace the 0 argument of Encrypt with 1, example:

Code: Select all

encryption "CipherFinal aes-256-cbc" KEY "" 1 32
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by LolHacksRule »

Thank you
LolHacksRule
Posts: 865
Joined: Fri Apr 20, 2018 12:41 am

Re: Angry Birds Classic Series: Game Assets (*.LUA, *.JSON, *.ZIP)

Post by LolHacksRule »

Late but upon adding the encryption key for Amazing Alex (m1sOWGxsS23AoseNsM5Lsp9S21YtMxks), I noticed the script skips its encrypted files. It is mostly noticeable there as that game doesn't use compression. Adding these mods at line 53 below fixes the script for those files as well as other related files.

Fix FruitNibblers:

Code: Select all

   #fixes for Nibblers
   elif TEST & "include "
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "ONTS"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "owersh"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "redits"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "aram"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit


Fix extraction of uncompiled scripts of AB:

Code: Select all

   #Fix for extraction of uncompiled lua files in AB
   elif TEST & "theme"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "heme"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "oNotW"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit


Fix Amazing Alex decryption:

Code: Select all

   #fixes for AmazingAlex
   elif TEST & "xml"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "html"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & " created"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit
   elif TEST & "plist"
        get SIZE asize MEMORY_FILE
        log NAME 0 SIZE MEMORY_FILE
        cleanexit