Created
October 22, 2017 15:58
-
-
Save boina-n/35e8d78bb7218ffdb21b76b9eb298850 to your computer and use it in GitHub Desktop.
GetLinuxInfo.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dir=/tmp/Results | |
rm -rf $dir | |
mkdir -p $dir | |
echo "Hostname : " | |
hostname | |
echo "" | |
ip addr show |awk '{ print $2 }' | grep ^[a-Z] |tr -d : | while read p ; do int=$(ip addr show $p | awk '/inet/ { print $2 }') ; echo "$p: $int "; done | |
ifconfig > $dir/ifconfig | |
echo "" | |
echo "Number of processors: $(cat /proc/cpuinfo | grep processor | wc -l)" | |
echo "" | |
echo "processors architecture: $(cat /proc/cpuinfo | grep flags | uniq | sed "s/.* lm .*/x64/" | sed "s/.....*/x32/")" | |
cat /proc/cpuinfo > $dir/cpuinfo | |
echo "" | |
echo "RAM available: $(free -m | grep Mem | sed -r "s/[^0-9]*([0-9]+).*/\1/")" | |
free > $dir/ram | |
echo "" | |
echo "iptables used: $(iptables -L | wc -l | sed -r "s/^8$/no/" | sed -r "s/[0-9]+/yes/")" | |
iptables -L > $dir/iptables | |
echo "" | |
echo "ip6tables used: $(ip6tables -L 2>/dev/null | wc -l | sed -r "s/^0$/no/" | sed -r "s/^8$/no/" | sed -r "s/[0-9]+/yes/")" | |
ip6tables -L 2>/dev/null > $dir/ip6tables | |
echo "" | |
echo "resolv.conf present and filled: $(ls /etc/resolv.conf 2>&1 >/dev/null && grep -e "^[^#]*nameserver" /etc/resolv.conf >/dev/null && echo "yes" || echo "no")" | |
cp /etc/resolv.conf $dir/resolv.conf 2>/dev/null | |
echo "" | |
echo "running services: $(service --status-all 2>&1 | grep 'running')" | |
service --status-all 2>&1 > $dir/services | |
echo "" | |
echo "bind installation directory (location of named.conf): $(find -L /etc /usr /var -name named.conf 2>/dev/null | sed -r 's!/[^/]*$!!')" | |
#cp -r $bindDir $dir/ | |
echo "Generating tarball with these informations in $dir ..." | |
tar -chvf $dir/audit`hostname`.tar $dir 2>/dev/null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment