From 01dad9c358567b157df8bd0e88894fe7a96fecb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gu=C3=A9gan?= Date: Thu, 4 Jul 2024 17:04:32 +0200 Subject: [PATCH] Improve dump --- README.md | 22 +++++++++++++--------- sysdump.sh | 15 ++++++++++----- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d2341d4..5f8c480 100644 --- a/README.md +++ b/README.md @@ -18,21 +18,25 @@ Explore specific entries of a dump: # Useful entries Important note: Depending on the system, some entries may not be available. -| Entry | Description | -|-------------------------|------------------------------------------------------------------| -| compgen | List all available commands in current shell | -| ping | Check if ping succeed (internet is available) | -| boot_folder | Recursive listing of /boot/ | -| root_folder | Content of / | -| home_folder | Content of $HOME | -| cmd_\_version | Get the version of some specific commands (e.g: gcc, python etc) | +| Entry | Description | +|--------------------------|------------------------------------------------------------------| +| compgen | List all available commands in current shell | +| ping | Check if ping succeed (internet is available) | +| boot_folder | Recursive listing of /boot/ | +| root_folder | Content of / | +| home_folder | Content of $HOME | +| cmd_\_version | Get the version of some specific commands (e.g: gcc, python etc) | +| /proc/cmdline | See kernel parameters | +| /boot/config-$(uname -r) | Get kernel config | +| users | List logged users | +| declare | Get all shell define variables, functions etc | # Notes -- To see what is dump look into `sysdump.sh` - Some commands require root permissions. If `sysdump.sh` is not run as root, these commands will not be executed. - List available entries: > cat dump.json |grep -o ".*:" - List available command versions: > cat dump.json |grep -o "cmd_.*_version" +- For more infos on what is actually dump see `sysdump.sh` diff --git a/sysdump.sh b/sysdump.sh index 4237bc5..fa4b966 100755 --- a/sysdump.sh +++ b/sysdump.sh @@ -52,10 +52,8 @@ then exit 0 fi -# Check commands exists +# Check commands exist ensure base64 -ensure date -ensure find # Start dump echo "{" @@ -63,6 +61,8 @@ USE_COMMA=1 # safecat dump "/etc/nftables.conf" safecat /etc/nftables.conf dump "/etc/group" safecat /etc/group +dump "$HOME/.bashrc" safecat $HOME/.bashrc +dump "$HOME/.bash_profile" safecat $HOME/.bash_profile dump "/etc/fstab" safecat /etc/fstab dump "/etc/ssh/sshd_config" safecat /etc/ssh/sshd_config dump "/proc/cpuinfo" safecat /proc/cpuinfo @@ -93,6 +93,7 @@ dump "free" safecmd free -h dump "df" safecmd df -h dump "boot_folder" safecmd ls -R /boot/ dump "home_folder" safecmd ls -al ${HOME} +dump "root_folder" safecmd ls -al / dump "uid" safecmd id -u dump "gid" safecmd id -g dump "gids" safecmd id -G @@ -108,17 +109,21 @@ dump "lsmod" safecmd lsmod dump "lspci" safecmd lspci dump "lsirq" safecmd lsirq dump "lsfd" safecmd lsfd -dump "root_folder" safecmd ls -al / dump "glxinfo" safecmd glxinfo -B dump "compgen" safecmd compgen -c dump "openssl" safecmd openssl +dump "users" safecmd users +dump "declare" safecmd declare dump "ping" safecmd ping -c 2 -W 2 4.2.2.2 -for cmd in bash gcc ld python3 cmake make tar zip gzip bzip2 xz cpio wget rsync curl node pip apt cat systemctl gpg R ruby awk grep sshfs +# dump versions +for cmd in bash gcc ld python3 cmake make tar zip gzip bzip2 xz cpio wget rsync curl node pip apt cat systemctl gpg R ruby awk grep sshfs docker java do dump "cmd_${cmd}_version" safecmd $cmd --version done dump "cmd_ssh_version" safecmd sshd -V dump "cmd_tmux_version" safecmd tmux -V +dump "cmd_nginx_version" safecmd nginx -v +dump "cmd_go_version" safecmd go version # safecmdroot dump "dmidecode" safecmdroot dmidecode dump "iptables" safecmdroot iptables -L