Useful IP widget for CTFs
Who can’t use more convenience?
If you’re familiar with VPN profiles when it comes to CTF programs like THM and HTB, I’m sure you’ve forgotten your IP address a few times. Sure you can always
ip a or
ifconfig but if you’re like me, that interrupts your workflow and it’s quite annoying.
After a while, I was tired of forgetting something that I would want to always have ready at hand. So instead of being annoyed, I decided I was going to look for a solution…and I found a great one. I stumbled upon this GitHub repo for a tool called ip_widget, which is a super helpful IP widget for CTFs.
You set it up on your taskbar in Kali (or whatever version of Linux you’re using) with whatever interface you want, and it just works.
In this post, I’ll show you how to utilize such a nifty little script and what you can do with it.
Before we jump in, let’s go to the directory within Linux that we want to use. I recommend
/opt. Or, if you have Kali set up as the root user, you can use
/root. Depending on your user’s permissions you may want to put this someplace appropriate.
The first thing we’re going to need is the command to get the file. Once you’re in the directory of your choice, go ahead and run the following command:
This will download the script in your current directory. After that, let’s give it permissions:
Code language: CSS (css)
sudo chmod 770 ip_widget.sh
Configuring the taskbar
Next, we need to set it up on the taskbar. If you want to have multiple interfaces in the taskbar like I do, you can repeat the following steps as many times as you want, or modify the script if you’re capable of doing so. Here is my current configuration:
eth0 section shows my local NAT IP for my VMware network. The
tun0 will auto-populate with whichever VPN connection you are using on that adapter. This means both TryHackMe and HackTheBox will be automatically filled out here. Quite handy.
Now for the setup with screenshots-a-plenty.
Right-click the taskbar, highlight panel, and click “add new items…”
Filter and Select “Generic Monitor”
…and then hit “Add”
Locate the monitor, right-click, and hit properties.
Configure the widget
I’ll write a few common paths for the command and their respective adapter for ease:
Code language: Bash (bash)
- /root/ip_widget eth0 - /root/ip_widget tun0 ------------------------- - /opt/ip_widget eth0 - /opt/ip_widget tun0 ------------------------- - /home/kali/ip_widget eth0 - /home/kali/ip_widget tun0
Then you can set the label to whatever you want.
Right-click and hit move, so you can position the widget where you want.
Repeat 1 through 5 to add additional widgets or even separators to have a bar in between them (how mine is set up). Creative freedom is entirely up to you.
This has been such a boost to QOL for me and I hope whoever finds this also finds the same level of convenience from it. It’s something I literally use every day. From swapping between THM, HTB, or other CTF platforms, and even my home labs, it’s been such a time saver.
This post was written by Cybr community member Stoni. Check out his Twitter and LinkedIn for more interesting tips and tricks.