Skip to content

A polybar module that allows to show and copy to clipboard the IP address of a network interface. Also change the IP (interface selected) through Rofi.

Notifications You must be signed in to change notification settings

arturovergara/polybar-interface-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polybar-interface-switch

This polybar module shows the IP address of a specific network interface. Also allows you to change the selected interface with right-click and copy the IP address to the clipboard with left-click. It's very useful in CTF games when you have to constantly copy your IP address for a reverse shell.

Usage

  • Left Click: Copy the IPv4 address of the previously selected network interface.
  • Right Click: Launch Rofi menu to select a new network interface.

Dependencies

  • iproute2: To list the available network interfaces and their associated IP addresses.
 # If for an incredible reason you don't have this indispensable network tool installed
 $ apt install iproute2 -y
  • xclip: To copy the IP address to clipboard.
 # Install xclip from apt
 $ apt install xclip -y

Setup

# interface_switch.sh
SDIR="$HOME/.config/polybar/scripts"
CONFIG_FILE="$SDIR/interface.conf"    # Store the selected network interface
STYLES_FILE="$SDIR/interface.rasi"    # Styles for rofi menu

# copy_ip.sh
CONFIG_FILE="$HOME/.config/polybar/scripts/interface.conf"

# show_ip.sh
CONFIG_FILE="$HOME/.config/polybar/scripts/interface.conf"
  • Add the following code in your polybar config.
[module/interface_switch]
type = custom/script

format-background = ${color.alt-bg}
format-foreground = ${color.green}
format-padding = 2

interval = 90
exec = ~/.config/polybar/scripts/show_ip.sh
click-left = ~/.config/polybar/scripts/copy_ip.sh &
click-right = ~/.config/polybar/scripts/interface_switch.sh &

About

A polybar module that allows to show and copy to clipboard the IP address of a network interface. Also change the IP (interface selected) through Rofi.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages