免root實現 Android改機(一鍵新機)技術解密。

此篇文章僅探討Android底層技術。不提供任何軟件和安裝包……

我們通過一些底層技術對手機中的各種基礎信息進行一個修改。

舉例說明:主要修改的參數有:

Android_Id、IMEI、手機序列號、手機號碼、WIFI-MAC、WIFI-Name、安卓系統版本、ROM固件、手機號碼、手機型號、手機品牌、CPU型號、手機制造商、GPS定位、通話記錄模擬、手機短信模擬……

等各類安卓手機系統信息的修改功能。


舉例子:統改機方式,使用xposed的代碼:


HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getDeviceId", GetCatValue("imei"));
HTool.XHookMethod("com.android.internal.telephony.PhoneSubInfo",mLpp.classLoader, "getDeviceId", GetCatValue("imei"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getSubscriberId", GetCatValue("imsi"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getLine1Number", GetCatValue("number"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getSimSerialNumber", GetCatValue("simserial"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getSimCountryIso", GetCatValue("simcountryiso"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getSimOperator", GetCatValue("simoperator"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getSimOperatorName", GetCatValue("simoperatorname"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getNetworkCountryIso", GetCatValue("networkcountryiso"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getNetworkOperator", GetCatValue("networkoperator"));
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getNetworkOperatorName", GetCatValue("networkoperatorname"));
 
//WIFI信息
HTool.XHookMethod(android.net.wifi.WifiInfo.class.getName(),mLpp.classLoader, "getMacAddress", GetCatValue("wifimac"));
HTool.XHookMethod(android.net.wifi.WifiInfo.class.getName(),mLpp.classLoader, "getBSSID", GetCatValue("bssid"));
HTool.XHookMethod(android.net.wifi.WifiInfo.class.getName(),mLpp.classLoader, "getSSID", "\""+GetCatValue("ssid")+"\"");
XposedHelpers.findAndHookMethod(java.net.NetworkInterface.class.getName(),mLpp.classLoader, "getHardwareAddress", new Object[] {
        new XC_MethodHook()
        {
            protected void afterHookedMethod(MethodHookParam param) throws Throwable
            {
                //每個安卓系統中 至少存在5個以上的MAC地址 
                //但大多數軟件只修改了MAC和BSSID 
                //真正的MAC修改是在此處理函數中監聽每次訪問.
            }
        }});
         
//藍牙信息
HTool.XHookMethod(BluetoothAdapter.class.getName(),mLpp.classLoader,"getAddress", GetCatValue("bluemac"));
HTool.XHookMethod(BluetoothAdapter.class.getName(),mLpp.classLoader, "getName", GetCatValue("bluename"));
 
//設置手機信息 無論手機是否插入了sim卡 都會模擬出SIM卡的信息 APP獲得SIM卡消息時返回該手機已有SIM卡
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getPhoneType", TelephonyManager.PHONE_TYPE_GSM);
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getNetworkType", TelephonyManager.NETWORK_TYPE_HSPAP);
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "getSimState", TelephonyManager.SIM_STATE_READY);
HTool.XHookMethod(android.telephony.TelephonyManager.class.getName(),mLpp.classLoader, "hasIccCard", true);
 
     
//修改手機系統信息 此處是手機的基本信息 包括廠商 信號 ROM版本 安卓版本 主板 設備名 指紋名稱等信息
XposedHelpers.setStaticObjectField(android.os.Build.class, "MODEL", GetCatValue("model"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "MANUFACTURER", GetCatValue("manufacturer"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "BRAND", GetCatValue("brand"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "HARDWARE", GetCatValue("hardware"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "BOARD", GetCatValue("board"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "SERIAL", GetCatValue("serial"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "DEVICE", GetCatValue("device"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "ID", GetCatValue("id"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "PRODUCT", GetCatValue("product"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "DISPLAY", GetCatValue("display"));
XposedHelpers.setStaticObjectField(android.os.Build.class, "FINGERPRINT", GetCatValue("fingerprint"));
 
XposedHelpers.findAndHookMethod("android.os.SystemProperties",mLpp.classLoader, "native_get", new Object[] {String.class,String.class,
        new XC_MethodHook()
        {
            //爲了防止某些APP跳過Build類 而直接使用SystemProperties.native_get獲得參數
        }});
//修改系統版本 我看到世面上的軟件基本上都是不能修改系統版本的 從而造成了刷量後 很多渠道最終會顯示你的APP用戶全部使用的某一系統版本
//這樣的話數據就太假了.
XposedHelpers.setStaticObjectField(android.os.Build.VERSION.class, "RELEASE", GetCatValue("version"));
XposedHelpers.setStaticObjectField(android.os.Build.VERSION.class, "SDK", GetCatValue("apilevel"));
 
HTool.XHookMethod(android.os.Build.class.getName(),mLpp.classLoader, "getRadioVersion", GetCatValue("radioversion"));
 
//修改爲指定的運營商mnc mcc信息
XposedHelpers.findAndHookMethod(android.content.res.Resources.class.getName(),mLpp.classLoader, "getConfiguration", new Object[] {
        new XC_MethodHook()
        {
            ...........................
            //此處的mnc和mcc必須和系統中其他關於運營商的數據對應!
        }});
 
//修改ANDROID_ID
XposedHelpers.findAndHookMethod(android.provider.Settings.Secure.class.getName(),mLpp.classLoader, "getString",
new Object[] {ContentResolver.class,String.class,
        new XC_MethodHook()
        {
            ...............................
            //此處會根據傳入的String參數 判斷返回值 其中包括比較關鍵的數據就是android_id
        }});
 
//防止APP使用Runtime.exec方式獲取一些特定的系統屬性
XposedHelpers.findAndHookMethod(Runtime.class.getName(),mLpp.classLoader, "exec",new Object[] {String.class,String[].class, File.class,
        new XC_MethodHook()
        {
            //一些APP從JAVA層獲得到了數據 還會從shell(native)層獲得一些更底層的數據 來判斷用戶的合法性
            //經常用到的有 cat、getprop、ifconfig等等命令,當exec執行這些命令後 往往會返回一些手機的真實信息
            //因爲框架和處理方式不同,...部分此處根據自己需求,編寫重定向返回值的過程...
        }});
 
//修改位置信息
XposedHelpers.findAndHookMethod(LocationManager.class.getName(),mLpp.classLoader, "getLastKnownLocation",
    new Object[] {String.class,
            new XC_MethodHook()
            {
                ..........................
                //返回預先設置好的經緯度信息以僞裝地理位置
            }});
 
HTool.XHookMethod(Location.class.getName(),mLpp.classLoader, "getLatitude", latitude);
HTool.XHookMethod(Location.class.getName(),mLpp.classLoader, "getLongitude", longitude);
 
 
//修改GSM制式手機的基站信息
HTool.XHookMethod(android.telephony.gsm.GsmCellLocation.class.getName(),mLpp.classLoader, "getLac", GsmLac);
HTool.XHookMethod(android.telephony.gsm.GsmCellLocation.class.getName(),mLpp.classLoader, "getCid", GsmCid);
 
 
//修改CDMA制式手機的基站信息
HTool.XHookMethod(android.telephony.cdma.CdmaCellLocation.class.getName(),mLpp.classLoader, "getBaseStationLatitude", CdmaLatitude);
HTool.XHookMethod(android.telephony.cdma.CdmaCellLocation.class.getName(),mLpp.classLoader, "getBaseStationLongitude", CdmaLongitude);
HTool.XHookMethod(android.telephony.cdma.CdmaCellLocation.class.getName(),mLpp.classLoader, "getBaseStationId", CdmaBid);
HTool.XHookMethod(android.telephony.cdma.CdmaCellLocation.class.getName(),mLpp.classLoader, "getSystemId", CdmaSid);
HTool.XHookMethod(android.telephony.cdma.CdmaCellLocation.class.getName(),mLpp.classLoader, "getNetworkId", CdmaNid);
 
 
//模擬手機的APP列表
XposedHelpers.findAndHookMethod("android.app.ApplicationPackageManager",mLpp.classLoader, "getInstalledPackages",new Object[] {int.class,
        new XC_MethodHook()
        {
            //此處模擬正常用戶的APP列表 其中隨機的增加和刪除一些常用APP 以達到每個手機的APP有很大的隨意性和合理性
        }});
 
XposedHelpers.findAndHookMethod("android.app.ApplicationPackageManager",mLpp.classLoader, "getInstalledApplications",new Object[] {int.class,
        new XC_MethodHook()
        {
            //此處模擬正常用戶的APP列表 其中隨機的增加和刪除一些常用APP 以達到每個手機的APP有很大的隨意性和合理性
        }});
         
//防止APP的VPN SOCK5 HTTP代理檢測
XposedHelpers.findAndHookMethod(java.net.NetworkInterface.class.getName(),mLpp.classLoader, "getNetworkInterfacesList",new Object[] {
        new XC_MethodHook()
        {
            ........................................
            //此處對於一些連接信息 對JAVA做了隱藏處理 但對於系統和Native層依然是可見的 所以APP不會檢測到代理 但代理卻可以正常的運行...
        }});

贈送源碼:https://github.com/yugu88/MagicWX

無論你做的多麼天衣無縫,你手機root了,就拜拜……root環境是所有軟件安全性檢測的第一要點,必須免root。。

還有xposed的路徑和包名都是被檢測的重點……改了xposed源碼也沒用的,我有一千種方式知道你用了xposed框架。

有些人使用VirtualXposed這種不root手機,利用分身的方式。主要缺點:

  • 第一:比root手機卡頓
  • 第二:依然還是xposed
  • 第三:適配性差

還有很多種方式,不用xposed也不用root手機 ,改機的方式千千萬……其中下下策 就比如:太極,VirtualXposed。必封號。

你只能告訴你,至少有20種方式免root改機……Android所有的設備數據都是燒錄在芯片裏是無法修改的,只能讀取。我們所有的操作都是針對這個讀取類。修改他的讀取值。

用xposed的缺點:

  • Xposed需要替換/system/bin/app_process,因此需要手機獲得root權限;
  • Xposed 實現的hook在java層,只能修改通過JAVA層獲取的設備參數。不能修改C++層。
  • 手機需要安裝XposedInstaller.apk; 
  • xposed 是切面編程,對於每一次的JAVA調用,都會執行Xposed的hook函數,對系統性能有較大影響。

      xposed 是對虛擬機的hook,  xposed只修改了通過JAVA層獲取的設備參數。

      java層獲取設備信息只是android標準的獲取方式,還有多種獲取設備信息的方法,專業的檢查工具通常會通過C++的 jni調用,同時在native 層做設備檢查, xposed 對這一層的操作無能爲力。或者通過設備屬性獲取,xposed也是沒有辦法修改。檢測不同方式獲取設備信息的一致性,憑此一點便可判斷是否虛假設備信息。

如此不完整的修改還不如不改。

市場上能買到的改機軟件有這麼幾類:

  • 修改系統類文件,改變從芯片裏讀取的參數,封裝新的ROM包;(每次改機必須重啓)
  • 直接刷一個帶xposed的root包,然後刪除超級管理員,表面看着還是沒root。(或者使用xposed 有RootCloak(Root隱藏),但是依然還是使用的xposed,改完參數不用重啓。只要用了xposed就會秒死。)
  • 基於VirtualApp商業版虛擬環境開發,把WX.apk安裝進虛擬環境裏,虛擬環境可以任意操控它內部安裝的所有apk(不用刷機,不需要重啓,而且不挑機型,只要安裝一個VirtualApp就能搞定。)

市場上9成的改機都是使用的xposed。舉例:

  • 小鳥改機
  • 微狗改機
  • WG改機

還有很多需要你root手機的改機。看他們內部的源碼如下。只是提前寫死在包內十幾個固定的機型。來回切換。而且參數很少。


        使用VA(VirtualApp)商業版。這是目前改機最穩定的方式,也是使用上最簡單的方式。通過修改VA的系統文件。模擬系統的app_process文件。相當於一個mini系統,所以不用刷機也不用xposed。使用簡單方便。只有4M,只操作分身就可以提高運行速度。可以適配99%的國內手機。適配Android 10.0 並且適配了32位和64位。

VirtualApp開源庫:https://github.com/asLody/VirtualApp


講文明、懂禮貌。公共場所禁止吸菸。新時代文明好青年,從你我做起。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章