Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to inject simple code into APK

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to carry out APK simple code injection, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

I. Preface

Apk in the case of unencrypted, decompiled to get the smail file. Just inject the code that needs to be injected. Then encapsulate and sign!

2. Making 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 apk.

III. Decompilation

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

2. Use the np manager to decompile and get the smail file.

The contents of the document are as above. We need to find the onCreate function, which is a function that is called to create the page. So let's just paste the code we want to inject before return-void. The injection code is a pop-up prompt. The prompt is test. Its smail code is

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

After entering into smail, the format is as follows:

A complete method is inserted. Line plus 1 is required. At the same time, the pop-up window is a component, which needs to be registered in front.

Change 3 to 4. After the change, the whole code

Just save it. Automatically compiles signatures.

4. Test results

Compile, sign and install.

Success pop-up window.

After reading the above, do you have any further understanding of how to do APK simple code injection? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report