Skip to content

Commit 3226b83

Browse files
committed
Added QUERY_ALL_PACKAGES permission
1 parent 831a0b9 commit 3226b83

File tree

2 files changed

+12
-40
lines changed

2 files changed

+12
-40
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<manifest xmlns:tools="http://schemas.android.com/tools"
33
xmlns:android="http://schemas.android.com/apk/res/android">
44

5+
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
6+
tools:ignore="QueryAllPackagesPermission" />
7+
58
<application
69
android:allowBackup="true"
710
android:dataExtractionRules="@xml/data_extraction_rules"

app/src/main/java/com/ishacker/exploit/sub_module/MainActivity.kt

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ package com.ishacker.exploit.sub_module
22

33
import android.app.Activity
44
import android.app.AlertDialog
5-
import android.content.BroadcastReceiver
65
import android.content.ComponentName
7-
import android.content.Context
86
import android.content.Intent
97
import android.content.IntentFilter
108
import android.content.pm.PackageManager
11-
import android.os.Build
129
import android.os.Bundle
1310
import android.util.Log
1411
import android.view.LayoutInflater
@@ -17,7 +14,6 @@ import android.widget.TextView
1714
import android.widget.Toast
1815
import com.google.android.material.textfield.TextInputLayout
1916
import com.google.android.material.textfield.TextInputEditText
20-
import kotlin.reflect.typeOf
2117

2218
class 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

Comments
 (0)