Paranoia and a Terminal - Part 0x01 - Tmuxinator

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”

Person: “???”

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

https://www.youtube.com/watch?v=BHhA_ZKjyxo

Tmuxinator

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:

  • slurm
  • tcpdump
  • glances

Once you’ve installed these (usually through your package manager, they’re pretty popular), place this file in your ~/.tmuxinator/ Directory

nullsec.yml

# ~/.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 :wink:

  • pry0cc

Futher reading

10 Likes

Great stuff. tmux is awesome!

1 Like

Been meaning to pick up tmuxinator for awhile now - thanks for this pry0cc!

1 Like

No worries! Glad I could help!

Awesome, this is just what I’m looking for!

Thanks for this article mate.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.