Displaying IP in the top
Step 1: Open Nano editor
sudo nano /usr/share/kali-themes/xfce4-panel-genmon-ip.shStep 2: Add script
#!/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



Last updated