linux信息收集篇之sosreport
sosreport是一个类型于supportconfig 的工具,sosreport是python编写的一个工具,适用于centos(和redhat一样,包名为sos)、ubuntu(其下包名为sosreport)等大多数版本的linux 。sosreport在github上的托管页面为:https://github.com/sosreport/sos,而且默认在很多系统的源里都已经集成有。如果使用的是正版redhat,在出现系统问题,寻求官方支持时,官方一般也会通过sosreport将收集的信息进行分析查看。需要注意的是在一些老的redhat发行版中叫sysreport ------ 如redhat4.5之前的版本中。
一、sosreport的安装
在默认使用linux发行版的源进行安装时,由于在不同的系统上包名称也会有差异,所以使用的命令也不同,如redhat和ubuntu平台的安装如下:
- // redhat/centos下的安装
- # yum -y insatll sos
- // ubuntu下的安装
- # sudo apt-get install sosreport
二、sosreport用法
可以使用sosreport --help或man sosreport 获取使用帮助手册,如下:
- [root@361way ~]# sosreport --help
- Usage: sosreport [options]
- Options:
- -h, --help show this help message and exit
- -l, --list-plugins list plugins and available plugin options
- -n NOPLUGINS, --skip-plugins=NOPLUGINS
- disable these plugins
- -e ENABLEPLUGINS, --enable-plugins=ENABLEPLUGINS
- enable these plugins
- -o ONLYPLUGINS, --only-plugins=ONLYPLUGINS
- enable these plugins only
- -k PLUGOPTS, --plugin-option=PLUGOPTS
- plugin options in plugname.option=value format (see
- -l)
- -a, --alloptions enable all options for loaded plugins
- --batch batch mode - do not prompt interactively
- --build keep sos tree available and dont package results
- -v, --verbose increase verbosity
- --quiet only print fatal errors
- --debug enable interactive debugging using the python debugger
- --ticket-number=TICKET_NUMBER
- specify ticket number
- --name=CUSTOMER_NAME specify report name
- --config-file=CONFIG_FILE
- specify alternate configuration file
- --tmp-dir=TMP_DIR specify alternate temporary directory
- --report Enable HTML/XML reporting
- --profile turn on profiling
- -z COMPRESSION_TYPE, --compression-type=COMPRESSION_TYPE
- compression technology to use [auto, zip, gzip, bzip2,
- xz] (default=auto)
- Some examples:
- enable cluster plugin only and collect dlm lockdumps:
- # sosreport -o cluster -k cluster.lockdump
- disable memory and samba plugins, turn off rpm -Va collection:
- # sosreport -n memory,samba -k rpm.rpmva=off
上面也列出了具体操作的示例。其中-l 参数会列出当前enable和disable的所有服务插件及当前available的所有插件。
- [root@361way log]# sosreport -a --report
- sosreport (version 3.0)
- This command will collect diagnostic and configuration information from
- this CentOS Linux system and installed applications.
- An archive containing the collected information will be generated in
- /var/tmp and may be provided to a CentOS support representative.
- Any information provided to CentOS will be treated in accordance with
- the published support policies at:
- https://www.centos.org/
- The generated archive may contain data considered sensitive and its
- content should be reviewed by the originating organization before being
- passed to any third party.
- No changes will be made to system configuration.
- Press ENTER to continue, or CTRL-C to quit.
- Please enter your first initial and last name [361way.com]:
- Please enter the case number that you are generating this report for:
- Running plugins. Please wait ...
- Running 68/68: yum...
- Creating compressed archive...
- Your sosreport has been generated and saved in:
- /var/tmp/sosreport-361way.com-20140912204339.tar.xz
- The checksum is: eaf5b2cbb1e9be68d41be5e5a60a61b6
- Please send this file to your support representative.
如上所示,我使用-A 启用所有的模块,--report是开启所有的结果以html /xml 的格式一个总的报告。生成的包需要通过下面的命令进行解包。
- # xz -d ***.tar.xz
- # tar -xvf ***.tar
- 或直接使用下面的命令一步完成解压
- tar xvJf ***.tar.xz
在解包后的sos_reports 目录会有report的结果sos.html文件生成,同时会有sos.txt文件生成,该文件内列出了具体执行的命令及copy 文件的一些信息。html 打开的内容如下:

由于页面较大,这里只截出了最上面的部分,列出了所有的收集模块,下面alerts 给出了报警模块的信息。再往下就是具体到每一个模块的信息。
三、sosreport配置文件
sosreport的配置文件是/etc/sos.conf ,默认内容如下:
- [root@361way ~]# cat /etc/sos.conf
- [general]
- #ftp_upload_url = ftp://example.com/incoming
- #gpg_keyring = /usr/share/sos/rhsupport.pub
- #gpg_recipient = support@redhat.com
- smtp_server = None
- [plugins] //此处可以设置默认enable和disable的模块
- #disable = rpm, selinux, dovecot
- [tunables] //可调参数
- #rpm.rpmva = off
- #general.syslogsize = 15
从配置文件上可以看出,sosreport同样将收集的结果上传到server 上,可以通过man sos.conf 查看配置文件的帮助信息,不过man给出的并没有太多信息,想在了解更多的信息可以查看 sosreport在github上的wiki页 。
四、sosreport总结
相于supportconfig,由于sosreport是由python语言进行编写的,所以其在功能扩展上更有优势,但由于在不同的发行版本上的python版本不同,在进行功能扩展时,对不同版本间的异常处理相对麻烦。而supportconfig由于是shell 语言编写的一个工具,对版本的依赖相对少些 ,但对一些工具的依赖相对多些 ,如在获取进程相关的信息时,shell 需要将ps 工具或处理proc的结果,而sosreport则可以直接import psutil 模块,两者之间的区别,归根到底就是shell 和python的区别。
linux信息收集篇之sosreport的更多相关文章
- Kali Linux信息收集工具
http://www.freebuf.com/column/150118.html 可能大部分渗透测试者都想成为网络空间的007,而我个人的目标却是成为Q先生! 看过007系列电影的朋友,应该都还记得 ...
- Kali Linux信息收集工具全集
001:0trace.tcptraceroute.traceroute 描述:进行路径枚举时,传统基于ICMP协议的探测工具经常会受到屏蔽,造成探测结果不够全面的问题.与此相对基于TCP协议的探测,则 ...
- Kali Linux信息收集工具全
可能大部分渗透测试者都想成为网络空间的007,而我个人的目标却是成为Q先生! 看过007系列电影的朋友,应该都还记得那个戏份不多但一直都在的Q先生(由于年级太长目前已经退休).他为007发明了众多神奇 ...
- 内网渗透----Linux信息收集整理
一.基础信息收集 1.查看系统类型 cat /etc/issue cat /etc/*-release cat /etc/lsb-release cat /etc/redhat-release 2.内 ...
- web安全之信息收集篇
信息收集 1.网络信息 网络信息就包括网站的厂商.运营商,网站的外网出口.后台.OA. 2.域名信息 通过域名可以查洵网站的所有人.注册商.邮箱等信息 --->Whois 第三方查询,查询子域网 ...
- linux信息收集
1.系统区分debian系列:debian.ubunturedhat系列:redhat.centos 是否为docker.或者为虚拟机 分为通用模块.单独模块的信息获取 2.系统信息收集 内核(是否为 ...
- kali linux 信息收集(Kismet)
1.kismet工具,是一个无线扫描工具,该工具通过测量周围的无线信号,可以扫描到周围附近所用可用的Ap,以及信道等信息.同时还可以捕获网络中的数据包到一个文件中.这样可以方便分析数据包.下面我将详细 ...
- 网络安全-主动信息收集篇第二章-三层网络发现之ping
第三层网络扫描基于TCP/IP.ICMP协议. 优点:可路由.速度比较快 缺点:相对于二层网络扫描较慢,容易被边界防火墙过滤 所有扫描发现技术,都会有相应的对抗办法,所以无论是来自二层的网络扫描还是来 ...
- 网络安全-主动信息收集篇第二章SNMP扫描
SNMP扫描: snmp在中大型企业中可以用来做网络管理和网络监控的使用,当开启了snmp简单网络管理后,那么客户机就可以通过这个协议向该设备发送snmp协议内容可以轻松查询到目标主机的相关信息. 以 ...
随机推荐
- springboot+zuul(一)------实现自定义过滤器、动态路由、动态负载。
参考:https://blog.csdn.net/u014091123/article/details/75433656 https://blog.csdn.net/u013815546/articl ...
- java设计模式(详)
http://www.runoob.com/design-pattern/design-pattern-tutorial.html
- XSS事件(一)
前言 最近做的一个项目因为安全审计需要,需要做安全改造.其中自然就包括XSS和CSRF漏洞安全整改.关于这两个网络安全漏洞的详细说明,可以参照我本篇博客最后的参考链接.当然,我这里并不是想写一篇安 ...
- 并发编程 —— Java 内存模型总结图
关于 Java 内存模型的类似思维导图. 如有错误,还请指正.
- 几句话的事儿,LogBack急速使用
1.说说logback 在java的世界里面好像从来只有log4j,因为它是在太有名气了.说实话,我也没觉得它那里不好,至少在我自己的项目里,它工作的好好的.但是主流有一种声音,在慢慢的放弃它,最始作 ...
- C# ABP 允许跨域请求
备注:无论有没有安装 apb zero模块,都可以使用本文的跨域 首先配置Web Api: 1. 在Web API项目下,安装包 Install-Package Microsoft.AspNet.We ...
- EF批量操作数据与缓存扩展框架
前言 在原生的EF框架中,针对批量数据操作的接口有限,EF扩展框架弥补了EF在批量操作时的接口,这些批量操作包括:批量修改.批量查询.批量删除和数据缓存,如果您想在EF中更方便的批量操作数据,这个扩展 ...
- C# 利用反射将枚举绑定到下拉框
前言:反射(Reflection)是.NET提供给开发者的一个强大工具,尽管作为.NET框架的使用者,很多时候不会用到反射.但在一些情况下,尤其是在开发一些基础框架或公共类库时,使用反射会使系统架构更 ...
- MySQL数据库的配置
一.配置MySQL数据库 MySQL的官网www.mysql.com 1.解压绿色版mysql,并改名为mysql5.7,如下图 对比一下下图5.6以前的版本,少data目录(存放数据)和my-def ...
- Retrofit 2.0 使用和原理
使用教程: http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/1016/3588.html retrofit2 与okhttp关系 ...