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; }
/** 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; }