{"id":533,"date":"2023-06-29T14:45:31","date_gmt":"2023-06-29T06:45:31","guid":{"rendered":"http:\/\/pareto.fun\/?p=533"},"modified":"2026-05-27T14:25:43","modified_gmt":"2026-05-27T06:25:43","slug":"__trashed","status":"publish","type":"post","link":"http:\/\/pareto.fun\/?p=533","title":{"rendered":"tips"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u5b57\u7b26\u4e32\u53cd\u6df7\u6dc6<\/h2>\n\n\n\n<p>If you have a binary that has&nbsp;<em>a lot<\/em>&nbsp;of obfuscated strings, another thing you can do instead of just adding comments is to add a new segment to the database with&nbsp;<code>idc.AddSeg<\/code>, write the strings to it with&nbsp;<code>idaapi.patch_many_bytes<\/code>&nbsp;and&nbsp;<code>idaapi.MakeStr<\/code>, then add a data xref from the decryption call to the decrypted string in your new segment with&nbsp;<code>idc.add_dref<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u83b7\u53d6\u5230\u5f53\u524d\u7684activity<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>adb shell dumpsys window | findstr mCurrentFocus<\/code><\/pre>\n\n\n\n<ul>\n<li>run-as \u964d\u6743\u540e\u4e5f\u548c\u5e94\u7528\u7684\u6743\u9650\u4e0d\u540c\u3002<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>apt \u83b7\u53d6\u5305\u540d \u548c launcher <\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>aapt dump badging litmatch-6-23-1.apk | findstr \"MAIN\"\n\naapt dump badging litmatch-6-23-1.apk | findstr \"activity\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">monkey\u547d\u4ee4<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>adb shell monkey -p com.litatom.app -v  -v  -v 10000<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u67e5\u770b\u5e94\u7528\u7684uid<\/h2>\n\n\n\n<ul>\n<li>adb shell dumpsys package com.litatom.app | findstr &#8220;userId&#8221;<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">frida\u83b7\u53d6context<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>var context = Java.use(\"android.app.ActivityThread\").currentApplication().getApplicationContext()\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">frida remote<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># listen on a specific interface and port\n$ frida-server -l 192.168.1.3:1337\n\n# connect to specific IP\n$ frida-trace -H 192.168.1.3 -i \"open*\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4fee\u6539packages.xml\u4e3a\u666e\u901axml\u683c\u5f0f<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>setprop persist.sys.binary_xml false\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">OKHttp \u4fee\u6539\u8bf7\u6c42\u53c2\u6570<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>let Builder = Java.use(\"okhttp3.HttpUrl$Builder\");\nBuilder&#91;\"addQueryParameter\"].implementation = function (name, value) {\n    console.log(`Builder.addQueryParameter is called: name=${name}, value=${value}`);\n    let result = this&#91;\"addQueryParameter\"](name, value);\n    console.log(`Builder.addQueryParameter result=${result}`);\n    return result;\n};<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">private_dirty \u548c shared_dirty<\/h2>\n\n\n\n<p>linker \u6620\u5c04libc.co \u65f6\uff0c\u5bf9got\u8868\u7684\u4fee\u6539\u4e3b\u8981\u65f6shared_dirty \uff0c\u8be5\u4fee\u6539\u4f5c\u7528\u8be5\u8fdb\u7a0b\u5e76\u4e14\u81f3\u5c11\u4e00\u4e2a\u5176\u4ed6\u8fdb\u7a0b\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/33027341\/shared-dirty-vs-private-dirty-in-shared-memory\">https:\/\/stackoverflow.com\/questions\/33027341\/shared-dirty-vs-private-dirty-in-shared-memory<\/a>\u8be6\u7ec6\u89e3\u91ca<\/p>\n\n\n\n<p>\u7528frida hook\u65f6\uff0c\u4e3b\u8981\u4fee\u6539private_dirty \u5e76\u4e14\u6240\u6709\u5176\u4ed6\u7ebf\u7a0b\u540c\u5730\u5740\u5185\u5b58\u5757\u7684\u90fd\u4f1a\u4fee\u6539\uff1b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">adb command<\/h2>\n\n\n\n<ul>\n<li>adb shell am clear-debug-app \u6e05\u9664\u5e94\u7528\u8c03\u8bd5\u6807\u5fd7<\/li>\n<\/ul>\n\n\n\n<ul>\n<li>android recovery mode \u63d0\u793a \u201dno command \u201c \u65f6 \uff0c\u6309\u4f4f \u201d\u7535\u6e90\u952e + \u97f3\u91cf\u4e0b\u201c<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6570\u5b57\u8bc1\u4e66 = \u516c\u94a5\u4fe1\u606f + \u5176\u4ed6\u4fe1\u606f<\/h2>\n\n\n\n<p>Dockfile \u65b0\u589e\u7528\u6237\u3001\u8bbe\u7f6e\u5bc6\u7801 \u3001\u52a0\u5165sudo\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nRUN groupadd -g $groupid $username \\\n &amp;&amp; useradd -m -u $userid -g $groupid $username \\\n &amp;&amp; adduser $username sudo \\\n &amp;&amp; echo $username &gt;\/root\/username \\\n &amp;&amp; echo \"export USER=\"$username &gt;&gt;\/home\/$username\/.gitconfig \\\n &amp;&amp; echo $username:123 | chpasswd<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">fingerprint\u7ec4\u6210<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"973\" height=\"273\" src=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/12\/img_v2_6ebee86d-3a9b-4878-bff3-3e1f45674eeg.jpg\" alt=\"\" class=\"wp-image-592\" srcset=\"http:\/\/pareto.fun\/wp-content\/uploads\/2023\/12\/img_v2_6ebee86d-3a9b-4878-bff3-3e1f45674eeg.jpg 973w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/12\/img_v2_6ebee86d-3a9b-4878-bff3-3e1f45674eeg-300x84.jpg 300w, http:\/\/pareto.fun\/wp-content\/uploads\/2023\/12\/img_v2_6ebee86d-3a9b-4878-bff3-3e1f45674eeg-768x215.jpg 768w\" sizes=\"(max-width: 973px) 100vw, 973px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e3a\u4ec0\u4e48C++11\u540e\uff0c\u7c7b\u9759\u6001\u5c40\u90e8\u53d8\u91cf\u662f\u7ebf\u7a0b\u5b89\u5168<\/h2>\n\n\n\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/34457432\/c11-singleton-static-variable-is-thread-safe-why\">https:\/\/stackoverflow.com\/questions\/34457432\/c11-singleton-static-variable-is-thread-safe-why<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5173\u95ed\u9501<\/h2>\n\n\n\n<p>compare_exchange_weak(\u2026, std::memory_order_acquire, \u2026) \u7533\u8bf7\u81ea\u65cb\u9501\uff0c\u6210\u529f\u65f6\u4f1a\u5efa\u7acb acquire \u5c4f\u969c\uff0c\u4fdd\u8bc1\u9501\u540e\u8bfb\u53d6\u5230\u5176\u4ed6\u7ebf\u7a0b\u91ca\u653e\u9501\u524d\u5199\u5165\u7684\u6570\u636e\uff1breleaseLock() \u7528 memory_order_release \u91ca\u653e\u9501\uff0c\u5f62\u6210 acquire\/release \u540c\u6b65\u3002\u8fd9\u6837\u5c31\u80fd\u628a slots_\u3001slot_count_\u3001fault_stats_ \u7b49\u975e\u539f\u5b50\u5171\u4eab\u6570\u636e\u7684\u5e76\u53d1\u8bbf\u95ee\uff0c\u9650\u5236\u4e3a\u4e00\u6b21\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p><a href=\"https:\/\/blog.pareto.fun\/2024\/03\/26\/magiskinit\/\">https:\/\/blog.pareto.fun\/2024\/03\/26\/magiskinit\/<\/a><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u5b57\u7b26\u4e32\u53cd\u6df7\u6dc6 If you have a binary that has&nbsp;a lot&#038;nb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/533"}],"collection":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=533"}],"version-history":[{"count":22,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/533\/revisions"}],"predecessor-version":[{"id":615,"href":"http:\/\/pareto.fun\/index.php?rest_route=\/wp\/v2\/posts\/533\/revisions\/615"}],"wp:attachment":[{"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=533"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pareto.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}