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); } }
After generating the apk, run the apk.
3. Decompile
1. Open the androimanifest.xml file and find the android:name followed by the class under activity.
#2. Use np manager to decompile and obtain the smail file.
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
. After filling in the smail, the format is as follows:
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
and change 3 to 4. After modification, just save the overall code
. Automatically compile signatures.
4. Test results
Compile, sign and install.
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.