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

    • Idle Ninja Online v2312 Cheats +17
      Modded/Hacked App: Idle Ninja Online By Puzzle Monsters Inc.
      Bundle ID: com.puzzlemonsters.growninja
      iTunes Store Link: https://apps.apple.com/us/app/idle-ninja-online/id1559182313?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - fast farm (attack full map & hide some shuriken) 
      - no cool skill
      - no need mana
      - speed
      - wall hack
      - increase damage 
      - increase damage v2 
      - Always ultimate skill???? (not test, need tester) 
      - fast shot
      - penetration
      - multi shot
      - far FOV (in setting)
      - can move while attack 
      - reduce animation 
      - skin dame (need show damege skin in setting, from 1 to 23)
      - antiban (not sure 100%) 
        • Haha
        • Winner
      • 96 replies
    • Idle Ninja Online v2312 Cheats +17
      Modded/Hacked App: Idle Ninja Online By Puzzle Monsters Inc.
      Bundle ID: com.puzzlemonsters.growninja
      iTunes Store Link: https://apps.apple.com/us/app/idle-ninja-online/id1559182313?uo=4


      Hack Features:
      - no cool skill
      - no need mana
      - speed
      - max level
      - fast shot
      - penetration
      - multi shot
      - far FOV (in setting)
      - can move 
      - reduce animation
      - skin dame (need show damege skin in setting, from 1 to 23)
      - antiban (not sure 100%) 


      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
      • 679 replies
    • Pocket Champs PVP Racing Games Cheats v5.2.1 +2
      Modded/Hacked App: Pocket Champs: 3D Racing Games By MADBOX
      Bundle ID: com.pocketchamps.game
      iTunes Store Link: https://apps.apple.com/us/app/pocket-champs-3d-racing-games/id1542776143?uo=4


      Hack Features:
      - Free Store (not Free iAP) -- Negative value will reset to 0 on launch
      - Infinite Coins & Gems

      iOS Hack Download Link: https://iosgods.com/topic/165006-pocket-champs-3d-racing-games-cheats-v318-2/
        • Agree
        • Like
      • 161 replies
    • Idle Theme Park - Tycoon Game Cheats v6.1.1 +1
      Modded/Hacked App: Idle Theme Park - Tycoon Game by Digital Things Sociedad Limitada
      Bundle ID: com.codigames.idle.theme.park.tycoon
      iTunes Store Link: https://apps.apple.com/us/app/idle-theme-park-tycoon-game/id1460772578?uo=4&at=1010lce4


      Hack Features:
      - Infinite Cash


      iOS Hack Download Link: https://iosgods.com/topic/116320-arm64-idle-theme-park-tycoon-game-cheats-v210-1/
        • Informative
        • Thanks
        • Winner
        • Like
      • 531 replies
    • Gran Saga Idle:KNIGHTSxKNIGHTS Cheats v1.18.0 +2
      Modded/Hacked App: Gran Saga Idle:KNIGHTSxKNIGHTS By Kakao Games Corp.
      Bundle ID: com.piedpixels.gransagaidle
      iTunes Store Link: https://apps.apple.com/us/app/gran-saga-idle-knightsxknights/id6482985104?uo=4


      Hack Features:
      - Multiply Attack
      - Multiply Defense


      iOS Hack Download Link: https://iosgods.com/topic/182761-gran-saga-idleknightsxknights-cheats-v101-2/
        • Agree
        • Winner
      • 225 replies
    • Toram Online v4.0.51 - [ Custom Move Speed & More ]
      Modded/Hacked App: Toram Online By ASOBIMO,Inc.
      Bundle ID: com.asobimo.toramonline
      iTunes Store Link: https://itunes.apple.com/us/app/toram-online/id988683886?mt=8&uo=4&at=1010lce4
       

      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iFile / Filza / iFunBox / iTools or any other file managers for iOS.
      - Cydia Substrate or Substitute.
      - PreferenceLoader (from Cydia or Sileo).


      Hack Features:
      - Custom Move Speed
      - God Mode 
      - Fast Attack Speed
      - Fast Cast Speed
      - Always Critical Chance
      - Never Miss Hit 
      - Mobs/Bosses Can't Avoid & Guard 
      - Quick Draw
      - Armor Break
      - Magic Wall - Stun + Full Map Hack 
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,511 replies
    • Operate Now: Hospital Cheats v1.58.5 +1
      Modded/Hacked App: Operate Now: Hospital by SPIL Games
      Bundle ID: com.spilgames.OperateNow2
      iTunes Store Link: https://itunes.apple.com/us/app/operate-now-hospital/id1136678102?mt=8&uo=4&at=1010lce4



      Hack Features:
      - Heart Reward Instead of Cash


      Hack Download Link: https://iosgods.com/topic/97086-arm64-operate-now-hospital-cheats-v1312-1/
      • 279 replies
    • Slayer Legend Cheats v600.0.0 +3
      Modded/Hacked App: Slayer Legend By GEAR2
      Bundle ID: com.gear2.growslayer
      iTunes Store Link: https://apps.apple.com/us/app/slayer-legend/id1635712706?uo=4


      Hack Features:
      - Multiply Attack
      - Multiply Defense
      - Freeze Currencies


      iOS Hack Download Link: https://iosgods.com/topic/186299-slayer-legend-cheats-v50084-3/
        • Like
      • 55 replies
    • Immortal Rising Cheats v2.4.7 +4
      Modded/Hacked App: Immortal Rising By MOBIRIX
      Bundle ID: com.badbeans.DarkIdle
      iTunes Store Link: https://apps.apple.com/us/app/immortal-rising/id1588863558?uo=4


      Hack Features:
      - God Mode
      - One Hit Kill
      - PREMIUM
      - Freeze Currencies*

      *Abuse = Ban


      iOS Hack Download Link: https://iosgods.com/topic/178921-immortal-rising-cheats-v222-4/
        • Winner
        • Like
      • 159 replies
    • Demon Squad: Idle RPG Cheats v1.60 +2
      Modded/Hacked App: Demon Squad: Idle RPG By SuperPlanet corp.
      Bundle ID: com.superplanet.demonsquad
      iTunes Store Link: https://apps.apple.com/us/app/demon-squad-idle-rpg/id6504470907?uo=4


      Hack Features:
      - Multiply Attack
      - Multiply Defense


      iOS Hack Download Link: https://iosgods.com/topic/185576-demon-squad-idle-rpg-cheats-v139-2/
      • 67 replies
    • Delusion: Tactical Idle RPG Cheats v2.0.4 +3
      Modded/Hacked App: Delusion: Tactical Idle RPG By SuperPlanet corp.
      Bundle ID: com.superplanet.delusion
      iTunes Store Link: https://apps.apple.com/us/app/delusion-tactical-idle-rpg/id6496342351?uo=4


      Hack Features:
      - Multiply Attack
      - God Mode
      - Freeze Currencies

      NOTE: Do not abuse or buy ViP just for this cheats


      iOS Hack Download Link: https://iosgods.com/topic/183614-delusion-tactical-idle-rpg-cheats-v1027-3/
      • 53 replies
    • Candy Crush Saga Cheats v1.291.0 +2
      Modded/Hacked App: Candy Crush Saga By King
      Bundle ID: com.midasplayer.apps.candycrushsaga
      iTunes Store Link: https://itunes.apple.com/us/app/candy-crush-saga/id553834731?mt=8&uo=4&at=1010lce4




      Hack Features:
      - Infinite Life (Turn on when you running out of life)
      - Infinite Booster (Won't subtract when use)
       

      Hack Download Link: https://iosgods.com/topic/72296-arm64-candy-crush-saga-cheats-v11330-2-iosgods-exclusive/


      Credits:
      - @Laxus
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 4,749 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