用于扫描系统上给定映射(共享库、可执行文件)或打开文件描述符的运行进程的应用程序
项目描述
扫描主机上所有正在运行的应用程序,以识别使用共享库、可执行文件、某些其他映射或打开文件描述符的应用程序。
此应用程序适用于基于UNIX的系统(Linux、BSD、cygwin等)。您可以使用它,例如,扫描使用特定版本的共享库或在不同解释器下运行的进程。它可以打印汇总视图,也可以选择打印所有匹配的映射。
此应用程序还可以扫描打开的文件,可以是完全限定或不完全限定的。
这可以与https://pypi.python.org/pypi/remote_copy_and_execute配合使用,以对网络上多台机器上运行的软件/库使用情况进行审计。
您必须是root才能扫描所有正在运行的过程,否则这将只扫描当前用户正在运行的过程。
用法
用法:findProcessesUsing (选项) [搜索部分]
搜索所有正在运行的过程,查找包含指定映射或打开文件的过程(使用 -f)。
映射包括运行的可执行文件(如 python)、共享库或设备。
选项
模式
-m 或 –mappings 搜索映射(默认)
-c 或 –cwd 搜索 cwd
-f 或 –files 搜索打开的文件而不是映射。这不应是符号链接。
修饰符
-v 或 –verbose 同时打印包含给定模式的映射行,或给定 -f 时的匹配文件名。
-e 或 –exact 需要精确匹配。默认是允许部分匹配
-p 或 –pids-only 仅打印 pids,每行一个
-i 或 –ignore-case 不区分大小写搜索。默认情况下,大小写必须精确匹配。
—version 打印版本
-h 或 –help 显示此信息并退出
注意:可以指定多个模式
示例
findProcessesUsing libpython2.7 # 搜索任何链接到包含“libpython2.7”的过程
findProcessesUsing -f /var/lib/data.db # 搜索任何打开“/var/lib/data.db”句柄的过程
findProcessesUsing -f -c /mnt/otherdrive # 搜索任何在“/mnt/otherdrive”中有 cwd 或打开文件的过程
建议以 root 身份运行此过程,否则您只能扫描您自己的进程。
示例用法
搜索 libc 的映射
]$ sudo findProcessesUsing libc | head -n 20 | tail -n5
在 803 (john) [ -bash ] 中找到 libc
在 1060 (john) [ /usr/lib/tracker/tracker-extract ] 中找到 libc
在 1062 (www) [ /usr/bin/httpd ] 中找到 libc
在 808 (frankl) [ /bin/sh /usr/bin/startx ] 中找到 libc
在 1065 (frankl) [ /usr/lib/tracker/tracker-miner-user-guides ] 中找到 libc
搜索“/mnt/otherdrive”中的任何 cwd 或打开文件
]$ sudo findProcessesUsing -f -c /mnt/otherdrive
在 2927 (tim) [ -/bin/bash ] 中找到 /mnt/otherdrive {cwd=/mnt/otherdrive}
在 3943 (root) [ bash ] 中找到 /mnt/otherdrive {cwd=/mnt/otherdrive}
在 19636 (root) [ vim z ] 中找到 /mnt/otherdrive {fd=3}
在 19636 (root) [ vim z ] 中找到 /mnt/otherdrive {cwd=/mnt/otherdrive}
搜索 pty 的打开文件描述符
]$ ./findProcessesUsing -f -v pty
在 2384 (user1) [ /bin/bash ] 中找到 pty {fd=0,1,2,31}
0 = “/dev/pty1”
1 = “/dev/pty1”
2 = “/dev/pty1”
31 = “/dev/pty1”
在 5732 (user1) [ SCREEN ] 中找到 pty {fd=3}
3 = “/dev/pty0”
在 6184 (user1) [ screen ] 中找到 pty {fd=0,1,2}
0 = “/dev/pty0”
1 = “/dev/pty0”
2 = “/dev/pty0”
在 5772 (user1) [ python ] 中找到 pty {fd=0,1,2}
0 = “/dev/pty2”
1 = “/dev/pty2”
2 = “/dev/pty2”
在 6672 (user1) [ -bash ] 中找到 pty {fd=0,1,2,31}
0 = “/dev/pty0”
1 = “/dev/pty0”
2 = “/dev/pty0”
31 = “/dev/pty0”
在 6072 (user1) [ /bin/bash ] 中找到 pty {fd=0,1,2,31}
0 = “/dev/pty3”
1 = “/dev/pty3”
2 = “/dev/pty3”
31 = “/dev/pty3”
在 4796 (user1) [ /bin/bash ] 中找到 pty {fd=0,1,2,31}
0 = “/dev/pty2”
1 = “/dev/pty2”
2 = “/dev/pty2”
31 = “/dev/pty2”
库
findProcessesUsing 是 Python 库 ProcessMappingScanner 的前端。如果您想在使用应用程序内使用 findProcessesMapping 功能,您可以考虑直接使用该库,而不是解析 findProcessesMapping 的输出。
项目详情
findProcessesUsing-2.3.2.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 09089df143ce367e2d73d6ccb896bb2d62dbee92e630cbdb643df8d0f0d22672 |
|
MD5 | 6b471f62ec99fa7081c68f8ffd974ced |
|
BLAKE2b-256 | 2146cfe612fe192d7fd588bd1478395b24a166090979c0a7afc5d80672b060c2 |