Parrot Terminal Prompt in Kali Linux

Fahmi J
2 min readOct 21, 2020
Photo by Yancy Min on Unsplash

After trying Hack The Box PwnBox (a web based machine), I liked its fancy terminal! So I’m looking one for my Kali box and apply the same styles (well kind of) on it and then I finally found this awesome parrot-like terminal on Github.

You can manually replace and overwrite your original .bashrc or follow the instructions from the link above, then simply restart the terminal or run this command to apply immediately.

$ source ~/.bashrc 

I added a space to create a little gap between # $ symbols and the initial cursor. See the image below.

A space

Adding IP to the prompt

One thing missing in this style is the IP address, so let’s add it!

First, open your .bashrc file and add this script.

# Get IP
function get_ip(){
tunnel_ip=`ifconfig tun0 2>/dev/null | grep netmask | awk ‘{print $2}’` # it can be thm or htb IP
default_ip=`ifconfig eth0 2>/dev/null | grep netmask | awk ‘{print $2}’` # use eth0 as default IP,
if [[ $tunnel_ip == *”10.”* ]]; then
echo $tunnel_ip
else
echo $default_ip
fi
}

Since my purpose here to display HackTheBox VPN IP, I created a condition to switch whether to display the local IP (eth0) or the VPN IP (tun0).

Okay, next, find the following line.

# If this is an xterm set the title to user@host:dir

Then replace the entire PS1 variable with this one (if it’s doesn’t work, copy from here).

PS1=”\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \”[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\”)[$(if [[ ${EUID} == 0 ]]; then echo ‘\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h’; else echo ‘\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h’; fi)\[\033[0;31m\]]\342\224\200[\033[0;31m\]\[\033[1;97m\]”\`get_ip\`”\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\] “

And done

Now if I connected to the VPN, the IP will change like this.

htbon is my alias to connect to the VPN

If you want to customize the color or other things, check out this site: http://bashrcgenerator.com/

That’s all, hope you like it, thank you.

--

--

Fahmi J

Just curious to learn how things work, especially in digital world.