#!/bin/bash # ####################################### # RSO Network Diag # Description: # Collects and outputs basic network settings for troubleshooting. Optional uplaod to file.io. # Oneliners: # bash <(curl -s https://cdn.rso.bg/scripts/rsonetworkdiag.sh) # bash <(wget -qO- https://cdn.rso.bg/scripts/rsonetworkdiag.sh) # Globals: # None # Arguments: # None ####################################### apt install -y dnsutils net-tools traceroute curl declare -x netDiagVersion=1.3 printf "\n=== RSO Network Diag $netDiagVersion\n" 2>&1 | tee -a /tmp/netdiag.rso declare -a cmdArray=("cat /proc/version; uname -r" "netstat -rn" "iptables -L -v -n | more" "ip a" "ip neigh" "ip -br address show" "ss -tunlp4" "ss -tunlp6" "traceroute -4 1.1.1.1" "ping 1.1.1.1 -c 3") for i in "${cmdArray[@]}" do printf "\e[42m" printf "\n================================" printf "\n=== Output of: \e[30m$i\e[0m\e[42m" printf "\n================================" printf "\e[0m\n" echo "================================" >> /tmp/netdiag.rso echo "=== Output of: $i" >> /tmp/netdiag.rso echo "================================" >> /tmp/netdiag.rso eval $i 2>&1 | tee -a /tmp/netdiag.rso done unset cmdArray unset netDiagVersion while true; do read -p "Try to upload output to file.io (y/n)? " yn case $yn in [Yy]* ) curl -F "file=@/tmp/netdiag.rso" https://file.io/?expires=1w;rm /tmp/netdiag.rso;printf "\n"; break;; [Nn]* ) rm /tmp/netdiag.rso;printf "\n";break;; * ) echo "Please answer yes or no.";; esac done