Skip to content

Commit

Permalink
tmux
Browse files Browse the repository at this point in the history
  • Loading branch information
jm33-m0 committed Jan 25, 2020
1 parent 674b2bd commit 4787a46
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 2 deletions.
175 changes: 175 additions & 0 deletions .tmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# -- general -------------------------------------------------------------------

set -g default-terminal "screen-256color" # colors!
setw -g xterm-keys on
set -s escape-time 10 # faster command sequences
set -sg repeat-time 600 # increase repeat timeout
set -s focus-events on

# Fix Ctrl+Arrow for PuTTY
set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-x
bind-key C-x send-prefix

# prefix-C-z causes blankscreen, tmux gets suspended
unbind C-z

set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on

# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'


# -- display -------------------------------------------------------------------

set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows

setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed

set -g set-titles on # set terminal title

set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time

set -g status-interval 10 # redraw status line every 10 seconds

# clear both screen and history
bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history

# activity
set -g monitor-activity on
set -g visual-activity off


# -- navigation ----------------------------------------------------------------

# create session
bind C-c new-session

# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'

# split current window horizontally
bind _ split-window -v -c '#{pane_current_path}'
# split current window vertically
bind - split-window -h -c '#{pane_current_path}'

# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one

# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2

# window navigation
unbind n
unbind p
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind Tab last-window # move to last active window

# -- list choice (tmux < 2.4) --------------------------------------------------

# vi-choice is gone in tmux >= 2.4
run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true'
run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true'
run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true'
run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true'
run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true'
run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true'
run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true'


# -- edit mode (tmux < 2.4) ----------------------------------------------------

# vi-edit is gone in tmux >= 2.4
run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true'
run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true'
run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true'
run -b 'tmux bind -ct vi-edit Escape cancel 1> /dev/null || true'


# -- copy mode -----------------------------------------------------------------

bind Enter copy-mode # enter copy mode

run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'

# # copy to Mac OSX clipboard
# if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# # copy to X11 clipboard
# if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
# # if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# # copy to Windows clipboard
# if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"'
# if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"'


# -- buffers -------------------------------------------------------------------

bind b list-buffers # list paste buffers
bind p paste-buffer # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from

# -- better UX -----------------------------------------------------------------

set -g mouse on
set -g history-limit 10000 # same as terminal itself
set -g pane-active-border-style bg=default,fg=colour4


# -- status line --------------------------------------------------------------
set -g status-position bottom
set -g status-justify left
set -g status-left-length 200
set -g status-right-length 200


set -g status-left '#[fg=colour16,bg=colour254,bold] ❐ #S #[fg=colour255,bg=colour24,bold] #(uptime --pretty) '
set -g status-right ' #{?client_prefix,C-x,} #[fg=colour255,bg=colour24,bold] #{=21:pane_title} #[fg=colour255,bg=colour8,bold] %H:%M %m-%d #[fg=colour232,bg=colour249,bold] #(echo #{pane_current_command}) #(ps -o args -p `pgrep -P #{pane_pid}`|grep ssh|cut -d " " -f2-) '

set -g status-style fg=colour15,bg=colour233
# set -g status-left-style fg=colour255,bg=colour233,bold
# set -g status-right-style fg=colour255,bg=colour233,bold

# -- window status -------------------------------------------------------------

# normal tab
set -g window-status-format " #I:#W #F "

# current tab
set -g window-status-current-format " #I:#W:#F "
set -g window-status-current-style fg=colour15,bg=colour233,bold

# activity in window
set -g window-status-activity-style fg=default,underscore

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

# messages
setw -g message-style fg=black,bg=colour226,bold
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,28 @@ post-exploitation framework for linux

## updates

[https://jm33.me/emp3r0r-0x00.html](https://jm33.me/emp3r0r-0x00.html)
<a href="https://jm33.me/emp3r0r-0x00.html" target="_blank"><img src="https://jm33.me/img/emp.jpg" /></a>

## demo

[![asciicast](https://asciinema.org/a/Dya7dm71mhtKxUkM9PbbHmXEk.svg)](https://asciinema.org/a/Dya7dm71mhtKxUkM9PbbHmXEk)
<a href="https://asciinema.org/a/Dya7dm71mhtKxUkM9PbbHmXEk" target="_blank"><img src="https://asciinema.org/a/Dya7dm71mhtKxUkM9PbbHmXEk.svg" /></a>

## how to test

### build
```
git clone [email protected]:jm33-m0/emp3r0r.git
cd core
./build.py
./emp3r0r
```

### tmux

emp3r0r utilizes [tmux](https://github.com/tmux/tmux/wiki) to provide features like remote editing, cmd output viewing.

if you want to use my tmux config, you can put `.tmux.conf` under your `$HOME`

```
cp .tmux.conf ~
```

0 comments on commit 4787a46

Please sign in to comment.