Skip to content

Exec Command via Brevent (Since 2.6.6)

Liu DongMiao edited this page Feb 11, 2018 · 2 revisions

Brevent contains two parts, Brevent manager, and the always working Brevent server, runs as shell, driven by event log and Brevent manager. Brefore 2.6.1, only Brevent manager has permission to access Brevent server.

Since 2.6.6, Brevent offers command to other apps. It's very simple to use it:

final String action = "me.piebridge.brevent.intent.action.COMMAND";
final String extra = "me.piebridge.brevent.intent.extra.COMMAND";
final String command = ""; // command

Intent intent = new Intent(action);
intent.putExtra(extra, command);

List<ResolveInfo> ris = getPackageManager().queryIntentActivities(intent, 0);
if (ris != null && !ris.isEmpty()) {
    startActivity(intent);
}

Brevent server runs as following:

sh
${command}
exit

It's like supersu, however, there are some restrictions:

  • & is not allowed in command (Support since 2.6.8 beta)

    & will run command in background and never return, and there is no output.

  • direct sh or su is not allowed

  • ${command} will be replaced as id if Brevent server runs as Root

  • Brevent server will kill ${command} if Brevent manager goes into background


Clone this wiki locally