1

After googling and trying to understand basics of smali and java, I could come up with this. Please correct me where I have gone wrong.

Original code:

.method public Start()Z
    .locals 1

    const-string v0, "ABC"

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

    invoke-direct {p0}, Lcom/battlebot/dday/SplashActivity;->init()V

    const/4 v0, 0x1

    return v0
.end method

Translated to java code:

public Boolean Start() {
         final String v0 = "ABC"; 
         java.lang.System.loadLibrary(v0);
         int v0 = 1;
        }
Mtoklitz113
  • 3,828
  • 3
  • 21
  • 40
  • 1
    No, you've left out the call to `com.battlebot.dday.SplashActivity.init()` entirely. Also, I'm not really familiar with Smali, but you've left out the `return` and I believe the `1` will be translated to `return true`. – David Conrad Sep 16 '21 at 15:27
  • Thank you for your reply. How do I add the call for com.battlebot.dday.SplashActivity.init()? Please do help. – Mtoklitz113 Sep 16 '21 at 15:31
  • How do you add it? You just... add it. How did you add the call to loadLibrary? – David Conrad Sep 16 '21 at 15:40
  • Got it. I must add the same com.battlebot.dday.SplashActivity.init() line just below java.lang.System.loadLibrary(v0);. Is it right, sir? – Mtoklitz113 Sep 16 '21 at 15:46
  • Yes, that's right. – David Conrad Sep 16 '21 at 15:47
  • Also sir, can you please help me modify the "ABC" to any other string so that it is right? Returning v0, can I write return true? – Mtoklitz113 Sep 16 '21 at 16:00
  • You can't modify "ABC" to any other string. "ABC" is the name of the library it is loading. Why would you want to change the name of the library it is loading? As for the local variables, yes, you can just write "return true," you don't need to declare a local variable. – David Conrad Sep 16 '21 at 16:05
  • Great sir. Can you also tell me how can I locate the library ABC? I want to edit its contents. – Mtoklitz113 Sep 16 '21 at 17:15
  • I have absolutely no idea. I've never heard of it before. It seems like you're decompiling an existing app?? It must exist in the APK for that app??? – David Conrad Sep 16 '21 at 17:27
  • Yes sir. I've decompiled an apk. I searched the filename but I could not find it in that folder at all. Can you tell me by the code above, the possible location ABC library sir? – Mtoklitz113 Sep 16 '21 at 18:16
  • No, I have no idea. If it isn't in the APK, maybe it is some kind of standard Android thing. – David Conrad Sep 16 '21 at 18:23
  • The return value should be a primitive bool, not a Boolean object. Z is for a primitive bool, while Ljava/lang/Boolean; would be for a Boolean object. – JesusFreke Sep 16 '21 at 18:31
  • Isn't "true" a primitive bool in java sir? Please let me know what inste3ad of "true" Imus use. Thanks. – Mtoklitz113 Sep 16 '21 at 18:39
  • Why don't you use a decompiler like [Jadx](https://github.com/skylot/jadx). Then you would get the decompiled Java code without having to have to deal with smali code. – Robert Sep 18 '21 at 15:19

0 Answers0