安卓应用程序永久获取Root权限的方法


压缩包内有apk,demo源码,以及NDK 安装文档,主要是教你如何在已经root过得手机上只通过一次获取root权限,以后就再也不会弹出root授权框,主要思想是绕过superuser.apk的权限检查
资源截图
代码片段和文件信息
/*
**
** Copyright 2008 The Android Open Source Project
**
** Licensed under the Apache License Version 2.0 (the “License“); 
** you may not use this file except in compliance with the License. 
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing software 
** distributed under the License is distributed on an “AS IS“ BASIS 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/

#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 

#include 

#include 

#define DBPATH “/data/data/koushikdutta.superuser/databases/superuser.sqlite“

static int g_puid;

static void printRow(int argc char** argv char** azColName)
{
        int i;
        for (i = 0; i < argc; i++)
        {
                printf(“%s: %s
“ azColName[i] argv[i]);
        }
}

typedef struct whitelistCallInfo whitelistCallInfo;
struct whitelistCallInfo
{
        sqlite3* db;
        int count;
};

static int whitelistCallback(void *data int argc char **argv char **azColName)
{       
        whitelistCallInfo* callInfo = (whitelistCallInfo*)data;
        // note the count
        int count = atoi(argv[2]);
        callInfo->count = count;
        // remove whitelist entries that are expired
        if (count - 1 <= 0)
        {
                char remove[1024];
                sprintf(remove “delete from whitelist where _id=‘%s‘;“ argv[0]);
                sqlite3_exec(callInfo->db remove NULL NULL NULL);
                return 0;
        }

        char update[1024];
        sprintf(update “update whitelist set count=%d where _id=‘%s‘;“ count argv[0]);
        sqlite3_exec(callInfo->db update NULL NULL NULL);
        return 0;
}

static int checkWhitelist()
{
        sqlite3 *db;
        int rc = sqlite3_open_v2(DBPATH &db SQLITE_OPEN_READWRITE NULL);
        if (!rc)
        {
                char *errorMessage;
                char query[1024];
                sprintf(query “select * from whitelist where _id=%d limit 1;“ g_puid);
                struct whitelistCallInfo callInfo;
                callInfo.count = 0;
                callInfo.db = db;
                rc = sqlite3_exec(db query whitelistCallback &callInfo &errorMessage);
                if (rc != SQLITE_OK)
                {
                        sqlite3_close(db);
                        return 0;
                }
                sqlite3_close(db);
                return callInfo.count;
        }
        sqlite3_close(db);
        return 0;
}

static int executionFailure(char *context)
{
        fprintf

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        475  2013-07-02 01:19  Android projecthw.classpath

     文件        838  2013-07-02 01:19  Android projecthw.project

     文件        177  2013-07-02 01:19  Android projecthw.settingsorg.eclipse.jdt.core.prefs

     文件        868  2013-07-08 01:52  Android projecthwAndroidManifest.xml

     文件        868  2013-07-08 01:57  Android projecthwinAndroidManifest.xml

     文件        327  2013-07-06 14:03  Android projecthwinclassescomzlhwBuildConfig.class

     文件        799  2013-07-06 14:03  Android projecthwinclassescomzlhwMainActivity.class

     文件        313  2013-07-08 01:57  Android projecthwinclassescomzlhwR$attr.class

     文件        434  2013-07-08 01:57  Android projecthwinclassescomzlhwR$dimen.class

     文件        380  2013-07-08 01:57  Android projecthwinclassescomzlhwR$drawable.class

     文件        366  2013-07-08 01:57  Android projecthwinclassescomzlhwR$id.class

     文件        376  2013-07-08 01:57  Android projecthwinclassescomzlhwR$layout.class

     文件        361  2013-07-08 01:57  Android projecthwinclassescomzlhwR$menu.class

     文件        445  2013-07-08 01:57  Android projecthwinclassescomzlhwR$string.class

     文件        404  2013-07-08 01:57  Android projecthwinclassescomzlhwR$style.class

     文件        583  2013-07-08 01:57  Android projecthwinclassescomzlhwR.class

     文件     553996  2013-07-08 01:57  Android projecthwinclasses.dex

     文件     189231  2013-07-02 01:20  Android projecthwindexedLibsandroid-support-v4-83d8d8824461d0958dc86908bc809b50.jar

     文件     233736  2013-07-08 01:57  Android projecthwinhw.apk

     文件        120  2013-07-08 03:12  Android projecthwinjarlist.cache

     文件       5964  2013-07-02 01:19  Android projecthwin
esdrawable-hdpiic_launcher.png

     文件       3112  2013-07-02 01:19  Android projecthwin
esdrawable-mdpiic_launcher.png

     文件       9355  2013-07-02 01:19  Android projecthwin
esdrawable-xhdpiic_launcher.png

     文件      17889  2013-07-02 01:19  Android projecthwin
esdrawable-xxhdpiic_launcher.png

     文件      40773  2013-07-08 01:57  Android projecthwin
esources.ap_

     文件        151  2013-07-06 14:03  Android projecthwgencomzlhwBuildConfig.java

     文件       2484  2013-07-08 01:57  Android projecthwgencomzlhwR.java

     文件      51394  2013-07-02 01:19  Android projecthwic_launcher-web.png

     文件     484258  2013-07-02 01:19  Android projecthwlibsandroid-support-v4.jar

     文件        781  2013-07-02 01:19  Android projecthwproguard-project.txt

............此处省略460个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)