mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-04-19 00:45:22 +00:00
updated network info output
This commit is contained in:
parent
436a951537
commit
3791aa84d2
30
yabs.sh
30
yabs.sh
@ -253,6 +253,14 @@ echo -e "Kernel : $KERNEL"
|
|||||||
VIRT=$(systemd-detect-virt 2>/dev/null)
|
VIRT=$(systemd-detect-virt 2>/dev/null)
|
||||||
VIRT=${VIRT^^} || VIRT="UNKNOWN"
|
VIRT=${VIRT^^} || VIRT="UNKNOWN"
|
||||||
echo -e "VM Type : $VIRT"
|
echo -e "VM Type : $VIRT"
|
||||||
|
if [[ ! -z $IPV4_CHECK && ! -z $IPV6_CHECK ]]; then
|
||||||
|
ONLINE="IPv4 & IPv6"
|
||||||
|
elif [[ ! -z $IPV4_CHECK ]]; then
|
||||||
|
ONLINE="IPv4"
|
||||||
|
elif [[ ! -z $IPV6_CHECK ]]; then
|
||||||
|
ONLINE="IPv6"
|
||||||
|
fi
|
||||||
|
echo -e "Net Online : $ONLINE"
|
||||||
|
|
||||||
# Function to get information from IP Address using ip-api.com free API
|
# Function to get information from IP Address using ip-api.com free API
|
||||||
function ip_info() {
|
function ip_info() {
|
||||||
@ -271,36 +279,30 @@ function ip_info() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local country=$(echo "$response" | grep -Po '"country": *\K"[^"]*"')
|
local country=$(echo "$response" | grep -Po '"country": *\K"[^"]*"')
|
||||||
local country=${country//\"}
|
country=${country//\"}
|
||||||
|
|
||||||
local region=$(echo "$response" | grep -Po '"regionName": *\K"[^"]*"')
|
local region=$(echo "$response" | grep -Po '"regionName": *\K"[^"]*"')
|
||||||
local region=${region//\"}
|
region=${region//\"}
|
||||||
|
|
||||||
local region_code=$(echo "$response" | grep -Po '"region": *\K"[^"]*"')
|
local region_code=$(echo "$response" | grep -Po '"region": *\K"[^"]*"')
|
||||||
local region_code=${region_code//\"}
|
region_code=${region_code//\"}
|
||||||
|
|
||||||
local city=$(echo "$response" | grep -Po '"city": *\K"[^"]*"')
|
local city=$(echo "$response" | grep -Po '"city": *\K"[^"]*"')
|
||||||
local city=${city//\"}
|
city=${city//\"}
|
||||||
|
|
||||||
local isp=$(echo "$response" | grep -Po '"isp": *\K"[^"]*"')
|
local isp=$(echo "$response" | grep -Po '"isp": *\K"[^"]*"')
|
||||||
local isp=${isp//\"}
|
isp=${isp//\"}
|
||||||
|
|
||||||
local org=$(echo "$response" | grep -Po '"org": *\K"[^"]*"')
|
local org=$(echo "$response" | grep -Po '"org": *\K"[^"]*"')
|
||||||
local org=${org//\"}
|
org=${org//\"}
|
||||||
|
|
||||||
local as=$(echo "$response" | grep -Po '"as": *\K"[^"]*"')
|
local as=$(echo "$response" | grep -Po '"as": *\K"[^"]*"')
|
||||||
local as=${as//\"}
|
as=${as//\"}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Basic Network Information:"
|
echo "$net_type Network Information:"
|
||||||
echo "---------------------------------"
|
echo "---------------------------------"
|
||||||
|
|
||||||
if [[ -n "$net_type" ]]; then
|
|
||||||
echo "Protocol : $net_type"
|
|
||||||
fi
|
|
||||||
if [[ -z "$net_type" ]]; then
|
|
||||||
echo "Protocol : Unknown"
|
|
||||||
fi
|
|
||||||
if [[ -n "$isp" && -n "$as" ]]; then
|
if [[ -n "$isp" && -n "$as" ]]; then
|
||||||
echo "ISP : $isp"
|
echo "ISP : $isp"
|
||||||
echo "ASN : $as"
|
echo "ASN : $as"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user