Have your IP addresses displayed all the time
We always have multiple network interfaces, each showing a different IP address. Sometimes we need to check quickly one of our IP addresses, be it for a reverse shell or for reference in anything else. I found it somewhat annoying to keep checking and searching for a specific address on my terminal. This is why I decided to create a script that displays all the interfaces I want at all time, right on my taskbar.
This is a demonstration:
There are only 3 steps in achieving it:
1- Create generic monitor item in the taskbar: Right-click taskbar -- Panel -- New item -- Generic monitor.
2- Create the script below, assign it to a bash script file and select it as a command to execute in the Generic panels’ configuration.
#!/bin/bash
for interface in {eth0,eth1,tun0,tun1};do
IP=$(ip a s | grep $interface | grep inet | awk -F' ' '{print $2}') #| awk -F'/' '{print $1}'
if [[ $? != 0 ]]; then
echo "System error"
elif [[ $IP ]]; then
echo -n "| $interface: $IP |"
else
echo -n "| no $interface |"
fi
done
3- Enjoy and check out (if you see fit) my other scripts, but also my cheatsheets, templates and walkthroughs.