Jump to content

6 posts in this topic

Recommended Posts

Posted

Intro:
There's a bunch of tries to to decrypting lua but none of it isnt clear enough how to do it. I'm aware that this approach isnt good enough, because too much step that you'll not need to do but i'm still write it instead. Code in this tutorial ofcourse just bunch of copy-pasta stackoverflow.

Prerequisites
1. Frida (optional)
2. Disassembler (IDA, r2, ..)
3. Python (optional) (I'll use python in this tutorial)
4. A little knowledge about this

What will you need to do?
1. Get the KEY for decryption,
2. Write a script for decryption,
3. Edit the lua (Self explanation),
4. Encrypt back the file (Self explaination) (Same as step 2, but you'll encrypt instead of decrypt),
5. PROFIT.

---- Step by step ----

Get the KEY for decryption
There's bunch of way to do it, some of them:
1. XREFS for XXTeaLuaLoader::setXXTeaKey(string), and you can see it clearly. Most used methods among many games.
nJX33Yr.png
2. Use Frida. I'll explain it on 2nd post.
3. http://forum.xda-developers.com/showthread.php?p=12853986#post12853986
4. etc.. You get the idea.

Write a script for decryption
This is an example of use for XXTEA encryption, requirements(xxtea-py)

 
Code (Text):





#!/usr/bin/env python
import xxtea

chiper = open("assets/script/fund.lua", "rb").read()

out = open("out.lua", "wb")

key = b'mrgj'

out.write(xxtea.encrypt(chiper, key))

out.close()END

Example of use of frida (https://github.com/antojoseph/frida-android-hooks)

As described here, 

Opening the lua files with hex editor reveals that they use XXTEA block cipher.

Analyze libjinqu.so and it blatantly shows the following decryption subroutines:
xxtea_decrypt
cocos2d::extra::CCCrypto::decryptXXTEA

Get a pseudocode generator and copy the program in C++.

. We need to put a hook either at xxtea_decrypt or cocos2d::extra::CCCrypto::decryptXXTEA. Then prints out the arguments passed.
We know that args[2] is the one holding the pointer to key from decompile xxtea_decrypt lib.so
Oh5SCFC.png 
Explaination, v9 is the one holding the chiper text, v30 chipertext len(?), v13 pointer to key, v14 is key.length.
Its obvious if we want to leak the key we need to print args[3] bytes at args[2]. This is an example of use for it.

 

#!/usr/bin/env python
import frida
import sys

package_name = "com.gamebau.pq"

def get_messages_from_js(message, data):
            print(message)

jsc = """
Interceptor.attach (Module.findExportByName( "libgame.so", "xxtea_decrypt"), {
    onEnter: function (args) {
        console.log("----------------BEGIN----------------");
        console.log(hexdump(Memory.readByteArray(args[2], 12),{
         offset: 0,
         length: 12,
         header: true,
         ansi: true
        }));
    },
    onLeave: function (retval) {
        console.log("Decrypt:");
        console.log(hexdump(Memory.readByteArray(retval, 16),{
         offset: 0,
         length: 16,
         header: true,
         ansi: true
        }));
        console.log("-----------------END-----------------");   
    }
});
"""

process = frida.get_usb_device().attach(package_name)
script = process.create_script(jsc)
script.on('message',get_messages_from_js)
script.load()
sys.stdin.read()

profit,
gohBm09.png
 
--Update, forgot to mention about this. Another note, some games tries to pack the assets with common file compressor. While loading it, it tries to unpack the assets on stream. As you can see on the image, its PK file header. With simple google search you can deduce its a zip alike compression. Try to extract the decrypted file with 7zip/Winrar/etc.. and you could see the unpacked file.

Image:
gohBm09.png
 
 
Credits: Wobm And Stack Overflow

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Our picks

    • Card Train v1.1.1 [ +7 APK MOD ] Currency Max
      Mod APK Game Name: Card Train
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=com.kazrahann.cardtrain&ref

      🤩 Hack Features

      - Enough Cube
      - Enough Gems
      - Unlimited Coins
      - Mana Freeze
      - HP Max
      - HP Freeze
      - ATK Max
        • Thanks
      • 1 reply
    • Mini Soccer Star 2026 +7 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Mini Soccer Star 2026 By VIVA GAMES S.L.
      Bundle ID: com.touch2goal.soccer
      App Store Link: https://apps.apple.com/us/app/mini-soccer-star-2026/id1636072966?uo=4

       


      🤩 Hack Features

      - Unlimited Coins -> Earn or spend some.
      - Unlimited Gems -> Earn or spend some.
      - Unlimited Energy -> Earn or spend some.
      - Unlimited Tokens -> Earn or spend some.
      - Unlimited Skip Tickets -> Earn or spend some.
      -- VIP
      -- No Ads
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 213 replies
    • Card Train v1.1.1 [ +7 Cheats ] Currency Max
      Modded/Hacked App: Card Train By Jinwoo Kim
      Bundle ID: com.kazrahann.cardtrain
      App Store Link: https://apps.apple.com/ph/app/card-train/id6773644764?uo=4

      🤩 Hack Features

      - Enough Cube
      - Enough Gems
      - Unlimited Coins
      - Mana Freeze
      - HP Max
      - HP Freeze
      - ATK Max
        • Like
      • 1 reply
    • Card Train v1.1.1 [ +7 Jailed ] Currency Max
      Modded/Hacked App: Card Train By Jinwoo Kim
      Bundle ID: com.kazrahann.cardtrain
      App Store Link: https://apps.apple.com/ph/app/card-train/id6773644764?uo=4

      🤩 Hack Features

      - Enough Cube
      - Enough Gems
      - Unlimited Coins
      - Mana Freeze
      - HP Max
      - HP Freeze
      - ATK Max
        • Like
      • 0 replies
    • Search It - Hidden Objects v1.2.8 [ +3 Cheats ] Currency Max
      Modded/Hacked App: Search It - Hidden Objects By LEAP BILISIM TEKNOLOJILERI VE YAZILIM TICARET ANONIM SIRKETI
      Bundle ID: com.leap.searchit
      App Store Link: https://apps.apple.com/us/app/search-it-hidden-objects/id6756185760?uo=4

      🤩 Hack Features

      - Auto ADS NO
      - Unlimited Coins
      - Booster Freeze
      • 2 replies
    • Search It - Hidden Objects v1.2.8 [ +3 Jailed ] Currency Max
      Modded/Hacked App: Search It - Hidden Objects By LEAP BILISIM TEKNOLOJILERI VE YAZILIM TICARET ANONIM SIRKETI
      Bundle ID: com.leap.searchit
      App Store Link: https://apps.apple.com/us/app/search-it-hidden-objects/id6756185760?uo=4

      🤩 Hack Features

      - Auto ADS NO
      - Unlimited Coins
      - Booster Freeze
        • Like
      • 1 reply
    • Pop Island: Match & Build v2.0.5 [ +1 APK MOD ] Currency Max
      Mod APK Game Name: Pop Island: Match & Build
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=com.hmbdgames.popisland&hl=en_ZA

      🤩 Hack Features

      - Unlimited Coins
      • 1 reply
    • Yarn Fever! Unravel Puzzle v16.7 [ +3 APK MOD ] Booster Max
      Mod APK Game Name: Yarn Fever! Unravel Puzzle
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=puzzle.yarn.fever.unravel.puzzle&hl=en

      🤩 Hack Features

      - Unlimited Slots
      - Unlimited Booster
      - Lives / 0 Play Unlimited
      • 0 replies
    • Beauty Sort : Makeover Story v1.7.6 [ +4 APK MOD ] Currency Max
      Mod APK Game Name: Beauty Sort : Makeover Story
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=com.beauty.love.sort.match.stylist.story&hl=en

      🤩 Hack Features

      - Unlimited Gems
      - Unlimited Booster
      - Unlimited Lives
      - Coins NO Need For Task
      • 0 replies
    • Olympush v0.0.12 [ +5 Cheats ] Currency Max
      Modded/Hacked App: Olympush By Arcane Blast s.r.o.
      Bundle ID: com.ArcaneBlast.Olympush
      App Store Link: https://apps.apple.com/us/app/olympush/id6762312452?uo=4

      🤩 Hack Features

      - Unlimited Gold
      - Enough Parts / Upgrade Hero
      - Mana Freeze
      - Unlimited Trop Deploy / iGG Auto Touch Use / Always Win
      - AI Freeze
        • Like
      • 1 reply
    • Olympush v0.0.12 [ +5 Jailed ] Currency Max
      Modded/Hacked App: Olympush By Arcane Blast s.r.o.
      Bundle ID: com.ArcaneBlast.Olympush
      App Store Link: https://apps.apple.com/us/app/olympush/id6762312452?uo=4

      🤩 Hack Features

      - Unlimited Gold
      - Enough Parts / Upgrade Hero
      - Mana Freeze
      - Unlimited Trop Deploy / iGG Auto Touch Use / Always Win
      - AI Freeze
        • Like
      • 1 reply
    • North War: Island Defense 3D v1.2.2 [ +3 APK MOD ] Currency Max
      Mod APK Game Name: North War: Island Defense 3D
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=com.bgg.island.battle&hl=en

       

      🤩 Hack Features

      - ADS NO / Rewards Free
      - Unlimited Currency
      - Unlimited Resources

       

      ⬇️ Android Mod APK Download Link


      Hidden Content

      iOSGods App for Android







       

      📖 Android Installation Instructions

      STEP 1: Download the modded APK file from the link above using your preferred Android browser or download manager.
      STEP 2: Once the download is complete, open your file manager and locate the downloaded .apk file (usually in the Downloads folder).
      STEP 3: Tap the APK file, then select Install. If prompted, enable Install from Unknown Sources in your device settings.
      STEP 3A: If the mod includes an OBB file, extract it if it’s inside an archive. Then move the folder to: /Android/obb/
      STEP 3B: If the mod includes a DATA file, extract it if it’s archived. Then move the folder to: /Android/data/
      STEP 4: Once installed, open the game and toggle your desired cheats & features through the APK mod menu. Enjoy!

       

      NOTE: If you have any questions or issues, read our Frequently Asked Questions topic. If you still need help, post your issue below and we’ll assist you as soon as possible. If the mod works for you, please share your feedback to help other members!

       

      🙌 Credits

      - IK_IK

       

      📷 Cheat Video/Screenshots

      N/A

       

       iOS & iPadOS App Hacks
      If you’re looking for Non-Jailbroken & No Jailbreak required iOS IPA hacks, visit the iOS Game Cheats & Hacks or the iOSGods App for a variety of modded games and apps for non-jailbroken iOS devices.
        • Agree
        • Thanks
        • Like
      • 2 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines