Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
intrudir committed Mar 20, 2023
1 parent 8cd4e43 commit 32e9c2e
Show file tree
Hide file tree
Showing 11 changed files with 290 additions and 144 deletions.
101 changes: 0 additions & 101 deletions 2.install-tools.sh

This file was deleted.

34 changes: 0 additions & 34 deletions configs-only.sh

This file was deleted.

5 changes: 4 additions & 1 deletion dotfiles/ctf-aliases
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ alias bypassfuzzer='python3 /opt/tools/bypassfuzzer/bypassfuzzer.py'

# Proxy stuff
alias burl='curl -x 127.0.0.1:8080 -k'
alias murl="curl -x 127.0.0.1:8080 -k -H $'X-Pwnfox-Color: magenta'"
alias murl="curl -x 127.0.0.1:8080 -k -H $'intrudir: magenta'"
alias proxypy='export REQUESTS_CA_BUNDLE="path/to/burpcert.pem"; export HTTP_PROXY="http://127.0.0.1:8080"; export HTTPS_PROXY="http://127.0.0.1:8080"'
alias proxypy_unset='unset REQUESTS_CA_BUNDLE; unset HTTP_PROXY; unset HTTPS_PROXY'

Expand All @@ -27,6 +27,9 @@ alias POST='curl -d @-'
alias apachelogs="tail -f -n 10 /var/log/apache2/access.log"
alias udc='python3 -c "import sys, urllib.parse as ul; print(ul.unquote_plus(sys.argv[1]))"'
alias uec='python3 -c "import sys, urllib.parse as ul; print(ul.quote_plus(sys.argv[1]))"'
alias ascii_lower='python3 -c "import string; [print(x) for x in string.ascii_lowercase]"'
alias ascii_upper='python3 -c "import string; [print(x) for x in string.ascii_uppercase]"'
alias ascii_digits='python3 -c "import string; [print(x) for x in string.digits]"'

# other
export EDITOR=vim
5 changes: 1 addition & 4 deletions dotfiles/ctf-tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,4 @@ bind % split-window -h -c "#{pane_current_path}"
# Use ALT + <- and ALT + -> to jump words
# not needed if you use iterm
bind -n M-Left send-key M-b
bind -n M-Right send-key M-f

### Tmux themes
run-shell "/opt/tmux/tmux-power/tmux-power.tmux"
bind -n M-Right send-key M-f
41 changes: 41 additions & 0 deletions dotfiles/ctf-vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
" turn on syntax highlight
syntax on

" turn on line numbers
set number

" make backspace work as intended in edit mode
set backspace=indent,eol,start

" Indentation
set shiftwidth=4
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab

" Auto indent what you can
set autoindent

" Display
set ls=2
set noshowmode
set showcmd
set modeline
set ruler
set title
set nu

" History
set history=50


" Command shortcuts
" sort the buffer removing duplicates
nmap <Leader>s :%!sort -u --version-sort<CR>

" Base64 decode word under cursor
nmap <Leader>b :!echo <C-R><C-W> \| base64 -d<CR>

" Pretty print XML
nmap <Leader>x :!xmllint --format -
35 changes: 35 additions & 0 deletions dotfiles/full-aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### my aliases
# required to sudo an aliased command
alias sudo='sudo '

# tmux
alias tml='tmux ls'
alias tma='tmux a -t'
alias tmn='tmux new -s'

# binaries
alias vi='vim'
alias ngrok='/opt/tools/ngrok'

# web
alias secretfinder='python3 /opt/tools/SecretFinder/SecretFinder.py'
alias linkfinder='python3 /opt/tools/LinkFinder/linkfinder.py'
alias bypassfuzzer='python3 /opt/tools/bypassfuzzer/bypassfuzzer.py'

# Proxy stuff
alias burl='curl -x 127.0.0.1:8080 -k'
alias murl="curl -x 127.0.0.1:8080 -k -H $'intrudir: magenta'"
alias proxypy='export REQUESTS_CA_BUNDLE="path/to/burpcert.pem"; export HTTP_PROXY="http://127.0.0.1:8080"; export HTTPS_PROXY="http://127.0.0.1:8080"'
alias proxypy_unset='unset REQUESTS_CA_BUNDLE; unset HTTP_PROXY; unset HTTPS_PROXY'

# shortcuts
alias POST='curl -d @-'
alias apachelogs="tail -f -n 10 /var/log/apache2/access.log"
alias udc='python3 -c "import sys, urllib.parse as ul; print(ul.unquote_plus(sys.argv[1]))"'
alias uec='python3 -c "import sys, urllib.parse as ul; print(ul.quote_plus(sys.argv[1]))"'
alias ascii_lower='python3 -c "import string; [print(x) for x in string.ascii_lowercase]"'
alias ascii_upper='python3 -c "import string; [print(x) for x in string.ascii_uppercase]"'
alias ascii_digits='python3 -c "import string; [print(x) for x in string.digits]"'

# other
export EDITOR=vim
27 changes: 27 additions & 0 deletions dotfiles/full-tmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### enable mouse:
set -g mouse on

### Scrollback buffer
set -g history-limit 65000

### get 256 colors to work, including in vim/nvim
set-option -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:RGB"

### fix tmux escape time (for vim/nvim)
set-option -sg escape-time 10

### New windows open in current path
bind c new-window -c "#{pane_current_path}"

### New panes open in current path
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

# Use ALT + <- and ALT + -> to jump words
# not needed if you use iterm
bind -n M-Left send-key M-b
bind -n M-Right send-key M-f

### Tmux themes
run-shell "/opt/tmux/tmux-power/tmux-power.tmux"
File renamed without changes.
71 changes: 71 additions & 0 deletions install-configs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
function check_if_success () {
if [ $? -eq 0 ]; then
echo "OK"
else
echo "Something went wrong. Stopping here so you can check the error."
exit
fi
}

while getopts 'h:t:' flag; do
case "$flag" in
h) echo "usage";;

t) type=${OPTARG};;
esac
done

if [ -v "$type" ]; then
echo "The -t flag is required. Needs to be one of the following: ['full', 'ctf']"
exit 1
fi


if [[ ! $type == 'full' ]] && [[ ! $type == 'ctf' ]]; then
echo "the -t flag needs to be either 'full' or 'ctf'."
exit 1
fi

echo "VM type: $type";

if [[ $type == 'full' ]]; then
echo "Full vim config"
# vim_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/full-vimrc)
# echo "$vim_rc" > ~/.vimrc

echo "Full shell aliases"
# zsh_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/full-aliases)
# echo "$zsh_rc" >> ~/.zshrc
# echo "$zsh_rc" >> ~/.bash_aliases

echo "Full tmux.conf"
# tmux_conf=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/full-tmux.conf)
# echo "$tmux_conf" > ~/.tmux.conf

echo "Install VIM plug"
# curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# check_if_success

echo "Install tmux themes"
# sudo mkdir /opt/tmux && cd /opt/tmux
# check_if_success
# sudo git clone https://github.com/wfxr/tmux-power.git
# cd ~
fi


if [[ $type == 'ctf' ]]; then
echo "CTF vim config"
# vim_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/ctf-vimrc)
# echo "$vim_rc" > ~/.vimrc

echo "CTF shell aliases"
# zsh_rc=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/ctf-aliases)
# echo "$zsh_rc" >> ~/.zshrc
# echo "$zsh_rc" >> ~/.bash_aliases

echo "CTF tmux.conf"
# tmux_conf=$(curl https://raw.githubusercontent.com/intrudir/vm-setup.sh/main/dotfiles/ctf-tmux.conf)
# echo "$tmux_conf" > ~/.tmux.conf
fi
4 changes: 0 additions & 4 deletions 1.vm-setup.sh → install-p10k.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ function check_if_success () {
sudo -l
check_if_success

# install stuff
sudo apt install dnsutils net-tools curl git tmux zsh wget fontconfig python3-pip python3-venv gcc
check_if_success

# change default shell for user
sudo chsh -s $(which zsh) $(whoami)
check_if_success
Expand Down
Loading

0 comments on commit 32e9c2e

Please sign in to comment.