Server IP : 104.21.38.3 / Your IP : 162.158.190.109 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/sos/cleaner/archives/ |
Upload File : |
# Copyright 2021 Red Hat, Inc. Jake Hunsaker <[email protected]> # This file is part of the sos project: https://github.com/sosreport/sos # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # version 2 of the GNU General Public License. # # See the LICENSE file in the source distribution for further information. from sos.cleaner.archives import SoSObfuscationArchive import os import tarfile class SoSReportArchive(SoSObfuscationArchive): """This is the class representing an sos report, or in other words the type the archive the SoS project natively generates """ type_name = 'report' description = 'sos report archive' prep_files = { 'hostname': [ 'sos_commands/host/hostname', 'etc/hosts' ], 'ip': 'sos_commands/networking/ip_-o_addr', 'mac': 'sos_commands/networking/ip_-d_address', 'username': [ 'sos_commands/login/lastlog_-u_1000-60000', 'sos_commands/login/lastlog_-u_60001-65536', 'sos_commands/login/lastlog_-u_65537-4294967295', # AD users will be reported here, but favor the lastlog files since # those will include local users who have not logged in 'sos_commands/login/last', 'etc/cron.allow', 'etc/cron.deny' ] } @classmethod def check_is_type(cls, arc_path): try: return tarfile.is_tarfile(arc_path) and 'sosreport-' in arc_path except Exception: return False class SoSReportDirectory(SoSReportArchive): """This is the archive class representing a build directory, or in other words what `sos report --clean` will end up using for in-line obfuscation """ type_name = 'report_dir' description = 'sos report directory' @classmethod def check_is_type(cls, arc_path): if os.path.isdir(arc_path): return 'sos_logs' in os.listdir(arc_path) return False class SoSCollectorArchive(SoSObfuscationArchive): """Archive class representing the tarball created by ``sos collect``. It will not provide prep files on its own, however it will provide a list of SoSReportArchive's which will then be used to prep the parsers """ type_name = 'collect' description = 'sos collect tarball' is_nested = True @classmethod def check_is_type(cls, arc_path): try: return (tarfile.is_tarfile(arc_path) and 'sos-collect' in arc_path) except Exception: return False def get_nested_archives(self): self.extract(quiet=True) _path = self.extracted_path archives = [] for fname in os.listdir(_path): arc_name = os.path.join(_path, fname) if 'sosreport-' in fname and tarfile.is_tarfile(arc_name): archives.append(SoSReportArchive(arc_name, self.tmpdir)) return archives class SoSCollectorDirectory(SoSCollectorArchive): """The archive class representing the temp directory used by ``sos collect`` when ``--clean`` is used during runtime. """ type_name = 'collect_dir' description = 'sos collect directory' @classmethod def check_is_type(cls, arc_path): if os.path.isdir(arc_path): for fname in os.listdir(arc_path): if 'sos-collector-' in fname: return True return False # vim: set et ts=4 sw=4 :