a963926907 发表于 2020-8-17 01:16:40

E4A 的核心类库JAR包

E4A 的核心类库JAR包 需要的拿去使用
图片上次不了 就不上传了
下面是系统权限操作代码
package com.e4a.runtime;
**** Hidden Message *****
import com.e4a.runtime.annotations.SimpleFunction;
import com.e4a.runtime.annotations.SimpleObject;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;


@SimpleObject
public final class Root权限操作
{
private static boolean haveRoot = false;
private static DataInputStream inputStream;
private static DataOutputStream outputStream;
private static Process process;
private static BufferedReader reader;

@SimpleFunction
public static boolean 手机是否已Root() {
    if (haveRoot == true) {
      return true;
    }
    i = 执行命令行("echo test");
    if (i != -1) {
      haveRoot = true;
    } else {
      haveRoot = false;
    }
    return haveRoot;
}

@SimpleFunction
public static String 执行命令行2(String cmd) {
    String str1 = "";
    try {
      process = Runtime.getRuntime().exec("su");
      outputStream = new DataOutputStream(process.getOutputStream());
      inputStream = new DataInputStream(process.getInputStream());
      isreader = new InputStreamReader(inputStream);
      reader = new BufferedReader(isreader);
      byte[] data1 = (cmd + "\n").getBytes();
      outputStream.write(data1);
      outputStream.flush();
      byte[] data2 = "exit\n".getBytes();
      outputStream.write(data2);
      outputStream.flush();
      String str2 = null;
      while ((str2 = reader.readLine()) != null) {
      if (!str1.equals("")) {
          str1 = str1 + "\n" + str2; continue;
      }
      str1 = str2;
      }

      process.waitFor();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (outputStream != null) {
      try {
          outputStream.close();
      } catch (IOException e2) {
          e2.printStackTrace();
      }
      }
      if (inputStream != null) {
      try {
          inputStream.close();
      } catch (IOException e3) {
          e3.printStackTrace();
      }
      }
    }
    return str1;
}

@SimpleFunction
public static String 执行命令行5(String cmd) {
    String str1 = "";
    try {
      process = Runtime.getRuntime().exec("sh");
      outputStream = new DataOutputStream(process.getOutputStream());
      inputStream = new DataInputStream(process.getInputStream());
      isreader = new InputStreamReader(inputStream);
      reader = new BufferedReader(isreader);
      byte[] data1 = (cmd + "\n").getBytes();
      outputStream.write(data1);
      outputStream.flush();
      byte[] data2 = "exit\n".getBytes();
      outputStream.write(data2);
      outputStream.flush();
      String str2 = null;
      while ((str2 = reader.readLine()) != null) {
      if (!str1.equals("")) {
          str1 = str1 + "\n" + str2; continue;
      }
      str1 = str2;
      }

      process.waitFor();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (outputStream != null) {
      try {
          outputStream.close();
      } catch (IOException e2) {
          e2.printStackTrace();
      }
      }
      if (inputStream != null) {
      try {
          inputStream.close();
      } catch (IOException e3) {
          e3.printStackTrace();
      }
      }
    }
    return str1;
}


@SimpleFunction
public static int 执行命令行(String cmd) {
    int i = -1;
    try {
      process = Runtime.getRuntime().exec("su");
      outputStream = new DataOutputStream(process.getOutputStream());
      outputStream.writeBytes(cmd + "\n");
      outputStream.flush();
      outputStream.writeBytes("exit\n");
      outputStream.flush();
      process.waitFor();
      i = process.exitValue();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (outputStream != null) {
      try {
          outputStream.close();
      } catch (IOException e2) {
          e2.printStackTrace();
      }
      }
    }
    return i;
}

@SimpleFunction
public static void 执行命令行3(String cmd) {
    try {
      if (process == null || outputStream == null) {
      process = Runtime.getRuntime().exec("su");
      outputStream = new DataOutputStream(process.getOutputStream());
      }
      outputStream.write((cmd + "\n").getBytes());
      outputStream.flush();
    } catch (Exception e) {
      e.printStackTrace();
    }
}

@SimpleFunction
public static void 模拟按键(int 键代码) {
    if (手机是否已Root() == true) {
      执行命令行3("input keyevent " + 键代码);
    }
}

@SimpleFunction
public static void 模拟输入(String 内容) {
    if (手机是否已Root() == true) {
      执行命令行3("input text '" + 内容 + "'");
    }
}

@SimpleFunction
public static void 模拟点击(int x, int y) {
    if (手机是否已Root() == true)
    {
      执行命令行3("input tap " + x + " " + y);
    }
}

@SimpleFunction
public static void 模拟移动(int x1, int y1, int x2, int y2) {
    if (手机是否已Root() == true) {
      执行命令行3("input swipe " + x1 + " " + y1 + " " + x2 + " " + y2);
    }
}

@SimpleFunction
public static String[] 取所有存储卡路径() {
    paths = new ArrayList();
    try {
      Process process = Runtime.getRuntime().exec("mount");
      InputStream is = process.getInputStream();
      InputStreamReader isr = new InputStreamReader(is);
      BufferedReader br = new BufferedReader(isr);
      String line = null;
      int mountPathIndex = 1;
      while ((line = br.readLine()) != null) {
      if ((line.contains("fat") || line.contains("fuse") || line.contains("storage")) && !line.contains("secure") && !line.contains("asec") && !line.contains("firmware") && !line.contains("shell") && !line.contains("obb") && !line.contains("legacy") && !line.contains("data")) {

          String[] parts = line.split(" ");
          int length = parts.length;
          if (mountPathIndex < length) {

            String mountPath = parts;
            if (mountPath.contains("/") && !mountPath.contains("data") && !mountPath.contains("Data"))

            { File mountRoot = new File(mountPath);
            if (mountRoot.exists() && mountRoot.isDirectory() && mountRoot.canWrite())
            {
                paths.add(mountPath); }}
          }
      }
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
    String[] result = new String;
    paths.toArray(result);
    return result;
}

@SimpleFunction
public static void 截取屏幕(String path) {
    if (手机是否已Root() == true) {
      执行命令行3("screencap " + path);
    }
}

@SimpleFunction
public static boolean 强制结束进程(String packagename) {
    int 执行结果 = -1;
    if (手机是否已Root() == true) {
      执行结果 = 执行命令行("am force-stop " + packagename);
    }
    return (执行结果 != -1);
}


@SimpleFunction
public static int 执行命令行4(String 命令行) {

    try { Process process = Runtime.getRuntime().exec(命令行);
      process.waitFor();
      return process.exitValue(); } catch (Throwable t)

    { return -1; }

}

@SimpleFunction
public static void 启动应用页面(String 包名, String 包名和activity名) { 执行命令行("am start -n " + 包名 + "/" + 包名和activity名); }
}


mmlai8 发表于 2020-8-17 07:43:29

就来看看了

ghlqw123 发表于 2020-8-17 08:53:02

看看这个是做什么的

qanjn 发表于 2020-8-17 08:56:12

看看藏了什么

vvxc 发表于 2020-8-17 09:12:22

然并卵

668899 发表于 2020-8-17 09:26:20

lishangwl 发表于 2020-8-17 09:39:25

E4A 的核心类库JAR包

881008 发表于 2020-8-17 10:25:11

E: E4A 的核心类库JAR包 [修

wwwl132 发表于 2020-8-18 20:58:07

4545566656

zqled8 发表于 2020-8-18 20:59:28

谢谢分享嘻嘻嘻
页: [1] 2 3 4 5 6 7
查看完整版本: E4A 的核心类库JAR包