Added Plugin View APK Android Permissions
This commit is contained in:
parent
7d140580ee
commit
5cbe3122e5
1 changed files with 42 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
||||||
|
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
|
||||||
|
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.api.Plugin;
|
||||||
|
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Konloch
|
||||||
|
* @since 07/11/2021
|
||||||
|
*/
|
||||||
|
public class ViewAPKAndroidPermissions extends Plugin
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void execute(ArrayList<ClassNode> classNodeList)
|
||||||
|
{
|
||||||
|
PluginConsole frame = new PluginConsole("Android Permissions");
|
||||||
|
frame.setVisible(true);
|
||||||
|
|
||||||
|
byte[] encodedAndroidManifest = BytecodeViewer.getFileContents("AndroidManifest.xml");
|
||||||
|
if(encodedAndroidManifest == null)
|
||||||
|
{
|
||||||
|
frame.appendText("This plugin only works on valid Android APKs");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] decodedAndroidManifest = BytecodeViewer.getFileContents("Decoded Resources/AndroidManifest.xml");
|
||||||
|
if(decodedAndroidManifest != null)
|
||||||
|
{
|
||||||
|
String manifest = new String(decodedAndroidManifest, StandardCharsets.UTF_8);
|
||||||
|
String[] lines = manifest.split("\r?\n");
|
||||||
|
for(String line : lines)
|
||||||
|
if(line.toLowerCase().contains("uses-permission"))
|
||||||
|
frame.appendText(line.trim());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
frame.appendText("Enable Settings>Decode APK Resources!");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue