smali

How to return a static result in smali function

泄露秘密 提交于 2019-12-14 03:58:48
问题 .method public c()Ljava/lang/String; .locals 3 const/4 v1, 0x0 const-string v0, "wifi" invoke-virtual {p0, v0}, Lcom/genwen/looltv/start/Appstart;->getSystemService(Ljava/lang/String;)Ljava/lang/Object; move-result-object v0 check-cast v0, Landroid/net/wifi/WifiManager; if-nez v0, :cond_1 move-object v0, v1 :goto_0 if-eqz v0, :cond_2 invoke-virtual {v0}, Landroid/net/wifi/WifiInfo;->getMacAddress()Ljava/lang/String; move-result-object v0 if-eqz v0, :cond_0 const-string v1, ":" const-string v2

Where to put code for a global hardware key listener?

让人想犯罪 __ 提交于 2019-12-13 06:36:41
问题 I'm trying to hack hardware key support into an existing app, but came to realize I know too little of Android app development to continue. I can decompile and recompile the app without problems using APKtool, and I made a small app myself with hardware key support to pull the compiled smali code out of. For reference, that part looks like this: .method public onKeyDown(ILandroid/view/KeyEvent;)Z If I want to have the app listen for hardware keys "globally" (i.e. in every activity, window,

How to return a static result in this smali code

☆樱花仙子☆ 提交于 2019-12-12 03:26:58
问题 .method private a()Landroid/content/Intent; .locals 5 .prologue .line 297 :try_start_0 iget-object v0, p0, Lcom/myapp/c/f;->b:Lcom/myapp/context/ApplicationContext; iget-object v0, v0, Lcom/myapp/context/ApplicationContext;->o:Lcom/myapp/context/b; iget-object v0, v0, Lcom/myapp/context/b;->b:Ljava/util/List; iget v1, p0, Lcom/myapp/c/f;->c:I .line 298 invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object; move-result-object v0 check-cast v0, Lcom/myapp/data/weblink; .line 299

smali else to if modification

北慕城南 提交于 2019-12-12 02:44:48
问题 is to possible to make else to if in smali I need to modify if else state to change else to if and then delete if if(){ } else{ } to delete if(){ } and make the else become if(){} 来源: https://stackoverflow.com/questions/40585903/smali-else-to-if-modification

Smali if structure modification

こ雲淡風輕ζ 提交于 2019-12-11 21:06:41
问题 i need to modify "if statements" from smali codes to the condition will be true, in java could be something like that: if(a > b){ ..... } convert to: if(true){ ... } If is it possible to do in smali code? And have anyone idea that how should will modify this structure in smali code? Thanks a lot. 回答1: In the dalvik bytecode, the if statement will be represented as some sort of conditional jump. In this case, likely an if-le instruction (short for "if less than or equal to"). The easiest way

Increase / Use / Modify smali registers

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:54:43
问题 Background: We have a code, in which we are trying to insert some debug logs. We need two extra registers per method to enable these logs. What we have tried so far: 1) Increasing registers - Did not work as registers > v15 are breaking the code. 2) Moving v0 and v1 register values to some high value registers like v250 or something, then use v0-v1 and reassign values back from vTMP to v0-v1 - No errors but app crashes with Compile time verification error . 回答1: It sounds like you have a good

How to generate call graph from android APK?

醉酒当歌 提交于 2019-12-09 07:11:26
问题 I have downloaded a few Android applications from Google Play. I have got Smali code through reverse engineering tool apktool .I want to generate call graphs for these applications. I have seen many links on stack overflow and Google, most of the suggested tools are either for c/c++ or if they are for Java , they need source code which I don't have, of course. Is there any way to generate call graphs automatically? Thanks. 回答1: apkinspector - http://code.google.com/p/apkinspector/ The goal of

How to do localization in smali files?

孤者浪人 提交于 2019-12-08 11:00:29
问题 I have an app on forein language and I want to traslete it fully for example in the smali file I have this programming code: const-string v1, "Hello" How I can add reference to the string.xml file from this smali code? 回答1: If you need to do it in com.xxx.yyy.HomeActivity, and your localized string'id in R.java is 0x7f050000. Use the code below to replace the code const-string v1, "Hello" invoke-virtual {p0}, Lcom/xxx/yyy/HomeActivity;->getResources()Landroid/content/res/Resources; move

Changing the package name

痴心易碎 提交于 2019-12-04 14:25:29
问题 I planned to change the package name through smali(reverse) when I open up apktool.yml, I saw this forced-package-id: '127' I have tried to change it but it crash why should i do? 回答1: Assuming your goal is to rename the package name of the apk, the package names used for the classes are irrelevant. The package name of the apk is mostly unrelated to the package names of any classes in the apk. And there's no reason you need to touch the package id. I would recommend unpacking the apk with

Android odex的反编译,回编译

徘徊边缘 提交于 2019-12-03 16:30:36
现在,许多Android手机的ROM包在生成过程中都启用优化,把jar文件抽空,生成odex和vdex文件,以在运行时省掉编译时间。如果想对这些jar进行修改,就要修改它们所对应的odex文件。本文以 /system/framework/oat/arm64/am.odex 为例,讲解它的反编译和回编译过程 本文用到的工具:baksmali.jar和smali.jar 下载地址: https://bitbucket.org/JesusFreke/smali/downloads 将odex反编译 在执行反编译前,先将odex和它的依赖复制到同一目录下。如果在反编译odex的时候,没有找到依赖,就会报类似于下面的错误: Exception in thread "main" org.jf.dexlib2.DexFileFactory$DexFileNotFoundException: Could not locate the embedded dex file /system/framework/am.jar. Is the vdex file missing? at org.jf.dexlib2.dexbacked.OatFile$OatDexEntry.getDexFile(OatFile.java:586) at org.jf.dexlib2.dexbacked.OatFile