Linux命令笔记01

客户需求:

1. Provide a listing of all of files on the device, formatted per the examples below. See the detailed formatting requirements in Section 2.2, "Permissions - Other Writable" in Document 19423, Android Implementaiton Details.

    a. A listing compatible with the formatting below can be obtained by appropriately converting the ouput of the ls -l -R command to a CSV file and importing it into this spreadsheet.

2. For all files which are writable by "other" provide a rational and  and an explanation for why the setting is believed to be appropriate and safe.

客户主要意思是要获取当前手机上的文件权限中other中有w权限的文件或目录,全部列出来。

实现过程:

1:找出当前手机中所有文件的权限列表并导出至本地,(手机是debug版本)

adb root

adb remount

adb shell

ls -al -R > data/perm_all.txt

由于当前的操作环境是Windows 7,所以将perm_all.txt pull至本地。

adb pull data/perm_all.txt d:\perm_all.txt

2:从perm_all.txt中找出other 带w的权限,这里是比较关键的一点。将perm_all.txt拷贝到Ubuntu系统目录下。然后执行以下命令:

grep "[^l][r-][w-][xsStT-][r-][w-][xsStT-][r-][w][xsStT-]"  ./perm_all.txt > perm_002.txt

这里我们排除了link类型的文件。

3:在打开perm_002.txt文件后,发现有不少重复数据行,所以还要去重复处理。

  awk '!a[$0]++' perm_002.txt  > perm_new.txt

经过这一番操作后,就基本达到客户要求了,不过接下来还要给这些类型文件写些理由,为什么允许可以有w权限,这个才是最头疼的。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,854评论 0 10
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,916评论 0 13
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 11,097评论 0 23
  • 终于看完了!最后作者总结了战胜拖延的“五步自我调节程序”,五个步骤分别是:①问题分析;②设定目标;③制订行动计划;...
    a7476eb10302阅读 530评论 0 0
  • 我认为每个人都应该有目标,目标大小与所处的圈子没有关系,人来到这个世界上不容易,在生死涅槃,经过万次的轮回才可...
    仁王照文阅读 276评论 0 0

友情链接更多精彩内容