@@ -2,13 +2,10 @@ package com.ishacker.exploit.sub_module
22
33import android.app.Activity
44import android.app.AlertDialog
5- import android.content.BroadcastReceiver
65import android.content.ComponentName
7- import android.content.Context
86import android.content.Intent
97import android.content.IntentFilter
108import android.content.pm.PackageManager
11- import android.os.Build
129import android.os.Bundle
1310import android.util.Log
1411import android.view.LayoutInflater
@@ -17,7 +14,6 @@ import android.widget.TextView
1714import android.widget.Toast
1815import com.google.android.material.textfield.TextInputLayout
1916import com.google.android.material.textfield.TextInputEditText
20- import kotlin.reflect.typeOf
2117
2218class MainActivity : Activity () {
2319 private var pkgName = " "
@@ -127,43 +123,16 @@ private fun checkPatch() {
127123 pkgName = editText.text.toString()
128124 }
129125 sendCmdBroadcast()
130- if (Build .VERSION .SDK_INT <= Build .VERSION_CODES .P ) {
131- try {
132- val componentName = ComponentName (pkgName, pkgName + " .CmdReceiver" )
133- val receiverInfo = packageManager.getReceiverInfo(componentName, 0 )
134- Log .d(" CmdExecutor" , " BroadcastReceiver exists: ${receiverInfo.name} " )
135- } catch (e: PackageManager .NameNotFoundException ) {
136- showDialogNotFound()
137- Log .e(" CmdExecutor" , e.toString())
138- }
139- }
140- else {
141- val filter = IntentFilter ()
142- filter.addAction(" android.intent.action.MAIN" )
143- val cmdIntent = Intent ()
144- cmdIntent.setComponent(
145- ComponentName (
146- pkgName,
147- pkgName + " .CmdReceiver"
148- )
149- )
150- cmdIntent.flags = Intent .FLAG_RECEIVER_FOREGROUND
151- cmdIntent.flags = Intent .FLAG_INCLUDE_STOPPED_PACKAGES
152- cmdIntent.putExtra(" App" , 1 )
153- cmdIntent.putExtra(" isTestCmd" , true )
154- cmdIntent.putExtra(" isOrderedBroadcast" , true )
155- sendOrderedBroadcast(cmdIntent, null , object : BroadcastReceiver () {
156- override fun onReceive (context : Context ? , intent : Intent ? ) {
157- val result = getResultCode()
158- val resultData = getResultData()
159- if (result == - 1 && resultData == " ReceiverFound" ) {
160- Log .d(" CmdExecutor" , " BroadcastReceiver exists: CmdReceiver" )
161- } else {
162- showDialogNotFound()
163- }
164- }
165- }, null , Activity .RESULT_CANCELED , null , null )
126+
127+ try {
128+ val componentName = ComponentName (pkgName, pkgName + " .CmdReceiver" )
129+ val receiverInfo = packageManager.getReceiverInfo(componentName, 0 )
130+ Log .d(" CmdExecutor" , " BroadcastReceiver exists: ${receiverInfo.name} " )
131+ } catch (e: PackageManager .NameNotFoundException ) {
132+ showDialogNotFound()
133+ Log .e(" CmdExecutor" , e.toString())
166134 }
135+
167136 Toast .makeText(this , " Entered package name: " + pkgName, Toast .LENGTH_SHORT ).show()
168137 }
169138
0 commit comments