{"id":99,"date":"2020-02-13T02:09:00","date_gmt":"2020-02-13T02:09:00","guid":{"rendered":"https:\/\/piratesecurityblog.com\/?p=99"},"modified":"2021-12-20T14:10:05","modified_gmt":"2021-12-20T14:10:05","slug":"adb-pull-code-exec","status":"publish","type":"post","link":"https:\/\/piratesecurityblog.com\/?p=99","title":{"rendered":"adb pull code exec"},"content":{"rendered":"\n<p>static bool remote_build_list(SyncConnection&amp; sc, std::vector&lt;copyinfo&gt;* file_list, const std::string&amp; rpath, const std::string&amp; lpath) { std::vector&lt;copyinfo&gt; dirlist; std::vector&lt;copyinfo&gt; linklist; \/\/ Add an entry for the current directory to ensure it gets created before pulling its contents. copyinfo ci(android::base::Dirname(lpath), android::base::Dirname(rpath), android::base::Basename(lpath), S_IFDIR); file_list-&gt;push_back(ci); \/\/ Put the files\/dirs in rpath on the lists. auto callback = [&amp;](unsigned mode, uint64_t size, uint64_t time, const char* name) { if (IsDotOrDotDot(name)) { return; } copyinfo ci(lpath, rpath, name, mode); if (S_ISDIR(mode)) { dirlist.push_back(ci); } else if (S_ISLNK(mode)) { linklist.push_back(ci); } else { if (!should_pull_file(ci.mode)) { sc.Warning(&#8220;skipping special file &#8216;%s&#8217; (mode = 0o%o)&#8221;, ci.rpath.c_str(), ci.mode); ci.skip = true; } ci.time = time; ci.size = size; file_list-&gt;push_back(ci); } }; if (!sync_ls(sc, rpath, callback)) { return false; } \/\/ Check each symlink we found to see whether it&#8217;s a file or directory. for (copyinfo&amp; link_ci : linklist) { struct stat st; if (!sync_stat_fallback(sc, link_ci.rpath, &amp;st)) { sc.Warning(&#8220;stat failed for path %s: %s&#8221;, link_ci.rpath.c_str(), strerror(errno)); continue; } if (S_ISDIR(st.st_mode)) { dirlist.emplace_back(std::move(link_ci)); } else { file_list-&gt;emplace_back(std::move(link_ci)); } } \/\/ Recurse into each directory we found. while (!dirlist.empty()) { copyinfo current = dirlist.back(); dirlist.pop_back(); if (!remote_build_list(sc, file_list, current.rpath, current.lpath)) { return false; } } return true; }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>static bool remote_build_list(SyncConnection&amp; sc, std::vector&lt;copyinfo&gt;* file_list, const std::string&amp; rpath, const std::string&amp; lpath) { std::vector&lt;copyinfo&gt; dirlist; std::vector&lt;copyinfo&gt; linklist; \/\/ Add an entry for the current directory to ensure it gets created before pulling its contents. copyinfo ci(android::base::Dirname(lpath), android::base::Dirname(rpath), android::base::Basename(lpath), S_IFDIR); file_list-&gt;push_back(ci); \/\/ Put the files\/dirs in rpath on the lists. auto callback = [&amp;](unsigned mode, uint64_t &hellip; <a href=\"https:\/\/piratesecurityblog.com\/?p=99\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">adb pull code exec<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=\/wp\/v2\/posts\/99"}],"collection":[{"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=99"}],"version-history":[{"count":1,"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":100,"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=\/wp\/v2\/posts\/99\/revisions\/100"}],"wp:attachment":[{"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/piratesecurityblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}