ΪʲôҪ×öÈȸüÐÂ
µ±Ò»¸öApp·¢²¼Ö®ºó£¬Í»È»·¢ÏÖÁËÒ»¸öÑÏÖØbugÐèÒª½øÐнô¼±ÐÞ¸´£¬Õâʱºò¹«Ë¾¸÷·½¾Í»áæµÃ½¹Í·ÀöÖØдò°üApp¡¢²âÊÔ¡¢Ïò¸÷¸öÓ¦ÓÃÊг¡ºÍÇþµÀ»»°ü¡¢ÌáʾÓû§Éý¼¶¡¢Óû§ÏÂÔØ¡¢¸²¸Ç°²×°¡£
ÖصãÊÇ»¹»áÓÐÔÀ´µÄ°æ±¾ÒÅÁô£¬ÎÞÂÛÄãÔõôÌáʾ¶¼ÓÐÈË·ÅÆúÖÎÁÆ£¬²»Ô¸ÒâÉý¼¶£¬Ç¿ÖƲ»ÄÜʹÓÃÌåÑéÓÖ×ã¹»Ôã¸âµ½ÈÃÈ˲»ÄÜÆô³Ý¡£
Èç¹ûÕâÊÇÒ»¸öÓ°Ï칫˾ÊÕÈë»òÕßÌåÑéÓ°Ï켫Æä²»ºÃµÄBug£¬ÄÇÍêµ°ÁË£¬¿ÉÄܹ«Ë¾ÀÏ°å»á¶ÔÕû¸ö¼¼ÊõÍŶӵļ¼ÊõÄÜÁ¦É¥Ê§ÐÅÐÄ£¬Æä¶Ô¼¼ÊõÈËÔ±µÄÉ˺¦ÊÇÖÂÃüµÄ¡£
×îºó×îÖÂÃüµÄÊÇ£º
ÓÐʱºò½ö½öÊÇÒòΪ²»Ð¡ÐÄд´íÁËÒ»ÐдúÂ룬¾ÍÈÃËùÓеļӰ඼¸¶Ö®¶«Á÷£¬¿à²»¿à£¬Ô©²»Ô©£¬ÏëÏ붼¿à¡£
»¹ÓÐÒ»ÖÖ¾çÇéÊÇÑз¢×ܼà°Ñ¹ø˦¸ø²âÊÔÍŶӣ¬²âÊÔ²»¹ý¹Ø£¬²âÊÔ̯̯ÊÖ˵ÎÒÒ²²»ÊÇÉñ°¡£¬×Ü»áÓЩÍøÖ®Óã.
ÄÇÄܲ»ÄÜÉñ²»Öª¹í²»¾õÔÙûÓвúÉú½Ï´óÓ°ÏìÇ°°Ñbug¿ìËÙÐÞ¸´ÁËÄØ£¿
ÈȸüеÄÐÐÒµÇé¿ö
ÏÈÀ´ËµËµAndroid
²¢²»ÊÇÒòΪAndroid¸üÓÐÁϾÍÏÈ˵Ëû£¬¶øÊÇËüµÄÓû§Á¿¼¶±ÈIphone´ó£¬ÎÒÃÇдÎÄÕÂÒ²Êǽ²¾¿´óÊý¾Ý·ÖÎöµÄ²»ÊÇ..
Andoid¶ËÔÚ15ÄêÈȲ¹¶¡¾Í±È½Ï»ð£¬ÏȺó³öÏÖÁËDexposed¡¢AndFix£¬Qzone³¬¼¶²¹¶¡µÄÀàNuwa·½Ê½£¬Î¢ÐŵÄTinker, ´óÖÚµãÆÀµÄnuwa¡¢°Ù¶È½ðÈÚµÄrocooFix, ¶öÁËôµÄamigoÒÔ¼°ÃÀÍŵÄrobust.
ÔÙÀ´¿´¿´Iphone¶Ë
¼¼ÊõÉÏÒªÔÚ iOS ÉÏ×öµ½ÔÉú¶¯Ì¬»¯±È Android ¸üÈÝÒ×£¬iOS ¿ª·¢ÓïÑÔ Objective-C ÌìÉú¶¯Ì¬£¬ÔËÐÐʱ¶¼ÄÜËæÒâÌæ»»·½·¨£¬ÔËÐÐʱ¼ÓÔض¯Ì¬¿âÓÖÊÇÏîºÜÀϵļ¼Êõ£¬Ö»ÒªÎÒ°ÑÔöÁ¿µÄ´úÂëºÍ×ÊÔ´´ò°üµ½Ò»¸ö framework À¶¯Ì¬Ï·¢ÔËÐÐʱ¼ÓÔØ£¬ÐÞ bug£¬¼Ó¹¦Äܶ¼²»ÔÚ»°Ï£¬ÐÔÄÜÍêÈ«ÎÞËð£¬Õâ¼þʾͽáÊøÁË¡£
µ«ÊÇÄØ¡£Æ»¹û°Ñ¼ÓÔض¯Ì¬¿âµÄ¹¦Äܸø·âÁË£¬¶¯Ì¬¿â±ØÐë¸úËæ°²×°°üÒ»ÆðÇ©Ãû²ÅÄܱ»¼ÓÔØ£¬ÎÞ·¨Í¨¹ý±ðµÄ;¾¶Ç©ÃûºóÔÙÏ·¢¡£
ÓÚÊÇÓÐÁË waxPatch ºÍ JSPatch ÕâÑùµÄ·½°¸£¬ÒÔ¼°Òì¾üÍ»Æð²»¾ÖÏÞÓÚÈÈÐÞ¸´Bug¶øÄÜ×öÖ÷Ì幦ÄÜ·¢²¼µÄReact Native ºÍ Weex£¬ºóÃæÓÖÓÐÁ˵õ¿ÚζµÄµÎµÎµÄDynamicCocoa·½°¸ºÍOCScript
Èȸüеļ¼ÊõÔÀí
ÏÈÀ´ËµJAVA
¼¼ÊõÅÉϵ£º
• Native£¬´ú±íÓа¢ÀïµÄDexposed¡¢AndFixÓëÌÚѶµÄÄÚ²¿·½°¸KKFix£»
• Java£¬´ú±íÓÐQzoneµÄ³¬¼¶²¹¶¡¡¢´óÖÚµãÆÀµÄnuwa¡¢°Ù¶È½ðÈÚµÄrocooFix, ¶öÁËôµÄamigoÒÔ¼°ÃÀÍŵÄrobust¡£
NativeÁ÷ÅÉÓëJavaÁ÷Åɶ¼ÓÐ×Å×Ô¼ºµÄÓÅȱµã£¬ËüÃǾßÌå²îÒì´ó¼Ò¿É²Î¿¼ÉÏÎÄ¡£ÊÂʵÉÏ´ÓÀ´¶¼Ã»ÓÐ×îºÃµÄ·½°¸£¬Ö»ÓÐ×îÊʺÏ×Ô¼ºµÄ¡£
ÏÂÃæÎÒÃÇÀ´Ò»Ò»¼òµ¥¿´Ï¸÷ÈȸüеÄʵÏÖ·½°¸£º
Dexposed
°¢À↑ԴÏîÄ¿£¬»ùÓÚXposedµÄAOP¿ò¼Ü£¬·½·¨¼¶Á£¶È£¬¿ÉÒÔ½øÐÐAOP±à³Ì¡¢²å×®¡¢ÈȲ¹¶¡¡¢SDK hookµÈ¹¦ÄÜ¡£
²»Í¬µÄÊÇ£¬Xposedͨ¹ý½Ù³Ö zygote£¨Ðëroot£©£¬¶ødexposedͨ¹ý½Ù³Ö java method ( ¶ø·ÇÂ¥ÉÏ˵µÄ½Ù³Öclass loader·½·¨)£¬½«java method¸Ä±äΪnative,²¢ÇÒ½«Õâ¸ö·½·¨µÄʵÏÖÁ´½Óµ½Ò»¸öͨÓõÄNative Dispatch·½·¨ÉÏ.£©Óô¦£¬×î´óµÄ×ÔÈ»ÊÇhotpatch,ÓÃÕâÖÖ¶«Î÷À´ÈÈÌ滻ij¸öµ¼Ö±ÀÀ£µÄ·½·¨¡£ÊÖÌÔ»¹ÓÐ×öµÄÒ»¼þÊ£¬¾ÍÊÇÓÃËü×÷ÐÔÄܼà¿Ø¡£ÕâÖ÷ÒªµÃÒæÓÚÎÞÇÖÈëʽµÄ·½·¨µ÷ÓÃBeforºÍAfterʼþ£¬Äܹ»ÈÃÎÒÃǺܺõļǼºÍ·ÖÎöÒ»¸ö·½·¨µÄµ÷ÓÃʱ¼ä¡£¿ªÔ´ÏîÄ¿promeG/XLog¾ÍÊÇ»ùÓÚdexposedʵÏֵķ½·¨µ÷ÓÃlogging
ʹÓ÷½·¨£º
dexposedÌṩÁË3¸öʹÓ÷½·¨£º
beforeHookedMethod afterHookedMethod replaceHookedMethod
À´¿´¿´Ê¹Ó÷½Ê½£¬Ò²¼«Æä¼òµ¥.
ÓÅȱµã£º
À´ËµËµÓ²ÉË°É£¬²»Ö§³Öart£¬²»Ö§³Öart£¬²»Ö§³Öart¡£
²»Ö§³ÖDalvik 3.0.
ËùÒÔ×¢¶¨Ëü»áÖð²½Ê§Éù,ÔÙ¶àµÄÓŵãÒ²ÊÇͽÀÍ
²å²¥Ò»ÌõÓ²¹ã: ¼¼ÊõÎÄÕÂת·¢ÊÕ¼̫¶à,´ËÎijö´¦ ÒÔ¼°Î¢ÐŹ«ÖÚºÅ: »¥ÁªÍøÊÖÒÕÈË
QzonµÄ³¬¼¶²¹¶¡·½°¸
¸Ã·½°¸»ùÓÚµÄÊÇandroid dex·Ö°ü·½°¸µÄ£¬¹ØÓÚdex·Ö°ü·½°¸±¾Éí¸ü¶àÊÇΪÁ˽â¾öAndroidµÄ64K·½·¨µ÷ÓÃÏÞÖÆÎÊÌ⣬¾ßÌåµÄÔÒòÊÇ£º
• DexOpt »á°Ñÿһ¸öÀàµÄ·½·¨ id ¼ìË÷ÆðÀ´£¬´æÔÚÒ»¸öÁ´±í½á¹¹ÀïÃ棬µ«ÊÇÕâ¸öÁ´±íµÄ³¤¶ÈÊÇÓÃÒ»¸ö short ÀàÐÍÀ´±£´æµÄ£¬µ¼ÖÂÁË·½·¨ id µÄÊýÄ¿²»Äܹ»³¬¹ý65536¸ö¡£µ±Ò»¸öÏîÄ¿×ã¹»´óµÄʱºò£¬ÏÔÈ»Õâ¸ö·½·¨ÊýµÄÉÏÏÞÊDz»¹»µÄ¡£
•Dexopt ʹÓà LinearAlloc À´´æ´¢Ó¦Óõķ½·¨ÐÅÏ¢¡£Dalvik LinearAlloc ÊÇÒ»¸ö¹Ì¶¨´óСµÄ»º³åÇø¡£ÔÚAndroid °æ±¾µÄÀúÊ·ÉÏ£¬LinearAlloc ·Ö±ð¾ÀúÁË4M/5M/8M/16MÏÞÖÆ¡£Android 2.2ºÍ2.3µÄ»º³åÇøÖ»ÓÐ5MB£¬Android 4.xÌá¸ßµ½ÁË8MB »ò16MB¡£µ±·½·¨ÊýÁ¿¹ý¶àµ¼Ö³¬³ö»º³åÇø´óСʱ£¬Ò²»áÔì³Édexopt±ÀÀ£
¾¡¹ÜÔÚа汾µÄ Android ϵͳÖУ¬DexOpt ÐÞ¸´ÁË·½·¨Êý65KµÄÏÞÖÆÎÊÌ⣬²¢ÇÒÀ©´óÁË LinearAlloc ÏÞÖÆ£¬µ«ÊÇÕâÌ×¼¼Êõ»úÖƱ£ÁôÁËÏÂÀ´
·Ö°üµÄ·½°¸¼òµ¥À´Ëµ¾ÍÊÇÔÚ´ò°üʱ½«Ó¦ÓõĴúÂë·Ö³É¶à¸ö dex£¬Ê¹µÃÖ÷ dex µÄ·½·¨ÊýºÍËùÐèµÄ LinearAlloc ²»³¬¹ýϵͳÏÞÖÆ¡£ÔÚÓ¦ÓÃÆô¶¯»òÔËÐйý³ÌÖУ¬Ê×ÏÈÊÇÖ÷ dex Æô¶¯ÔËÐкó£¬ÔÙ¼ÓÔØ´Ó dex£¬ÕâÑù¾ÍÈÆ¿ªÁËÕâÁ½¸öÏÞÖÆ¡£
ÈçºÎ²ð·ÖºÍÈçºÎ¼ÓÔØ¿ÉÒԲ鿴Google¹Ù·½µÄ·½°¸MultiDex
QzonµÄ³¬¼¶²¹¶¡·½°¸ÍæµÄÊÇʲôÕÐÄØ£¿
°ÑBUG·½·¨ÐÞ¸´ÒԺ󣬷ŵ½Ò»¸öµ¥¶ÀµÄDEXÀ²åÈëµ½dexElementsÊý×éµÄ×îÇ°Ã棬ÈÃÐéÄâ»úÈ¥¼ÓÔØÐÞ¸´ÍêºóµÄ·½·¨¡£
Patch.dexÖеÄA.class»áÓÐÓÅÏȼÓÔØ£¬ºóÐøµÄdexÖеÄA.class¾Í²»»á¼ÓÔØÖ±½ÓÌø¹ý£¬´ïµ½ÐÞ¸´Ä¿µÄ¡£
ºËÐÄÎÊÌ⣺
¡¡