Improving your screenshots with zsh and GIMP

Discussing GIMP and zsh's syntax highlighting benefit in taking CLI screenshots commonly used for reporting

Improving your screenshots with zsh and GIMP

I was doing my OSCP report when I saw the screenshots on pages like 8-9 and 11-13 of the PWK Example Report.

PWK Example Report screenshot with text highlighting
PWK Example Report screenshot with text highlighting

I mean look at that! My old way of highlighting commands in a screenshot was to underline the command with a red thick line. It did the job well but was not that visually appealing especially if there were more than 1 command to underline + some red frames for other important bits in the screenshot.

My initial thoughts on the highlighted commands of the PWK Example Report was that it was processed after taking the screenshot. I was somewhat correct on this. I ran through some blogs and guides that show how to highlight words in a screenshot using GNU Image Manipulation Program (GIMP). These blogs and guides are listed below:

To sum this up basically once you had your screenshot on GIMP:

  • Add a Layer
    • Set "Fill with" with the value "Transparency"
  • Select your text with the Rectangle Select Tool (R)
  • Select Bucket Fill Tool (Shift+B) or the Paintbrush Tool (P)
  • Select the color to highlight your text with
  • On the layer mode on the right of the screen choose the mode:
    • "HSV Hue" or "HSL Color" for screenshots with dark background
    • "Screen", "Dodge" or others for lighter backgrounds
    • Try the different layer modes to see what looks best for your case
Text Highlighting using GIMP (White Background)
Text Highlighting using GIMP (White Background)
Command and Text Highlighting on Kali Terminal
Command and Text Highlighting on Kali Terminal

Here we colored the result that we meant to highlight as red and and command as purple. Notice how we also killed the color of root@kali on the top left corner of the screenshot which is by default colored red.

While already getting slightly contented with post-processed text highlighting of screenshots, I stumbled upon (drum roll) Zsh syntax highlighting! This changed a lot and was certainly the best thing that day. To be honest, I really did not know about the existence of Z Shell before this. I was already contented with bash and whatever Terminator had to offer.

I then installed zsh on my Kali. I used this guide by Shahriar Shovon then forked the Oh-my-zsh theme "risto" to fit my needs. The commands for installing zsh with my basic syntax highlighting theme is shown below:

# Updated on April 2020 to reflect new Kali setup and oh-my-zsh update issues

# Updated on May 2021 to reflect new Kali (Which already uses zsh but without syntax highlighting)

sudo apt install zsh zsh-syntax-highlighting -y
wget -O - | zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
echo "PROMPT='
%{\$FG[125]%}╭─[%T] %{\$FG[125]%}%n@%m %~
╰─❯ %{\$reset_color%}'" > ~/.oh-my-zsh/themes/trojand.zsh-theme
echo "PROMPT='%{\$fg[red]%}%n@%m:%{\$fg[blue]%}%8~ %{\$reset_color%} %~ '" > ~/.oh-my-zsh/themes/trojand2.zsh-theme
sed -i "s/ZSH_THEME=\".*\"/ZSH_THEME=\"trojand\"/g" ~/.zshrc
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
echo "ZSH_HIGHLIGHT_STYLES[line]='bold','fg=118'" >> ~/.zshrc
echo "ZSH_HIGHLIGHT_HIGHLIGHTERS=(line)" >> ~/.zshrc
source ~/.zshrc
cd ~/.oh-my-zsh
git stash
git stash apply

Voilà!! (for trojand.zsh-time [new])

Command Highlighting on zsh. (Viewing a text file)

Voilà!! (for trojand2.zsh-time [old])

Command Highlighting on zsh
Command Highlighting on zsh. (Viewing password file)
Command Highlighting on zsh. (Executing curl on an endlessly plugged site)

I left the user@hostname colored as red but not in bold anymore. I also left the current shell directory colored. These displays and colors help me quickly or easily see who I am and where I'm at. The user@hostname and current directory display and colors can be easily modified at ~/.oh-my-zsh/themes/trojand.zsh-theme. Finally, the command is bold with a green color which should be easily seen in a screenshot if your background is dark.

This would be close enough to the command and text highlighting on the PWK Example Report. If you are not highlighting any text result then zsh syntax highlighting should be enough and there is no need to use GIMP.