Jump to content

How to add android id protection to Cocos2dx game with smali code


denizdeni

7 posts in this topic

Recommended Posts

Posted

I trying to mod a apk. I created a small smali code for check device id and if id if not equal its closing the app. But its crashing instantly (not exitting). I adding these lines to OnStart function. And extra information i modding cocos2dx game.

The code:

invoke-virtual {p0}, Lorg/cocos2dx/cpp/AppActivity;->getApplicationContext()Landroid/content/Context;

move-result-object v0

invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v0

const-string v1, "android_id"

invoke-static {v0, v1}, Landroid/provider/Settings$Secure;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

move-result-object v0

const-string v1, "810b0fb3128d05bc"

if-eq v0, v1, :cond_19

const/4 v0, 0x1

invoke-static {v0}, Ljava/lang/System;->exit(I)V

:cond_19

 

Posted
.method public checkDeviceID()V
    .registers 5

    .prologue
    .line 28
    invoke-virtual {p0}, Lorg/cocos2dx/cpp/AppActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    const-string v3, "android_id"

    invoke-static {v2, v3}, Landroid/provider/Settings$Secure;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 31
    .local v0, "android_id":Ljava/lang/String;
    const-string v1, "810b0fb3128d05bc"

    .line 33
    .local v1, "b":Ljava/lang/String;
    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_19

    const-string v2, "IOSGods @Sinrason"

    const-string v3, "They are equal"

    invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 34
    :cond_19
    return-void
.end method

 

Check with this, an activity is already an instance of Context so u should be fine by calling getContentResolver directly i think.

Posted

not worked

Quote

 

.method public checkDeviceID()V
    .registers 5

    .prologue
    .line 28
    invoke-virtual {p0}, Lorg/cocos2dx/cpp/AppActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    const-string v3, "android_id"

    invoke-static {v2, v3}, Landroid/provider/Settings$Secure;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 31
    .local v0, "android_id":Ljava/lang/String;
    const-string v1, "810b0fb3128d05bc"

    .line 33
    .local v1, "b":Ljava/lang/String;
    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_19

    const-string v2, "IOSGods @Sinrason"

    const-string v3, "They are equal"

    invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 34
    :cond_19
    return-void
.end method

.method public onStart()V
    .locals 3
    
    invoke-virtual {p0}, Lorg/cocos2dx/cpp/AppActivity;->checkDeviceID()V
    

 

 

24 minutes ago, Sinrason said:

.method public checkDeviceID()V
    .registers 5

    .prologue
    .line 28
    invoke-virtual {p0}, Lorg/cocos2dx/cpp/AppActivity;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    const-string v3, "android_id"

    invoke-static {v2, v3}, Landroid/provider/Settings$Secure;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 31
    .local v0, "android_id":Ljava/lang/String;
    const-string v1, "810b0fb3128d05bc"

    .line 33
    .local v1, "b":Ljava/lang/String;
    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_19

    const-string v2, "IOSGods @Sinrason"

    const-string v3, "They are equal"

    invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 34
    :cond_19
    return-void
.end method

 

Check with this, an activity is already an instance of Context so u should be fine by calling getContentResolver directly i think.

i posted my code

Posted

wdym not work, give more info about what happens, if its still crashing then just put logs to check where it crashes, fire up cmd or from the phone terminal and type:

adb logcat -s "Testing" (if u have adb and u are in windows)

if u have a terminal in the phone just do
logcat -s "Testing"

then on the smali just put different logs like so:
 

const-string v2, "Testing"

const-string v3, "Passed first call"

invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

............. (call another function)

const-string v2, "Testing"

const-string v3, "Passed second call"

invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

then open the apk and check in the logcat what passes and what not.

 

Posted
5 hours ago, Sinrason said:

wdym not work, give more info about what happens, if its still crashing then just put logs to check where it crashes, fire up cmd or from the phone terminal and type:


adb logcat -s "Testing" (if u have adb and u are in windows)

if u have a terminal in the phone just do
logcat -s "Testing"

then on the smali just put different logs like so:
 


const-string v2, "Testing"

const-string v3, "Passed first call"

invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

............. (call another function)

const-string v2, "Testing"

const-string v3, "Passed second call"

invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

then open the apk and check in the logcat what passes and what not.

 

i figured out but i have a another issue if main package name is changed protection is not working and closing app. :(

Posted
1 hour ago, denizdeni said:

i figured out but i have a another issue if main package name is changed protection is not working and closing app. :(

Why would u change the package name? If someone tries to change it then they might not have nice intentions, just leave it to crash lol

Posted
On 3/8/2020 at 4:10 AM, Sinrason said:

Why would u change the package name? If someone tries to change it then they might not have nice intentions, just leave it to crash lol

nah i just trying to play normal game and modded game same time.

Archived

This topic is now archived and is closed to further replies.

  • Our picks

    • Eternium Cheats v1.38.22 +11
      Modded/Hacked App: Eternium By Making Fun, Inc.
      Bundle ID: com.makingfun.mageandminions
      iTunes Store Link: https://apps.apple.com/us/app/eternium/id579931356?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - 5K Gems When Completed Stage
      - Infinite Gold
      - Infinite Cosmetic
      - Infinite Yellow Stone
      - Multiply Attack (Linked with Enemy)
      - No Skills Cooldown
      - No Consumable Cooldown
      - Multiply Attack Speed
      - Instant Regen Health
      - Always Crit
      - Material Drops (When you killed an Enemy it will drop materials for crafts)



      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/194526-eternium-cheats-v13355-6/
      • 85 replies
    • Bloody Bastards Cheats v4.2.2 +2
      Modded/Hacked App: Bloody Bastards By Tibith Ltd
      Bundle ID: com.tibith.badboxing2
      iTunes Store Link: https://apps.apple.com/us/app/bloody-bastards/id1593430099?uo=4


      Hack Features:
      - Infinite Coins
      - Dumb Enemy (Single Player)


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/158327-bloody-bastards-v315-jailed-cheats-1/


      iOS Hack Download Link: https://iosgods.com/topic/158325-bloody-bastards-cheats-v315-2/
      • 159 replies
    • Westland Survival - Cowboy RPG v10.0 +7 [ Items Cheat ]
      Modded/Hacked App: Westland Survival - Cowboy RPG By HELIO LTD
      Bundle ID: com.heliogames.a1
      iTunes Store Link: https://apps.apple.com/us/app/westland-survival-cowboy-rpg/id1339238576?uo=4


      Hack Features:
      - Unlimited Energy / Instant Energy Refills
      - Unlock All Blueprints
      - Items Duplicate When Split / Items Hack
      - Unlimited Consumable Items
      - Unlimited Item Durability
      - God Mode / Never Die -> Linked with enemies. Useful for looting.
      - One Hit Kill / High Damage -> Linked with enemies. Use with caution.


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 421 replies
    • Grand Mountain Adventure 2 v1.0405 Jailed Cheats +1
      Modded/Hacked App: Grand Mountain Adventure 2 By Toppluva AB
      Bundle ID: com.toppluva.grandmountain2
      iTunes Store Link: https://apps.apple.com/us/app/grand-mountain-adventure-2/id6475040075?uo=4

       

      📌 Mod Requirements

      - Non-Jailbroken/Jailed or Jailbroken iPhone or iPad.
      - Sideloadly or alternatives.
      - Computer running Windows/macOS/Linux with iTunes installed.

       

      🤩 Hack Features

      - Free iAP (Press cancel when Buy) -- Turn on cheat option inside iOSGods Menu first

       

      ⬇️ iOS Hack Download IPA Link: https://iosgods.com/topic/192158-grand-mountain-adventure-2-v1018-jailed-cheats-1/
      • 53 replies
    • Jurassic World Alive v3.14.66 - [ Dino Don't Move & More ]
      Modded/Hacked App: Jurassic World Alive By Ludia
      Bundle ID: com.ludia.jw2
      iTunes Store Link: https://apps.apple.com/us/app/jurassic-world-alive/id1231085864


      Hack Features:
      - Dino Don't Move
      - Inf. Battery
      - VIP Enabled

      This hack is an In-Game Mod Menu (iGMM). In order to activate the Mod Menu, tap on the iOSGods button found inside the app. This hack works on the latest x64 or ARM64 iDevices: iPhone 5s, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, Xr, Xs, Xs Max, SE, iPod Touch 6G, iPad Air, Air 2, Pro & iPad Mini 2, 3, 4 and later.
      • 1,692 replies
    • Car Match - Traffic Puzzle v2.61 +4 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Car Match - Traffic Puzzle By GRAND GAMES OYUN VE YAZILIM ANONIM SIRKETI
      Bundle ID: com.grandgames.carmatch
      App Store Link: https://apps.apple.com/us/app/car-match-traffic-puzzle/id6504421808?uo=4

       
       

      🤩 Hack Features

      - Freeze Currencies
      - Unlimited Currencies -> Will increase instead of decrease.
      - Auto Win -> Quit the level.
      - Level Modifier
      • 1 reply
    • Car Match - Traffic Puzzle v2.61 +4 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Car Match - Traffic Puzzle By GRAND GAMES OYUN VE YAZILIM ANONIM SIRKETI
      Bundle ID: com.grandgames.carmatch
      App Store Link: https://apps.apple.com/us/app/car-match-traffic-puzzle/id6504421808?uo=4

       
       

      🤩 Hack Features

      - Freeze Currencies
      - Unlimited Currencies -> Will increase instead of decrease.
      - Auto Win -> Quit the level.
      - Level Modifier
      • 0 replies
    • Last War:Survival v1.0.300 [+1 Jailed Cheats]
      Modded/Hacked App: Last War:Survival By FUNFLY PTE. LTD.
      Bundle ID: com.lastwar.ios
      App Store Link: https://apps.apple.com/us/app/last-war-survival/id6448786147?uo=4



      Important


      Only work on Pve contents

      Enable on loading screen!

       

      🤩 Hack Features

      - Never Die
       
      • 17 replies
    • Last War:Survival v1.0.300 [+1 Cheats]
      Modded/Hacked App: Last War:Survival By FUNFLY PTE. LTD.
      Bundle ID: com.lastwar.ios
      App Store Link: https://apps.apple.com/us/app/last-war-survival/id6448786147?uo=4



      Important


      Only work on Pve contents

      Enable on loading screen!

       

       

      🤩 Hack Features

      - Never Die
       
      • 23 replies
    • Dawn of Ages: Medieval Games v2.0.7 +5 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Dawn of Ages: total war battle By BoomBit, Inc.
      Bundle ID: com.stratospheregames.dawnofages
      App Store Link: https://apps.apple.com/us/app/dawn-of-ages-total-war-battle/id6477473268?uo=4

       


      🤩 Hack Features

      - Damage Multiplier
      - Defence Multiplier
      - God Mode
      - Dumb Enemy
      - Premium Enabled
      • 8 replies
    • Disney Speedstorm v1.13.0 +1 Jailed Cheat [ Unlimited Nitro ]
      Modded/Hacked App: Disney Speedstorm By Gameloft
      Bundle ID: com.gameloft.disneyspeedstorm
      iTunes Store Link: https://apps.apple.com/us/app/disney-speedstorm/id6449708682?uo=4


      Hack Features:
      - Unlimited Nitro -> Will not decrease.
      - Instant Nitro Max


      Jailbreak required hack(s): [Mod Menu Hack] Disney Speedstorm v1.5.0 +2 Cheats [ Unlimited Nitro ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 85 replies
    • Disney Speedstorm v1.13.0 +1 Cheat [ Unlimited Nitro ]
      Modded/Hacked App: Disney Speedstorm By Gameloft
      Bundle ID: com.gameloft.disneyspeedstorm
      iTunes Store Link: https://apps.apple.com/us/app/disney-speedstorm/id6449708682?uo=4


      Hack Features:
      - Unlimited Nitro -> Will not decrease.
      - Instant Nitro Max


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Disney Speedstorm v1.5.0 +2 Jailed Cheats [ Unlimited Nitro ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 78 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