Hello my 0x00sec - Padawans! In this instalment of Paranoia and a Terminal, I am showing you how to create + use (my) AWESOME tmuxinator setup.
Person: “Errrr. Whats that?”
Me: “It’s a sort of automation package for tmux”
Person: “Coool!.. So. Whats tmux?”
Me: “Tmux is a Terminal Multiplexer, so you can literally Multiplex your Terminal”
To first explain what Tmux is, I must first explain why you would need it.
Let’s say you’re logged in via SSH, you’re messing around on the server, and then you suddenly realise, you need two terminal windows. You could open another connection to the server, but that would just be inefficient, say hello to Tmux.
Tmux allows you to have multiple ‘panes’ + ‘windows’ open in the same physical window. Here’s an example of what it looks like:
And on the second pane.
Now of course, this tmux session is something that I’ve set up as an example. I will not fully explain Tmux in this article, but there is somebody else who is very good at it and covers it nicely
Now you know what Tmux is, and how it can be useful, Tmuxinator is an awesome script that will allow you automate the creation of tmux sessions. For example, I can run
tmuxinator start mothership, and it will start a tmux session, with all my lil scripts and monitoring tools.
The first thing you’ll want to do is install Tmuxinator, the installation is straightforward and as easy as:
sudo apt-get update && sudo apt-get install tmuxinator
or if you’re on Arch.
sudo pacman -S tmuxinator
Now you’ve installed tmuxinator, you’ll need to configure your defaults, or else tmuxinator will have a fit. You probably haven’t configured a default EDITOR variable in your shell setup, so lets do that now.
If you’re cool, and are using ZSH, run:
echo "export EDITOR='nano'" >> ~/.zshrc
But if you suck, I’m Joking, and run bash:
echo "export EDITOR='nano'" >> ~/.bashrc
And now open a window, or reload your enviornment.
(Personally, I use vim, but understand a lot of people like nano, you can always change ‘nano’ to ‘vim’ and it would work equally.)
Now, you have two options, you can import my config, which may not work, or you can write your own. In my setup, I have snort installed (yes on my laptop), and have a few custom scripts I run to monitor my networking Paranoia mode > 9000
For you awesome Nullers, I have written one just for you! For this to work you must first have installed the following packages:
Once you’ve installed these (usually through your package manager, they’re pretty popular), place this file in your ~/.tmuxinator/ Directory
# ~/.tmuxinator/nullsec.yml name: nullsec root: ~/ startup_window: vpn windows: - network: slurm -i wlan0 - vpn: layout: main-horizontal panes: - echo "Insert VPN Command Here" - sudo tcpdump -i wlan0 arp - Con: while true; do timeout 5 bash -c "lsof -Pni | less"; clear; done - Glances: glances
If you’re lazy, you can run this command:
wget https://gist.githubusercontent.com/pry0cc/98cae8bb45dfba922d68e51f8f9f1e86/raw/6898b203e43c862e31c3afdca905358f64a23173/nullsec.yml -O ~/.tmuxinator/nullsec.yml
Now you have it installed, you’ll have to edit it to fit your machine, so your VPN, and your network card device, run:
tmuxinator open nullsec
This will open nano to edit it, edit the file to your needs.
Now you’re ready, just run:
tmuxinator start nullsec
And it will open a tmux window, with all your kickass monitoring tools setup and ready to go. Now for security + privacy reasons I cannot show you the setup running on my machine, you’ll have to run it on yours to see it. Here’s a cheeky preview…
Hope this helped! I apologise if I’ve been a little vague, however, Tmux + Tmuxinator is something that you need to just play around with to fully understand.
As always, stay paranoid