当前位置:   article > 正文

selinux android 权限测试_android selinux测试

android selinux测试

安装时的权限检测。

1.环境变量

























2.启动模拟器


























3.启动MACMode功能




4.启动adbshell, 并查看要安装apk要获得的权限。

5.查看apk是否可以通过安装权限。以com.dianxinos.powermanager.apk

为例。说明这个包在安装的时候将被拒绝。

public@public-Lenovo-Product:~/workspace/seandroid-4.2.1_r1/seandroid-4.2$setool --policy external/sepolicy/mac_permissions.xml/tmp/com.dianxinos.powermanager.apk




Defaultpolicy stanza used.


Policyblacklist rejected package com.dianxinos.powermanager


Deniedpermission android.permission.WRITE_EXTERNAL_STORAGE


Setof blacklisted permissions is:


android.permission.ACCESS_COARSE_LOCATION


android.permission.ACCESS_FINE_LOCATION


android.permission.AUTHENTICATE_ACCOUNTS


android.permission.CALL_PHONE


android.permission.CAMERA


android.permission.READ_LOGS


android.permission.WRITE_EXTERNAL_STORAGE




6.adb安装com.dianxinos.powermanager.apk

结果为安装失败。

public@public-Lenovo-Product:~/workspace/seandroid-4.2.1_r1/seandroid-4.2$adb install /tmp/com.dianxinos.powermanager.apk


4786KB/s (3313036 bytes in 0.675s)


pkg:/data/local/tmp/com.dianxinos.powermanager.apk


Failure[INSTALL_FAILED_POLICY_REJECTED_PERMISSION]


7.如果想要安装成功,就要在修改mac_permissions.xml文件。删除deny-permissionname="android.permission.WRITE_EXTERNAL_STORAGE"

<default>


<seinfovalue="default" />


<deny-permissionname="android.permission.ACCESS_COARSE_LOCATION" />


<deny-permissionname="android.permission.ACCESS_FINE_LOCATION" />


<deny-permissionname="android.permission.AUTHENTICATE_ACCOUNTS" />


<deny-permissionname="android.permission.CALL_PHONE" />


<deny-permissionname="android.permission.CAMERA" />


<deny-permissionname="android.permission.READ_LOGS" />


<deny-permissionname="android.permission.WRITE_EXTERNAL_STORAGE" />


</default>




8.把修改过的文件放到模拟器的/data/system

public@public-Lenovo-Product:~/workspace/seandroid-4.2.1_r1/seandroid-4.2$adb push external/sepolicy/mac_permissions.xml /data/system/


172KB/s (15136 bytes in 0.085s)



9.重启模拟器,用adb安装com.dianxinos.powermanager.apk

结果成功。

public@public-Lenovo-Product:~/workspace/seandroid-4.2.1_r1/seandroid-4.2$adb install /tmp/com.dianxinos.powermanager.apk


4814KB/s (3313036 bytes in 0.672s)


pkg:/data/local/tmp/com.dianxinos.powermanager.apk


Success




声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/961997
推荐阅读
相关标签
  

闽ICP备14008679号