禁止从手机中导出某预装APK方案

禁止pull文件修改方案:

system/core/adb$ git diff

diff --git a/core/adb/file_sync_service.cpp b/core/adb/file_sync_service.cpp

old mode 100644

new mode 100755

index 1128993..32b8c7b

--- a/core/adb/file_sync_service.cpp

+++ b/core/adb/file_sync_service.cpp

@@ -420,7 +420,11 @@ static bool do_recv(int s, const char* path, std::vector<char>& buffer) {

     if (posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE) < 0) {

         D("[ Failed to fadvise: %d ]", errno);

     }

-

+    D("pull argv[1] %s",path);

+    if(strstr(path, "system/app") != nullptr){

+               SendSyncFailErrno(s, "pull requires Permission");

+               return false;

+    }   

     syncmsg msg;

     msg.data.id = ID_DATA;

禁止拷贝再导出

external/toybox$ git diff

diff --git a/toybox/toys/posix/cp.c b/toybox/toys/posix/cp.c

old mode 100644

new mode 100755

index d4475a02c..d03717102

--- a/toybox/toys/posix/cp.c

+++ b/toybox/toys/posix/cp.c

@@ -400,6 +400,10 @@ void cp_main(void)

   // Loop through sources

   for (i=0; i<toys.optc; i++) {

     char *src = toys.optargs[i];

+       if(strstr(src,"system")|| strstr(src,"app")|| strstr(src,"xxxx")||strstr(src,"xxxxxx")){

+                perror_msg("bad '%s'", src);

+                break;

+       }

     int rc = 1;

     if (destdir) TT.destname = xmprintf("%s/%s", destname, basename(src));

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值