Useful IP widget for CTFs

IP Widget for CTFs banner

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.

Downloading ip_widget.sh

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:

wget https://raw.githubusercontent.com/psbelin/ip_widget/master/ip_widget.sh
Code language: JavaScript (javascript)

This will download the script in your current directory. After that, let’s give it permissions:

sudo chmod 770 ip_widget.sh
Code language: CSS (css)

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:

Example IP setup

The 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.

Step 1:
Right-click the taskbar, highlight panel, and click “add new items…”

Adding a new item

Step 2:
Filter and Select “Generic Monitor”

Selecting the monitor

…and then hit “Add”

Step 3:
Locate the monitor, right-click, and hit properties.

Editing the monitor's properties

Step 4:
Configure the widget

How to configure an adapter to monitor the IP

I’ll write a few common paths for the command and their respective adapter for ease:

- /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
Code language: Bash (bash)

Then you can set the label to whatever you want.

Step 5:
Right-click and hit move, so you can position the widget where you want.

Moving the IP display on the taskbar

Step 6?:
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.

Conclusion

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.

Related Articles

Responses

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.