Android11系统 adb添加访问密码
创始人
2024-11-21 09:06:37
0

Android11上,通过命令行访问adb的时候增加密码。

修改以后,直接访问adb会报错,需要使用来输入密码鉴权,默认密码为admin,即输入adb shell admin以后可以正常访问adb。

详细修改如下:

1、修改system/core/adb/adb.cpp

此处主要通过重置accept_shell的值,让adb断开以后需要重新输入密码进行访问 

diff --git a/system/core/adb/adb.cpp b/system/core/adb/adb.cpp index c3e9731a30..990dec445b 100644 --- a/system/core/adb/adb.cpp +++ b/system/core/adb/adb.cpp @@ -100,6 +100,11 @@ apacket* get_apacket(void)      return p;  }   + +#if !ADB_HOST +int accept_shell; +#endif +  void put_apacket(apacket *p)  {      delete p; @@ -110,6 +115,9 @@ void handle_online(atransport *t)      D("adb: online");      t->online = 1;      t->SetConnectionEstablished(true); +    #if !ADB_HOST +    accept_shell = 0; +    #endif  }    void handle_offline(atransport *t) @@ -126,6 +134,9 @@ void handle_offline(atransport *t)      // Close the associated usb      t->online = 0;   +    #if !ADB_HOST +    accept_shell = 0; +    #endif      // This is necessary to avoid a race condition that occurred when a transport closes      // while a client socket is still active.      close_all_sockets(t)
2、修改system/core/adb/services.cpp

访问密码通过读取property(persist.otg.passwd)的值获取, 默认为admin

diff --git a/system/core/adb/services.cpp b/system/core/adb/services.cpp index 853d658976..c1544f6ac6 100644 --- a/system/core/adb/services.cpp +++ b/system/core/adb/services.cpp @@ -27,6 +27,7 @@  #include   #include    +#include   #include   #include   #include  @@ -74,9 +75,41 @@ unique_fd create_service_thread(const char* service_name, std::function= 0) { +                close_on_exec(ret); +            } +        } +        return ret; +    } +#endif      if (is_socket_spec(name)) {          std::string error;          if (!socket_spec_connect(&ret, name, nullptr, nullptr, &error)) {

相关内容

热门资讯

透视苹果版!pokerworl... 透视苹果版!pokerworld破解版下载,哈糖大菠萝破解器,举措教程(真的有挂)-哔哩哔哩poke...
透视ai代打!poker wo... 透视ai代打!poker world辅助器(透视)好像存在有挂,可靠教程(有挂插件挂)-哔哩哔哩一、...
八分钟揭露!wepoker怎么... 八分钟揭露!wepoker怎么挂飞机(透视)确实真的是有挂,AI教程(有挂实锤)-哔哩哔哩1、八分钟...
透视辅助!如何下载wepoke... 透视辅助!如何下载wepoker安装包,有没有人wepoker,举措教程(确实有挂)-哔哩哔哩如何下...
透视透视!拱趴大菠萝机器人(透... 透视透视!拱趴大菠萝机器人(透视)其实真的有挂,AI教程(有挂技巧)-哔哩哔哩1、拱趴大菠萝机器人透...
第5分钟详细!wepoker私... 第5分钟详细!wepoker私人定制透视(透视)竟然是有挂,必备教程(存在有挂)-哔哩哔哩1、点击下...
透视透视!wpk私人局辅助是真... 透视透视!wpk私人局辅助是真的吗,德普之星私人局辅助免费,方案教程(有人有挂)-哔哩哔哩1、德普之...
透视系统!werplan怎么辅... 透视系统!werplan怎么辅助(透视)切实是真的挂,详细教程(有挂脚本)-哔哩哔哩1、玩家可以在w...
一分钟普及!wepoker轻量... 一分钟普及!wepoker轻量版透视(透视)总是真的有挂,解密教程(真实有挂)-哔哩哔哩;1、游戏颠...
透视挂透视!we poker插... 透视挂透视!we poker插件,aapoker真的假的,策略教程(有挂助手)-哔哩哔哩1、aapo...