Table of Contents
1. Foreword
2. Make apk
3. Decompile
4. Test results
Home Operation and Maintenance Safety How to perform APK simple code injection

How to perform APK simple code injection

May 14, 2023 am 11:43 AM
apk

1. Foreword

The smail file is obtained by decompiling the apk without encryption. Just inject the code that needs to be injected. Then seal and sign it!

2. Make apk

Use android studio to generate a simple apk. Just use the default code.

package com.example.myapplication1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
Copy after login

After generating the apk, run the apk.

How to perform APK simple code injection

3. Decompile

1. Open the androimanifest.xml file and find the android:name followed by the class under activity.

How to perform APK simple code injection

#2. Use np manager to decompile and obtain the smail file.

How to perform APK simple code injection

The content of the file is as above. We need to find the onCreate function, which is a function called to create the page. Then we can paste the code we want to inject before return-void. The injected code is a pop-up prompt. The prompt word is test. Its smail code is

const-string v0, "test"
const/4 v1, 0x0
invoke-static {p0, v0, v1}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v0
invoke-virtual {v0}, Landroid/widget/Toast;->show()V
Copy after login

. After filling in the smail, the format is as follows:

How to perform APK simple code injection

The inserted method is a complete method. Need line plus 1. At the same time, the pop-up window is a component and needs to be registered

How to perform APK simple code injection

and change 3 to 4. After modification, just save the overall code

How to perform APK simple code injection. Automatically compile signatures.

4. Test results

Compile, sign and install.

How to perform APK simple code injection

Successful pop-up window.

The above is the detailed content of How to perform APK simple code injection. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to Conduct Authorized APK Penetration Testing How to Conduct Authorized APK Penetration Testing May 20, 2023 pm 12:29 PM

How to Conduct Authorized APK Penetration Testing

Google app beta APK teardown reveals new extensions coming to Gemini AI assistant Google app beta APK teardown reveals new extensions coming to Gemini AI assistant Jul 30, 2024 pm 01:06 PM

Google app beta APK teardown reveals new extensions coming to Gemini AI assistant

How to open APK files on Windows 11 How to open APK files on Windows 11 Apr 14, 2023 am 11:19 AM

How to open APK files on Windows 11

How to rename apk software How to rename apk software Dec 08, 2023 am 10:23 AM

How to rename apk software

How to grab apk network package in frida How to grab apk network package in frida May 16, 2023 pm 07:16 PM

How to grab apk network package in frida

How to encrypt Android apk released by unity How to encrypt Android apk released by unity May 13, 2023 am 11:10 AM

How to encrypt Android apk released by unity

Win11 apk installation guide Win11 apk installation guide Jan 03, 2024 pm 10:24 PM

Win11 apk installation guide

How to perform APK simple code injection How to perform APK simple code injection May 14, 2023 am 11:43 AM

How to perform APK simple code injection

See all articles