Exemplo n.º 1
0
  public static void initCore() throws DaemonException, SuException {

    if (mCoreInitialized) return;

    String socket_path = getCorePath() + "/cSploitd.sock";

    if (!Client.isConnected()) {
      if (!Client.Connect(socket_path)) {
        startCoreDaemon();
        if (!Client.Connect(socket_path))
          throw new DaemonException("cannot connect to core daemon");
      }
    }

    if (!Client.isAuthenticated() && !Client.Login("android", "DEADBEEF")) {
      throw new DaemonException("cannot login to core daemon");
    }

    if (!Client.LoadHandlers()) {
      throw new DaemonException("cannot load handlers");
    }

    ChildManager.storeHandlers();

    reloadTools();

    mCoreInitialized = true;
  }
Exemplo n.º 2
0
  /** shutdown the core daemon */
  public static void shutdownCoreDaemon() {
    if (!Client.isConnected() && !Client.Connect(getCorePath() + "/cSploitd.sock")) {
      return; // daemon is not running
    }
    if (!Client.isAuthenticated() && !Client.Login("android", "DEADBEEF")) {
      Logger.error("cannot login to daemon");
    }
    Client.Shutdown();
    Client.Disconnect();

    mInitialized = false;
  }