Terminator + tmux = perfect match? Starting and attaching tmux sessions from terminator automatic with bash. @kalilinux #kali #kalilinux #linux#linux4hackers #linux #tmux #terminator #infosec #hacking #pentest #pentesting #redteam

My goal was to start Terminator, that’s the terminal program I use and the reattach to tmux sessions in the three windows that I have. If I close terminator and started it again I wanted the tmux sessions to reattach to the old ones. And I i close tmux I wanted the same tmux windows to start every time.

Looks like this:

The window upper left is my nmap terminal with 4 tmux windows
The window upper right is my tools terminal with 6 tmux windows
The lower windows is my www scanner terminal with 5 tmux windows
So 1 terminal program with 15 active “shells” no I can work without switching to a new terminator.

2020-04-02_20-14

How I did this.

  1. Create a directory under my home thats called tmux
  2. Create 3 files “nmap.sh”, “tools.sh” and “www.sh”
  3. Make them executable
  4. Start Terminator and create the layout that you want in my case see picture below
  5. Go into pref. and layouts and press save
  6. Exit and start terminator again
  7. Open preferences in Terminator and add start program on every window
  8. Edit ~/.tmux.conf if you want…not needed.
  9. Done

Files to start the tmux sessions:

#cd tmux/
#ls
nmap.sh tools.sh www.sh

#cat nmap.sh 

#!/bin/sh
tmux new-session -A -s NMAP -n 'Nmap' -d 
tmux neww -t NMAP -n '-sC-sV'
tmux neww -t NMAP -n '-p-' 
tmux neww -t NMAP -n 'Custom'
tmux selectw -t 0
tmux attach-session -t NMAP

#cat tools.sh 

#!/bin/sh
tmux new-session -A -s TOOLS -n 'nc-1' -d 
tmux neww -t TOOLS -n 'simple www'
tmux neww -t TOOLS -n 'github' 
tmux neww -t TOOLS -n 'github'
tmux neww -t TOOLS -n 'ftp'
tmux neww -t TOOLS -n 'tools'
tmux selectw -t 0
tmux attach-session -t TOOLS

#cat www.sh 
#!/bin/sh
tmux new-session -A -s WWW -n 'Web' -d 
tmux neww -t WWW -n 'dirb'
tmux neww -t WWW -n 'gobuster' 
tmux neww -t WWW -n 'nikto'
tmux neww -t WWW -n 'sqlmap'
tmux selectw -t 0
tmux attach-session -t WWW
#

Terminator prefs to autostart tmux:

2020-04-03_08-12

My tmux.conf

cat .tmux.conf 
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 1000000

# Improve colors
set -g default-terminal 'screen-256color'

# Set scrollback buffer to 10000
set -g history-limit 10000

# Customize the status line
set -g status-fg green
set -g status-bg black

# Enable mouse mode (tmux 2.1 and above)
set -g mouse on

# don't rename windows automatically
set-option -g allow-rename off

# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'

# THEME
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none

# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'

# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'

# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'bg=colour18 fg=colour137 dim'
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour19] %d/%m #[fg=colour233,bg=colour8] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '

setw -g window-status-style 'fg=colour9 bg=colour18'
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'

# messages
set -g message-style 'fg=colour232 bg=colour16 bold'

#set -g status-bg black
#set -g status-fg white
#set -g status-interval 1
#set -g status-left-length 30
#set -g status-left '#[fg=green](#S) #(whoami)'
#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M:%S#[default]'

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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