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

    • Nonstop Knight 2 Cheats v3.3.0 +7 [ God Mode & More ]
      Modded/Hacked App: Nonstop Knight 2 - Action RPG By Flaregames GmbH
      Bundle ID: com.koplagames.kopla02
      iTunes Store Link: https://apps.apple.com/us/app/nonstop-knight-2-action-rpg/id1444887980?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

      - God Mode
      - One Hit Kill
      - Custom Move Speed
      - Custom Attack Speed
      - Custom Attack Range
      - Instant Skill
      - Infinite MP

       

      Non-Jailbroken Hack: https://iosgods.com/topic/99785-nonstop-knight-2-v323-jailed-cheats-2/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/99783-nonstop-knight-2-cheats-v324-7-god-mode-more/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,610 replies
    • MARVEL Contest of Champions v52.1.0 +11++ Amazing Cheats!
      Modded/Hacked App: MARVEL Contest of Champions By Kabam
      Bundle ID: com.kabam.marvelbattle
      iTunes Link: https://itunes.apple.com/us/app/marvel-contest-of-champions/id896112560?mt=8&uo=4&at=1010lce4


      Hack Features
      - Enemy/AI Doesn't Attack
      - Special Attack/Skill Always Available
      - No Knockbacks When Hit
      - No Knockdowns When Hit
      - Enemy Doesn't Block
      - Auto Win - Whoever Attacks first, loses. Disable AI Doesn't Attack for this to work.
      - One Hit Kill / High Damage - Linked. Attack first or use with Enemy Doesn't Attack.

      Non-Jailbroken version of this hack: https://iosgods.com/topic/44075-marvel-contest-of-champions-v1311-2-cheats-for-jailed-devices/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 3,522 replies
    • Ultimate Golf! v4.23.01 +1 Jailed Cheat [ Perfect Shot ]
      Modded/Hacked App: Ultimate Golf! By Miniclip.com
      Bundle ID: com.hypgames.ultimategolf
      iTunes Store Link: https://apps.apple.com/us/app/ultimate-golf/id1475163222
       

      Hack Features:
      - Perfect Shot -> Every ball hit will go straight.


      Jailbreak required hack(s): [Mod Menu Hack] Ultimate Golf! v4.4.3 +1 Cheat [ Perfect Shot ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 182 replies
    • Ultimate Golf! v4.23.01 +1 Cheat [ Perfect Shot ]
      Modded/Hacked App: Ultimate Golf! By Miniclip.com
      Bundle ID: com.hypgames.ultimategolf
      iTunes Store Link: https://apps.apple.com/us/app/ultimate-golf/id1475163222


      Hack Features:
      - Perfect Shot -> Every ball hit will go straight.


      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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 298 replies
    • Creatures of the Deep v2.93 +6 Jailed Cheats [ VIP + More ]
      Modded/Hacked App: Creatures of the Deep By Infinite Dreams
      Bundle ID: pl.idreams.cotd
      iTunes Store Link: https://apps.apple.com/us/app/creatures-of-the-deep/id1556204048?uo=4


      Hack Features:
      - VIP
      - Alpha User
      - Free Lottery Spin
      - 100 Inventory Size
      - Negative Upgrade Cost
      - 0 Upgrade Cost


      Jailbreak required hack(s): [Mod Menu Hack] Creatures of the Deep v2.33 +6 Cheats [ VIP + More ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 105 replies
    • Creatures of the Deep v2.93 +6 Cheats [ VIP + More ]
      Modded/Hacked App: Creatures of the Deep By Infinite Dreams
      Bundle ID: pl.idreams.cotd
      iTunes Store Link: https://apps.apple.com/us/app/creatures-of-the-deep/id1556204048?uo=4


      Hack Features:
      - VIP
      - Alpha User
      - Free Lottery Spin
      - 100 Inventory Size
      - Negative Upgrade Cost
      - 0 Upgrade Cost


      Non-Jailbroken & No Jailbreak required hack(s): [IPA Mod Menu] Creatures of the Deep v2.33 +6 Jailed Cheats [ VIP + More ] - 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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 40 replies
    • eFootball™ v10.0.1 +3 Cheats [ Dumb AI ]
      Modded/Hacked App: eFootball™ 2023 By KONAMI
      Bundle ID: jp.konami.pesactionmobile
      iTunes Store Link: https://apps.apple.com/us/app/efootball-2023/id1117270703


      Hack Features:
      - Dumb ai 50% 99% (use either one)
      - No pass (turn off when enemy kick)
      - No catch (dumb goalie)


      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/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 617 replies
    • Barbie™ Merge Mystery v54 +3 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Barbie™ Merge Mystery By Rollic Games Oyun Yazilim ve Pazarlama Anonim Sirketi
      Bundle ID: com.rollic.barbiemerge
      iTunes Store Link: https://apps.apple.com/ph/app/barbie-merge-mystery/id6736395270?uo=4

       


      🤩 Hack Features

      - Unlimited Coins -> Earn or spend some.
      - Unlimited Gems -> Earn or spend some.
      - Unlimited Energy -> Earn or spend some.
        • Thanks
        • Like
      • 6 replies
    • Adorable Garden v1.2.3 +1++ Jailed Cheat [ Unlimited Currencies ]
      Modded/Hacked App: Adorable Garden By Skyborne Games Inc
      Bundle ID: com.skybornegames.adorablegarden
      iTunes Store Link: https://apps.apple.com/us/app/adorable-garden/id6503631437?uo=4

       


      🤩 Hack Features

      - Freeze Currencies
        • Informative
        • Haha
        • Thanks
        • Like
      • 4 replies
    • Adorable Garden v1.2.3 +1++ Cheat [ Unlimited Currencies ]
      Modded/Hacked App: Adorable Garden By Skyborne Games Inc
      Bundle ID: com.skybornegames.adorablegarden
      iTunes Store Link: https://apps.apple.com/us/app/adorable-garden/id6503631437?uo=4

       
       

      🤩 Hack Features

      - Freeze Currencies
        • Informative
        • Winner
      • 2 replies
    • Barbie™ Merge Mystery v54 +3 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Barbie™ Merge Mystery By Rollic Games Oyun Yazilim ve Pazarlama Anonim Sirketi
      Bundle ID: com.rollic.barbiemerge
      iTunes Store Link: https://apps.apple.com/ph/app/barbie-merge-mystery/id6736395270?uo=4

       
       

      🤩 Hack Features

      - Unlimited Coins -> Earn or spend some.
      - Unlimited Gems -> Earn or spend some.
      - Unlimited Energy -> Earn or spend some.
        • Like
      • 4 replies
    • Grimguard Tactics: Fantasy RPG v1.17.1 +3 Jailed Cheats [ Auto Win ]
      Modded/Hacked App: Grimguard Tactics: Fantasy RPG By Outerdawn Limited
      Bundle ID: com.outerdawn.grimguard
      iTunes Store Link: https://apps.apple.com/us/app/grimguard-tactics-fantasy-rpg/id1496893856?uo=4


      Hack Features:
      - Auto Win
      - Unlimited Daily Rewards
      - No Stamina Cost


      Jailbreak required hack(s): [Mod Menu Hack] Grimguard Tactics: Fantasy RPG v1.1.10 +3 Cheats [ Auto Win ] - ViP 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/
        • Agree
        • Like
      • 131 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