Code: Select all
package com.ishacker.android.cmdreceiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Objects;
public class CmdReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String Cmd = intent.getStringExtra("Cmd");
try {
Process process = Runtime.getRuntime().exec(Cmd);
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
int read;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((read = reader.read(buffer)) > 0) {
output.append(buffer, 0, read);
}
reader.close();
process.waitFor();
if (!Objects.equals(intent.getStringExtra("App"), "yes")) {
Toast.makeText(context, output.toString(), Toast.LENGTH_LONG).show();
}
else {
// Code to handle what happens when it is launched using intent.putExtra("App","yes")
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
Code: Select all
< /code>
Dies ist der Befehl, mit dem ich ausgestrahlt wurde: < /p>
am broadcast com.ishacker.android.cmdreceiver/.CmdReceiver --es Cmd "whoami"
Mobile version