|
|
|
@ -21,9 +21,9 @@ import java.util.Random;
|
|
|
|
|
|
|
|
|
|
public class ShellService extends Service {
|
|
|
|
|
|
|
|
|
|
private Thread process_thread;
|
|
|
|
|
private final StringBuilder outputBuilder = new StringBuilder();
|
|
|
|
|
private final LocalBinder binder = new LocalBinder();
|
|
|
|
|
private Thread mProcessThread;
|
|
|
|
|
private final StringBuilder mOutputBuilder = new StringBuilder();
|
|
|
|
|
private final LocalBinder mBinder = new LocalBinder();
|
|
|
|
|
private final Random mGenerator = new Random();
|
|
|
|
|
|
|
|
|
|
public ShellService() {
|
|
|
|
@ -32,19 +32,19 @@ public class ShellService extends Service {
|
|
|
|
|
@Override
|
|
|
|
|
public IBinder onBind(Intent intent) {
|
|
|
|
|
// Intrinsics.checkNotNullParameter(intent, "intent");
|
|
|
|
|
return (IBinder)this.binder;
|
|
|
|
|
return (IBinder)this.mBinder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
public final String getOutput() {
|
|
|
|
|
return this.outputBuilder.toString();
|
|
|
|
|
return this.mOutputBuilder.toString();
|
|
|
|
|
// Intrinsics.checkNotNullExpressionValue(var10000, "outputBuilder.toString()");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public final void clearOutput() {
|
|
|
|
|
// StringsKt.clear(this.outputBuilder);
|
|
|
|
|
// this.outputBuilder.
|
|
|
|
|
this.outputBuilder.delete(0, outputBuilder.length());
|
|
|
|
|
this.mOutputBuilder.delete(0, mOutputBuilder.length());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public final int getRandomNumber() {
|
|
|
|
@ -54,13 +54,13 @@ public class ShellService extends Service {
|
|
|
|
|
|
|
|
|
|
public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
|
|
|
|
|
String filename = "";
|
|
|
|
|
if (this.process_thread != null) {
|
|
|
|
|
if (this.mProcessThread != null) {
|
|
|
|
|
Log.w("adx", "process isn't null,service won't start");
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)"process isn't null,service won't start", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return Service.START_NOT_STICKY;
|
|
|
|
|
} else if (intent != null) {
|
|
|
|
|
Bundle var10000 = intent.getExtras();
|
|
|
|
|
Object var8 = var10000 != null ? var10000.get("filename") : null;
|
|
|
|
|
Bundle extras = intent.getExtras();
|
|
|
|
|
Object var8 = extras != null ? extras.get("filename") : null;
|
|
|
|
|
if (var8 == null) {
|
|
|
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
|
|
|
|
|
} else {
|
|
|
|
@ -102,16 +102,15 @@ public class ShellService extends Service {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onDestroy() {
|
|
|
|
|
Thread var10000 = this.process_thread;
|
|
|
|
|
if (var10000 != null) {
|
|
|
|
|
var10000.interrupt();
|
|
|
|
|
if (mProcessThread != null) {
|
|
|
|
|
mProcessThread.interrupt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)"已关闭frp服务", 0).show();
|
|
|
|
|
Toast.makeText((Context)this, (CharSequence)"已关闭frp服务", Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final void runCommand(String command, String[] envp, File dir) {
|
|
|
|
|
this.process_thread = new ShellThread(command, envp, dir, new ShellThread.Function1() {
|
|
|
|
|
mProcessThread = new ShellThread(command, envp, dir, new ShellThread.Function1() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object invoke(Object var1) {
|
|
|
|
@ -122,28 +121,29 @@ public class ShellService extends Service {
|
|
|
|
|
|
|
|
|
|
public final void invoke(@NotNull String it) {
|
|
|
|
|
// Intrinsics.checkNotNullParameter(it, "it");
|
|
|
|
|
ShellService.this.outputBuilder.append(it + "\n");
|
|
|
|
|
ShellService.this.mOutputBuilder.append(it + "\n");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Thread var10000 = this.process_thread;
|
|
|
|
|
if (var10000 != null) {
|
|
|
|
|
var10000.start();
|
|
|
|
|
|
|
|
|
|
if (mProcessThread != null) {
|
|
|
|
|
mProcessThread.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final Notification showMotification() {
|
|
|
|
|
Intent var2 = new Intent((Context)this, MainActivity.class);
|
|
|
|
|
Intent intent = new Intent((Context)this, MainActivity.class);
|
|
|
|
|
boolean var4 = false;
|
|
|
|
|
PendingIntent var10000 = PendingIntent.getActivity((Context)this, 0, var2, PendingIntent.FLAG_IMMUTABLE);
|
|
|
|
|
PendingIntent pendingIntent = PendingIntent.getActivity((Context)this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
|
|
|
|
|
// Intrinsics.checkNotNullExpressionValue(var10000, "Intent(this, MainActivit…_IMMUTABLE)\n }");
|
|
|
|
|
PendingIntent pendingIntent = var10000;
|
|
|
|
|
Notification.Builder var5 = (new Notification.Builder((Context)this, "shell_bg")).setSmallIcon(R.drawable.ic_launcher_foreground).setContentTitle((CharSequence)"frp后台服务").setContentText((CharSequence)"已启动frp").setContentIntent(pendingIntent);
|
|
|
|
|
Notification.Builder notificationBuilder = new Notification.Builder((Context)this, "shell_bg");
|
|
|
|
|
notificationBuilder.setSmallIcon(R.drawable.ic_launcher_foreground).
|
|
|
|
|
setContentTitle((CharSequence)"frp后台服务").
|
|
|
|
|
setContentText((CharSequence)"已启动frp").
|
|
|
|
|
setContentIntent(pendingIntent);
|
|
|
|
|
// Intrinsics.checkNotNullExpressionValue(var5, "NotificationCompat.Build…tentIntent(pendingIntent)");
|
|
|
|
|
Notification.Builder notification = var5;
|
|
|
|
|
Notification var6 = notification.build();
|
|
|
|
|
return notificationBuilder.build();
|
|
|
|
|
// Intrinsics.checkNotNullExpressionValue(var6, "notification.build()");
|
|
|
|
|
return var6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public final class LocalBinder extends Binder implements IBinder {
|
|
|
|
|