Displaying IP in the top
If you're tired of repeatedly checking your Kali Linux IP address, you can automate the process using the method below. This will display your IP address in the top left panel, ensuring you always have it in view. When connected to a VPN, your VPN IP will be shown; otherwise, your internal IP from the eth0 interface will be displayed.
Step 1: Open Nano editor
Open the file in this location.
sudo nano /usr/share/kali-themes/xfce4-panel-genmon-ip.shStep 2: Add script
Add the Below script to this file and save it.
#!/bin/bash
# Check if tun0 (VPN) is up and has an IP
if ip link show tun0 2>/dev/null | grep -q "UP"; then
vpn_ip=$(ip -4 addr show tun0 | grep -oP '(?<=inet )[^/]+')
if [ -n "$vpn_ip" ]; then
echo "<txt>$vpn_ip</txt>"
echo "<tool>VPN IP: $vpn_ip</tool>"
exit 0
fi
fi
# If tun0 isn't up or has no IP, fallback to eth0
eth_ip=$(ip -4 addr show eth0 | grep -oP '(?<=inet )[^/]+')
if [ -n "$eth_ip" ]; then
echo "<txt>$eth_ip</txt>"
echo "<tool>Local IP (eth0): $eth_ip</tool>"
else
echo "<txt>Not Connected</txt>"
echo "<tool>No VPN or Local IP Found</tool>"
fi
Step 3: Changing file location
Update the file path in Generic Monitor to the new location.
Right-click on your XFCE panel and select Panel > Panel Preferences (or similar).

Go to the Items tab find your Generic Monitor (GenMon) item and Click Properties (or a gear icon) to edit its configuration.

Add a new location and save it.

Done !!!
Last updated