• APP逆向案例之(一)过 app 更新提示


    案例:某APP打开时提示更新

     思路:想这是查壳看看有没有加壳,没有就去反编译按照提示搜索下,结果却是没有加壳反编译了下搜索,搜索不到,后来想到是不是网络传过来的,那这样是不是就要先获取本身APP的版本号,然后传输后发现版本过低发送过来这么一句话弹出个窗口,想到这里我就去抓了个包看看是不是确实有也确实传输了信息,所以我下了他们最新版本的APP看了下版本,对比了下去把旧版本里面涉及到版本地方全部改成和新版本一样,从新编译打包安装想着你就是那这些对比的我给了最新的版本号不该提示了吧,打开发现还是会提示晕了,没办法搜索有搜索不了看源代码一点点找如大海捞针。

    唯一的线索就是这个弹窗了从一个开发者角度去想问题,这个弹窗用了安卓那个弹窗的类,那就hook去吧,先利用objection 内存搜索以加载类看看用了那个弹窗类。

    objection -g com.xx.xx.xx explore (注入)

    android heap search instances android.app.AlertDialog (存在)

     最后确定有这个 AlertDialog 那就去hook这个类吧

    android hooking watch class android.app.AlertDialog

     这个读取顺序是从下往上,所以看到了 on.Create 走喽去创建他的地方看一看,由于啊她这个是一开APP就显示了所以要以swpan注入

    直接用objection:objection -g com.xxx.xxx explore -s "android hooking watch class_method android.app.AlertDialog.onCreate --dump-args --dump-backtrace --dump-return"

     前3个都是弹窗类的实现看着也不太像 我们直接从NativeUIFeatureImpl.a 开始看

    objection -g com.xxx.xxx explore -s "android hooking watch class_method io.dcloud.feature.ui.nativeui.NativeUIFeatureImpl.a --dump-args --dump-backtrace --dump-return"

     哦吼出来了,去反编译看看源码 有兴趣的自己看下 反正就是说 第一个switch 判断到了 str.equals("alert") 这个去给执行了这个 c2 = '\r'; ,然后 第二个switch 又判断了c2 = ‘\r’ 去调用方法a:a((byte) 0, JSONUtil.getString(createJSONArray, 2), null, JSONUtil.getString(createJSONArray, 0), new String[]{JSONUtil.getString(createJSONArray, 3)}, null, iWebview, JSONUtil.getString(createJSONArray, 1));

    看了看 a 方法里面是坐窗口创建展示文字的,具体的就不展示了,接下来你可以 hook 这个 execute 方法判断 str 等不等于 alert 然后嘛嘿嘿不用不说了,当然这里也有可能其他地方用到,你可以再往下追到 a 方法我看了看他也有个大判断 判断参数里面那个数字 是几操作哪里,也可以从这里做。

    1. public String execute(IWebview iWebview, String str, String[] strArr) {
    2. char c2;
    3. String[] strArr2;
    4. boolean z;
    5. IActivityHandler iActivityHandler;
    6. String optString;
    7. c cVar;
    8. String[] strArr3;
    9. IActivityHandler iActivityHandler2;
    10. a remove;
    11. c remove2;
    12. IApp obtainApp = iWebview.obtainApp();
    13. int i2 = 0;
    14. String str2 = strArr.length >= 1 ? strArr[0] : null;
    15. JSONArray createJSONArray = strArr.length >= 2 ? JSONUtil.createJSONArray(strArr[1]) : null;
    16. str.hashCode();
    17. switch (str.hashCode()) {
    18. case -2071870705:
    19. if (str.equals("closeToast")) {
    20. c2 = 0;
    21. break;
    22. }
    23. c2 = 65535;
    24. break;
    25. case -1774127679:
    26. if (str.equals("hideMenu")) {
    27. c2 = 1;
    28. break;
    29. }
    30. c2 = 65535;
    31. break;
    32. case -1727401845:
    33. if (str.equals("closePreviewImage")) {
    34. c2 = 2;
    35. break;
    36. }
    37. c2 = 65535;
    38. break;
    39. case -1383206285:
    40. if (str.equals("previewImage")) {
    41. c2 = 3;
    42. break;
    43. }
    44. c2 = 65535;
    45. break;
    46. case -1055312317:
    47. if (str.equals("WaitingView_setTitle")) {
    48. c2 = 4;
    49. break;
    50. }
    51. c2 = 65535;
    52. break;
    53. case -979805852:
    54. if (str.equals("prompt")) {
    55. c2 = 5;
    56. break;
    57. }
    58. c2 = 65535;
    59. break;
    60. case -739906705:
    61. if (str.equals("pickDate")) {
    62. c2 = 6;
    63. break;
    64. }
    65. c2 = 65535;
    66. break;
    67. case -739422578:
    68. if (str.equals("pickTime")) {
    69. c2 = 7;
    70. break;
    71. }
    72. c2 = 65535;
    73. break;
    74. case -339042820:
    75. if (str.equals("showMenu")) {
    76. c2 = '\b';
    77. break;
    78. }
    79. c2 = 65535;
    80. break;
    81. case -228775627:
    82. if (str.equals("closeWaiting")) {
    83. c2 = '\t';
    84. break;
    85. }
    86. c2 = 65535;
    87. break;
    88. case -160355144:
    89. if (str.equals("getTitlebarHeight")) {
    90. c2 = '\n';
    91. break;
    92. }
    93. c2 = 65535;
    94. break;
    95. case -92053387:
    96. if (str.equals("setTitlebarVisible")) {
    97. c2 = 11;
    98. break;
    99. }
    100. c2 = 65535;
    101. break;
    102. case -49471494:
    103. if (str.equals("_NativeObj_close")) {
    104. c2 = '\f';
    105. break;
    106. }
    107. c2 = 65535;
    108. break;
    109. case 92899676:
    110. if (str.equals("alert")) {
    111. c2 = '\r';
    112. break;
    113. }
    114. c2 = 65535;
    115. break;
    116. case 110532135:
    117. if (str.equals("toast")) {
    118. c2 = 14;
    119. break;
    120. }
    121. c2 = 65535;
    122. break;
    123. case 235955885:
    124. if (str.equals("isTitlebarVisible")) {
    125. c2 = 15;
    126. break;
    127. }
    128. c2 = 65535;
    129. break;
    130. case 951117504:
    131. if (str.equals("confirm")) {
    132. c2 = 16;
    133. break;
    134. }
    135. c2 = 65535;
    136. break;
    137. case 988815851:
    138. if (str.equals("WaitingView_close")) {
    139. c2 = 17;
    140. break;
    141. }
    142. c2 = 65535;
    143. break;
    144. case 1572298953:
    145. if (str.equals("actionSheet")) {
    146. c2 = 18;
    147. break;
    148. }
    149. c2 = 65535;
    150. break;
    151. case 2141060722:
    152. if (str.equals("WaitingView")) {
    153. c2 = 19;
    154. break;
    155. }
    156. c2 = 65535;
    157. break;
    158. default:
    159. c2 = 65535;
    160. break;
    161. }
    162. switch (c2) {
    163. case 0:
    164. b.a(obtainApp.obtainAppId());
    165. break;
    166. case 1:
    167. PlatformUtil.invokeMethod("io.dcloud.appstream.actionbar.StreamAppActionBarUtil", "hideMenu", null, new Class[]{Activity.class, String.class}, new Object[]{iWebview.getActivity(), iWebview.obtainApp().obtainAppId()});
    168. if (!(iWebview == null || iWebview.getActivity() == null || (iActivityHandler = DCloudAdapterUtil.getIActivityHandler(iWebview.getActivity())) == null)) {
    169. iActivityHandler.sideBarHideMenu();
    170. break;
    171. }
    172. break;
    173. case 2:
    174. Activity activity = RuningAcitvityUtil.getActivity("io.dcloud.feature.nativeObj.photoview.PhotoActivity");
    175. if (activity != null) {
    176. activity.onBackPressed();
    177. break;
    178. }
    179. break;
    180. case 3:
    181. JSONArray jSONArray = JSONUtil.getJSONArray(createJSONArray, 0);
    182. JSONObject jSONObject = JSONUtil.getJSONObject(createJSONArray, 1);
    183. if (jSONArray != null) {
    184. ArrayList arrayList = new ArrayList();
    185. ArrayList arrayList2 = new ArrayList();
    186. for (int i3 = 0; i3 < jSONArray.length(); i3++) {
    187. try {
    188. String string = jSONArray.getString(i3);
    189. arrayList.add(!PdrUtil.isNetPath(string) ? iWebview.obtainApp().convert2AbsFullPath(iWebview.obtainFullUrl(), string) : string);
    190. arrayList2.add(string);
    191. } catch (JSONException e2) {
    192. e2.printStackTrace();
    193. }
    194. }
    195. Intent intent = new Intent();
    196. intent.setClassName(obtainApp.getActivity().getPackageName(), "io.dcloud.feature.nativeObj.photoview.PhotoActivity");
    197. intent.putExtra("image_urlList", arrayList);
    198. intent.putExtra("original_image_urlArray", arrayList2);
    199. if (jSONObject != null) {
    200. intent.putExtra("image_current_index", jSONObject.optInt("current", 0));
    201. if (jSONObject.has("background")) {
    202. intent.putExtra("image_backgroud_color", PdrUtil.stringToColor(jSONObject.optString("background")));
    203. }
    204. if (jSONObject.has("loop")) {
    205. intent.putExtra("image_loop", jSONObject.optBoolean("loop"));
    206. }
    207. if (jSONObject.has(WXBasicComponentType.INDICATOR)) {
    208. intent.putExtra("image_indicator", jSONObject.optString(WXBasicComponentType.INDICATOR));
    209. }
    210. }
    211. intent.putExtra("image_photo", true);
    212. if (!(createJSONArray == null || createJSONArray.length() <= 2 || (optString = createJSONArray.optString(2)) == null)) {
    213. intent.putExtra("preview_callback", optString);
    214. LongClickEventManager.getInstance().addOnlongClickListener(optString, new c(this, iWebview, optString));
    215. }
    216. intent.putExtra("screen_orientation", obtainApp.getRequestedOrientation());
    217. obtainApp.getActivity().startActivity(intent);
    218. obtainApp.getActivity().overridePendingTransition(17432576, 17432577);
    219. break;
    220. }
    221. break;
    222. case 4:
    223. HashMap hashMap = this.a;
    224. if (!(hashMap == null || (cVar = hashMap.get(str2)) == null)) {
    225. cVar.b(JSONUtil.getString(createJSONArray, 0));
    226. break;
    227. }
    228. break;
    229. case 5:
    230. String string2 = JSONUtil.getString(createJSONArray, 0);
    231. String string3 = JSONUtil.getString(createJSONArray, 1);
    232. String string4 = JSONUtil.getString(createJSONArray, 2);
    233. String string5 = JSONUtil.getString(createJSONArray, 3);
    234. JSONArray jSONArray2 = JSONUtil.getJSONArray(createJSONArray, 4);
    235. if (jSONArray2 != null) {
    236. int length = jSONArray2.length();
    237. String[] strArr4 = new String[length];
    238. while (i2 < length) {
    239. strArr4[i2] = JSONUtil.getString(jSONArray2, i2);
    240. i2++;
    241. }
    242. strArr3 = strArr4;
    243. } else {
    244. strArr3 = null;
    245. }
    246. a((byte) 2, string4, null, string2, strArr3, string5, iWebview, string3);
    247. break;
    248. case 6:
    249. a(iWebview, JSONUtil.getString(createJSONArray, 0), JSONUtil.getJSONObject(createJSONArray, 1));
    250. break;
    251. case 7:
    252. b(iWebview, JSONUtil.getString(createJSONArray, 0), JSONUtil.getJSONObject(createJSONArray, 1));
    253. break;
    254. case '\b':
    255. PlatformUtil.invokeMethod("io.dcloud.appstream.actionbar.StreamAppActionBarUtil", "showMenu", null, new Class[]{Activity.class, String.class, String.class, String.class, IWebview.class, String.class}, new Object[]{iWebview.getActivity(), iWebview.obtainApp().obtainAppId(), JSONUtil.getString(createJSONArray, 0), JSONUtil.getString(createJSONArray, 1), iWebview, JSONUtil.getString(createJSONArray, 2)});
    256. if (!(iWebview == null || iWebview.getActivity() == null || (iActivityHandler2 = DCloudAdapterUtil.getIActivityHandler(iWebview.getActivity())) == null)) {
    257. iActivityHandler2.sideBarShowMenu(JSONUtil.getString(createJSONArray, 0), JSONUtil.getString(createJSONArray, 1), iWebview, JSONUtil.getString(createJSONArray, 2));
    258. break;
    259. }
    260. break;
    261. case '\t':
    262. HashMap hashMap2 = this.a;
    263. if (hashMap2 != null) {
    264. for (c cVar2 : hashMap2.values()) {
    265. cVar2.a();
    266. }
    267. this.a.clear();
    268. break;
    269. }
    270. break;
    271. case '\n':
    272. Object invokeMethod = PlatformUtil.invokeMethod("io.dcloud.appstream.actionbar.StreamAppActionBarUtil", "getTitlebarHeight", null, new Class[]{Activity.class}, new Object[]{iWebview.getActivity()});
    273. return Deprecated_JSUtil.wrapJsVar(String.valueOf(invokeMethod instanceof Integer ? Integer.valueOf(invokeMethod.toString()).intValue() : 0), false);
    274. case 11:
    275. try {
    276. z = createJSONArray.getBoolean(0);
    277. } catch (Exception e3) {
    278. e3.printStackTrace();
    279. z = true;
    280. }
    281. PlatformUtil.invokeMethod("io.dcloud.appstream.actionbar.StreamAppActionBarUtil", "setTitlebarVisible", null, new Class[]{Activity.class, String.class, Boolean.TYPE}, new Object[]{iWebview.getActivity(), iWebview.obtainApp().obtainAppId(), Boolean.valueOf(z)});
    282. return null;
    283. case '\f':
    284. HashMap hashMap3 = this.b;
    285. if (!(hashMap3 == null || (remove = hashMap3.remove(str2)) == null)) {
    286. remove.a(-1);
    287. remove.b.onItemClick(-1);
    288. break;
    289. }
    290. break;
    291. case '\r':
    292. a((byte) 0, JSONUtil.getString(createJSONArray, 2), null, JSONUtil.getString(createJSONArray, 0), new String[]{JSONUtil.getString(createJSONArray, 3)}, null, iWebview, JSONUtil.getString(createJSONArray, 1));
    293. break;
    294. case 14:
    295. a(obtainApp, iWebview, JSONUtil.getString(createJSONArray, 0), JSONUtil.getJSONObject(createJSONArray, 1));
    296. break;
    297. case 15:
    298. Object invokeMethod2 = PlatformUtil.invokeMethod("io.dcloud.appstream.actionbar.StreamAppActionBarUtil", "isTitlebarVisible", null, new Class[]{Activity.class, String.class}, new Object[]{iWebview.getActivity(), iWebview.obtainApp().obtainAppId()});
    299. return Deprecated_JSUtil.wrapJsVar(String.valueOf(invokeMethod2 instanceof Boolean ? Boolean.valueOf(invokeMethod2.toString()).booleanValue() : false), false);
    300. case 16:
    301. try {
    302. String string6 = JSONUtil.getString(createJSONArray, 0);
    303. String string7 = JSONUtil.getString(createJSONArray, 1);
    304. Object obj = createJSONArray.get(2);
    305. if (!(obj instanceof JSONObject)) {
    306. if (obj instanceof String) {
    307. String str3 = (String) obj;
    308. JSONArray jSONArray3 = JSONUtil.getJSONArray(createJSONArray, 3);
    309. if (jSONArray3 != null) {
    310. int length2 = jSONArray3.length();
    311. String[] strArr5 = new String[length2];
    312. while (i2 < length2) {
    313. strArr5[i2] = JSONUtil.getString(jSONArray3, i2);
    314. i2++;
    315. }
    316. strArr2 = strArr5;
    317. } else {
    318. strArr2 = null;
    319. }
    320. a((byte) 1, str3, null, string6, strArr2, null, iWebview, string7);
    321. break;
    322. } else {
    323. a((byte) 1, null, null, string6, null, null, iWebview, string7);
    324. break;
    325. }
    326. } else {
    327. a((byte) 1, string6, (JSONObject) obj, iWebview, string7);
    328. break;
    329. }
    330. } catch (JSONException e4) {
    331. e4.printStackTrace();
    332. break;
    333. }
    334. case 17:
    335. HashMap hashMap4 = this.a;
    336. if (!(hashMap4 == null || (remove2 = hashMap4.remove(str2)) == null)) {
    337. remove2.a();
    338. break;
    339. }
    340. break;
    341. case 18:
    342. String string8 = JSONUtil.getString(createJSONArray, 2);
    343. a a2 = a(string8, JSONUtil.getJSONObject(createJSONArray, 0), JSONUtil.getString(createJSONArray, 1), iWebview);
    344. if (!PdrUtil.isEmpty(string8) && !PdrUtil.isEmpty(a2)) {
    345. if (this.b == null) {
    346. this.b = new HashMap<>();
    347. }
    348. this.b.put(string8, a2);
    349. break;
    350. }
    351. break;
    352. case 19:
    353. String string9 = JSONUtil.getString(createJSONArray, 0);
    354. JSONObject jSONObject2 = JSONUtil.getJSONObject(createJSONArray, 1);
    355. String string10 = JSONUtil.getString(createJSONArray, 2);
    356. Activity topRuningActivity = RuningAcitvityUtil.getTopRuningActivity(iWebview.getActivity());
    357. if (!topRuningActivity.isDestroyed()) {
    358. c cVar3 = new c(this, iWebview, string9, jSONObject2, string10, topRuningActivity);
    359. if (this.a == null) {
    360. this.a = new HashMap<>();
    361. }
    362. cVar3.f = str2;
    363. this.a.put(str2, cVar3);
    364. break;
    365. }
    366. break;
    367. }
    368. return null;
    369. }

  • 相关阅读:
    使用aliyun的registry上传下载镜像
    《牛客题霸-算法篇》刷题之NC111 最大数
    Redis 学习整理
    20221203使用python3处理Google翻译英文SRT格式字幕
    后台管理登录权限怎么实现的,token具体有什么作用
    linux c++ 开发 - 05- 使用CMake创建一个动态库
    【原创】java+swing+mysql鲜花购物商城设计与实现
    SSM框架快速搭建(一)
    16、JAVA入门——继承和方法重写
    基于非侵入式负荷检测与分解的电力数据挖掘
  • 原文地址:https://blog.csdn.net/zhaoxiaoba123/article/details/127883308