android 中linux 命令pm常见用法(安装卸载app)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了android 中linux 命令pm常见用法(安装卸载app)相关的知识,希望对你有一定的参考价值。

参考技术A

27种用法格式 :

用法说明

1、 pm list packages : prints all packages, optionally only those whose package name contains the text in FILTER. Options:

例子:列出系统中所有packages

2、 pm list permission-groups : prints all known permission groups.

例子:

3、 pm list permissions : prints all known permissions, optionally only those in GROUP. Options:

例子:列出系统所有许可

4、 pm list instrumentation : use to list all test packages; optionally supply to list the test packages for a particular application. Options:

-f: list the .apk file for the test package.

5、 pm list features : prints all features of the system.

例子:列出所有手机特性

6、 pm list users : prints all users on the system.

例子:

7、 pm path : print the path to the .apk of the given PACKAGE.

例子:按包名查找apk文件所在路径

8、 pm dump : print system state associated with the given PACKAGE.

9、 pm install : installs a package to the system. Options:

例子:

10、 pm uninstall : removes a package from the system. Options:

-k: keep the data and cache directories around after package removal. 保留数据

例子:

11、 pm clear : deletes all data associated with a package..

例子:只删除数据

12、 pm enable, disable, disable-user, disable-until-used : these commands change the enabled state of a given package or component (written as "package/class").

13、 pm grant, revoke : these commands either grant or revoke permissions to applications. Only optional permissions the application has declared can be granted or revoked.

14、 pm get-install-location : returns the current install location.

15、 pm set-install-location : changes the default install location.

NOTE: this is only intended for debugging; using this can cause applications to break and other undersireable behavior.

16、 pm trim-caches : trim cache files to reach the given free space.

17、 pm create-user : create a new user with the given USER_NAME, printing the new user identifier of the user. 创建新用户

18、 pm remove-user : remove the user with the given USER_IDENTIFIER, deleting all data associated with that user 。 按用户ID删除用户

备起来!Linux安全运维常见命令小贴士

备起来!Linux安全运维常见命令小贴士

常用命令


1. 查找关键词并统计行数

cat 2015_7_25_test_access.log | grep "sqlmap" | wc -l


2. 删除含有匹配字符的行

sed -i ‘/Indy Library/d‘ 2015_7_25_test_access.log


3. 查找所有日志中的关键词

find ./ -name "*.log" |xargs grep "sqlmap" |wc -l


4. 获取特殊行(如id)并且排序统计

cat cszl988.log | awk ‘{print $1}‘ | awk -F : ‘{print $2}‘ | sort -u | wc -l


5. 正则匹配内容(如提取ip)

grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"


6. 去重并统计数量

tail 3.log | awk ‘{print $7}‘ | sort | uniq -c


7. 批量提取(全流量中)数据包并且过滤数据

#!/bin/bash

for file in ` ls $1 `

do

parse_pcap -vvb $file | grep -v "Host:" | grep -v "Cookie:" | grep -v "User-Agent:" | grep -v "Accept:" | grep -v "Accept:" | grep -v "Accept-Language:" | grep -v "Accept-Encoding:" | grep -v "Connection:" | grep -v "Content-Type:" | grep -v "Content-Length" | grep -v

"Server"

done


8. url 解码

cat luban.log | grep sqlmap | awk ‘{print $7}‘ | xargs python -c ‘import sys, urllib; print urllib.unquote(sys.argv[1])‘


示 范

xxxx站注入日志排查

* 查看所有sqlmap注入记录条数

[[email protected] temp]# cat luban.log | grep sqlmap | wc -l

1241


* 预览几条url

cat luban.log | grep sqlmap | awk ‘{print $7}‘ | more

/news.php?id=771%28.%28%22%29.%27%29%29%27&fid=168

/news.php?id=771%27IddP%3C%27%22%3EvCBw&fid=168

/news.php?id=771%29%20AND%201148%3D8887%20AND%20%288975%3D8975&fid=168

/news.php?id=771%29%20AND%208790%3D8790%20AND%20%287928%3D7928&fid=168

/news.php?id=771%20AND%204294%3D9647&fid=168

/news.php?id=771%20AND%208790%3D8790&fid=168

/news.php?id=771%27%29%20AND%205983%3D7073%20AND%20%28%27UwRr%27%3D%27UwRr&fid=168

/news.php?id=771%27%29%20AND%208790%3D8790%20AND%20%28%27hwaT%27%3D%27hwaT&fid=168

/news.php?id=771%27%20AND%206578%3D7565%20AND%20%27EoTZ%27%3D%27EoTZ&fid=168

/news.php?id=771%27%20AND%208790%3D8790%20AND%20%27lBdL%27%3D%27lBdL&fid=168

/news.php?id=771%25%27%20AND%205177%3D1107%20AND%20%27%25%27%3D%27&fid=168

/news.php?id=771%25%27%20AND%208790%3D8790%20AND%20%27%25%27%3D%27&fid=168


* 方便查看 urldecode

cat luban.log | grep sqlmap | awk ‘{print $7}‘ | xargs python -c ‘import sys, urllib; print urllib.unquote(sys.argv[1])‘

/news.php?id=771&fid=168

/news.php?id=771&fid=168 AND ASCII(SUBSTRING((SELECT DISTINCT(COALESCE(CAST(schemaname AS CHARACTER(10000)),(CHR(32)))) FROM pg_tables OFFSET 1 LIMIT 1)::text FROM 3 FOR 1))>

97

/news.php?id=771&fid=168 UNION ALL SELECT NULL,(CHR(113)||CHR(122)||CHR(106)||CHR(120)||CHR(113))||(CHR(103)||CHR(75)||CHR(78)||CHR(87)||CHR(76)||CHR(74)||CHR(110)||CHR(1

15)||CHR(100)||CHR(85))||(CHR(113)||CHR(122)||CHR(120)||CHR(113)||CHR(113)),NULL,NULL,NULL,NULL,NULL,NULL,NULL UNION ALL SELECT NULL,(CHR(113)||CHR(122)||CHR(106)||CHR(120)||CHR(113))||(CHR(113)||CHR(71)||C

HR(74)||CHR(82)||CHR(101)||CHR(120)||CHR(69)||CHR(112)||CHR(117)||CHR(79))||(CHR(113)||CHR(122)||CHR(120)||CHR(113)||CHR(113)),NULL,NULL,NULL,NULL,NULL,NULL,NULL--


以上是关于android 中linux 命令pm常见用法(安装卸载app)的主要内容,如果未能解决你的问题,请参考以下文章

备起来!Linux安全运维常见命令小贴士

Linux中find的常见用法

Linux中find常见用法示例

Linux之sed命令常见用法

Linux命令文件和目录的常见用法

Linux中find常见用法示例