Jump to content

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


7 posts in this topic

Recommended Posts

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

 

Link to comment
Share on other sites

.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.

Updated by Sinrason
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

  • Informative 1
Link to comment
Share on other sites

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. :(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below. For more information, please read our Posting Guidelines.
Reply to this topic... Posting Guidelines

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Our picks

    • Crown Rumble: Idle Kingdoms v1.5.8 +3 Cheats
      Modded/Hacked App: Crown Rumble: Idle Kingdoms By AlohaFactory
      Bundle ID: kr.co.alohacorp.idlekingdoms
      iTunes Store Link: https://apps.apple.com/us/app/crown-rumble-idle-kingdoms/id6470770555?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Damage Multiplier
      - Defense Multiplier
      - Unlimited Currencies -> Increase When Use


      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/


      iOS Hack Download Link:

      Hidden Content
      Download Hack







      Installation Instructions:
      STEP 1: Download the .deb Cydia hack file from the link above. Use Safari/Google Chrome or other iOS browsers to download.
      STEP 2: Once the file has downloaded, tap on it and then you will be prompted on whether you want to open the deb with iGameGod or copy it to Filza.
      STEP 3: If necessary, tap on the downloaded file, and then, you will need to press 'Install' from the options on your screen.
      STEP 4: Let iGameGod/Filza finish the cheat installation. Make sure it successfully installs, otherwise see the note below.
      STEP 5: If the hack is a Mod Menu — which is usually the case nowadays — the cheat features can be toggled in-game. Some cheats have options that can be enabled from your iDevice settings.
      STEP 6: Turn on the features you want and play the game. You may need to follow further instructions inside the hack's popup in-game.

       

      NOTE: If you have any questions or problems, read our Troubleshooting topic & Frequently Asked Questions & Answers topic. If you still haven't found a solution, post your issue down below and we'll do our best to help! If the hack does work for you, please post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
      • 5 replies
    • Fortias Saga: Action Adventure v1.0.39 +5 Cheats
      Modded/Hacked App: Fortias Saga: Action Adventure By ONDI TECHNOLOGY JOINT STOCK COMPANY
      Bundle ID: com.ondi.fortias.saga
      iTunes Store Link: https://apps.apple.com/us/app/fortias-saga-action-adventure/id6475805032?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Damage Multiplier
      - Defense Multiplier
      - Shards & Items Multiplier*
      - Freeze Resources
      - No Ads
      *Turn Off When You Get Enough So It Don't Go Negative


      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/


      iOS Hack Download Link:

      Hidden Content
      Download Hack







      Installation Instructions:
      STEP 1: Download the .deb Cydia hack file from the link above. Use Safari/Google Chrome or other iOS browsers to download.
      STEP 2: Once the file has downloaded, tap on it and then you will be prompted on whether you want to open the deb with iGameGod or copy it to Filza.
      STEP 3: If necessary, tap on the downloaded file, and then, you will need to press 'Install' from the options on your screen.
      STEP 4: Let iGameGod/Filza finish the cheat installation. Make sure it successfully installs, otherwise see the note below.
      STEP 5: If the hack is a Mod Menu — which is usually the case nowadays — the cheat features can be toggled in-game. Some cheats have options that can be enabled from your iDevice settings.
      STEP 6: Turn on the features you want and play the game. You may need to follow further instructions inside the hack's popup in-game.

       

      NOTE: If you have any questions or problems, read our Troubleshooting topic & Frequently Asked Questions & Answers topic. If you still haven't found a solution, post your issue down below and we'll do our best to help! If the hack does work for you, please post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
      • 91 replies
    • Astral Survivor v1.0.105 +2 Cheats
      Modded/Hacked App: Astral Survivor By Firedog Creative Company Limited
      Bundle ID: com.firedogstudio.astralsurvivor
      iTunes Store Link: https://apps.apple.com/us/app/astral-survivor/id6475716603?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Never Die
      - Unlimited Gold


      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/


      iOS Hack Download Link:

      Hidden Content
      Download Hack







      Installation Instructions:
      STEP 1: Download the .deb Cydia hack file from the link above. Use Safari/Google Chrome or other iOS browsers to download.
      STEP 2: Once the file has downloaded, tap on it and then you will be prompted on whether you want to open the deb with iGameGod or copy it to Filza.
      STEP 3: If necessary, tap on the downloaded file, and then, you will need to press 'Install' from the options on your screen.
      STEP 4: Let iGameGod/Filza finish the cheat installation. Make sure it successfully installs, otherwise see the note below.
      STEP 5: If the hack is a Mod Menu — which is usually the case nowadays — the cheat features can be toggled in-game. Some cheats have options that can be enabled from your iDevice settings.
      STEP 6: Turn on the features you want and play the game. You may need to follow further instructions inside the hack's popup in-game.

       

      NOTE: If you have any questions or problems, read our Troubleshooting topic & Frequently Asked Questions & Answers topic. If you still haven't found a solution, post your issue down below and we'll do our best to help! If the hack does work for you, please post your feedback below and help out other fellow members that are encountering issues.


      Credits:
      - AlyssaX64


      Cheat Video/Screenshots:

      N/A
      • 2 replies
    • Love Island: The Game v1.5.1 +2 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Love Island: The Game By Fusebox Games
      Bundle ID: com.fuseboxgames.loveisland2
      iTunes Store Link: https://apps.apple.com/us/app/love-island-the-game/id1522699215
       

      Hack Features:
      - Unlimited Gems -> Earn or spend some.
      - Unlimited Tickets -> Earn or spend some.


      Jailbreak required hack(s): https://iosgods.com/topic/169224-love-island-the-game-all-versions-2-cheats-unlimited-currencies/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 131 replies
    • Love Island: The Game v1.5.1 +2 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Love Island: The Game By Fusebox Games
      Bundle ID: com.fuseboxgames.loveisland2
      iTunes Store Link: https://apps.apple.com/us/app/love-island-the-game/id1522699215
       

      Hack Features:
      - Unlimited Gems -> Earn or spend some.
      - Unlimited Tickets -> Earn or spend some.


      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/
      • 41 replies
    • Grow Shooter : Survivor RPG v1.0.18 +2 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Grow Shooter : Survivor RPG By DongSik Moon
      Bundle ID: com.eastmoon.growshooterlive
      iTunes Store Link: https://apps.apple.com/us/app/grow-shooter-survivor-rpg/id6480362458?uo=4


      Hack Features:
      - Unlimited Coins -> Will not decrease.
      - Unlimited Rubies -> Will not decrease.


      Jailbreak required hack(s): [Mod Menu Hack] Grow Shooter : Survivor RPG v1.0.10 +4 Cheats [ Damage ] - 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/
      • 25 replies
    • Grow Shooter : Survivor RPG v1.0.18 +4 Cheats [ Damage ]
      Modded/Hacked App: Grow Shooter : Survivor RPG By DongSik Moon
      Bundle ID: com.eastmoon.growshooterlive
      iTunes Store Link: https://apps.apple.com/us/app/grow-shooter-survivor-rpg/id6480362458?uo=4


      Hack Features:
      - Damage Multiplier
      - Move Speed Multiplier
      - Unlimited Coins -> Will not decrease.
      - Unlimited Rubies -> Will not decrease.


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Grow Shooter : Survivor RPG v1.0.10 +2 Jailed Cheats [ Unlimited Currencies ] - 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/
      • 30 replies
    • Supermarket Manager Simulator v1.0.47 +3 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Supermarket Manager Simulator By Digital Melody S.A.
      Bundle ID: com.dmg.supermarket.simulator
      iTunes Store Link: https://apps.apple.com/us/app/supermarket-manager-simulator/id6479982512?uo=4


      Hack Features:
      - Unlimited Cash -> Will increase instead of decrease.
      - Unlimited Energy -> Will increase instead of decrease.
      - No Ads


      Jailbreak required hack(s): [Mod Menu Hack] Supermarket Manager Simulator v1.0.6 +3 Cheats [ Unlimited Currencies ] - 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/
      • 78 replies
    • Supermarket Manager Simulator v1.0.47 +3 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Supermarket Manager Simulator By Digital Melody S.A.
      Bundle ID: com.dmg.supermarket.simulator
      iTunes Store Link: https://apps.apple.com/us/app/supermarket-manager-simulator/id6479982512?uo=4


      Hack Features:
      - Unlimited Cash -> Will increase instead of decrease.
      - Unlimited Energy -> Will increase instead of decrease.
      -- No Ads


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Supermarket Manager Simulator v1.0.6 +3 Jailed Cheats [ Unlimited Currencies ] - 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/
      • 31 replies
    • Good Pizza, Great Pizza v5.13.0 +2 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Good Pizza, Great Pizza By TAPBLAZE, LLC
      Bundle ID: com.tapblaze.pizzabusiness
      iTunes Store Link: https://apps.apple.com/us/app/good-pizza-great-pizza/id911121200?uo=4


      Hack Features:
      - Unlimited Cash
      - Unlimited Diamonds


      Jailbreak required hack(s): [Mod Menu Hack] Good Pizza, Great Pizza v5.5.6 +2 Cheats [ Unlimited Currencies ] - 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/
      • 78 replies
    • Good Pizza, Great Pizza v5.13.0 +2 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Good Pizza, Great Pizza By TAPBLAZE, LLC
      Bundle ID: com.tapblaze.pizzabusiness
      iTunes Store Link: https://apps.apple.com/us/app/good-pizza-great-pizza/id911121200?uo=4


      Hack Features:
      - Unlimited Cash
      - Unlimited Diamonds


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Good Pizza, Great Pizza v5.5.6 +2 Jailed Cheats [ Unlimited Currencies ] - 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/
      • 51 replies
    • Soul Light: Idle RPG War v71 +4 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Soul Light: Idle RPG War By ACTIONFIT Ltd.
      Bundle ID: com.idle.afk.soul.light.rpg
      iTunes Store Link: https://apps.apple.com/us/app/soul-light-idle-rpg-war/id6469476819?uo=4


      Hack Features:
      - God Mode
      - Unlimited Gold -> Will increase instead of decrease.
      - Unlimited Emerald -> Will increase instead of decrease.
      - Unlimited Dungeon Keys


      Jailbreak required hack(s): [Mod Menu Hack] Soul Light: Idle RPG War v1.6.2 +4 Cheats [ Unlimited Currencies ] - 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/
      • 52 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