-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzshrc
184 lines (153 loc) · 5.5 KB
/
zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
eval "$(starship init zsh)"
# Fix the Java Problem
export _JAVA_AWT_WM_NONREPARENTING=1
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
PATH=/root/.local/bin:/snap/bin:/usr/sandbox/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
# Manual aliases
alias ll='lsd -lh --group-dirs=first'
alias la='lsd -a --group-dirs=first'
alias l='lsd --group-dirs=first'
alias lla='lsd -lha --group-dirs=first'
alias ls='lsd --group-dirs=first'
alias cat='bat'
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Manual alisases (luk)
alias decbin="~/.config/bin/decbin"
alias ips="~/.config/bin/ips.sh"
alias btw="/usr/bin/neofetch"
alias luk="python3 ~/.config/bin/whoami.py"
alias catn="/usr/bin/cat"
alias nv="nvim"
alias themer="~/.config/bin/themer"
alias panes="~/.config/bin/panes.sh"
# Plugins
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh-sudo/sudo.plugin.zsh
# Functions
function mkt(){
mkdir {nmap,content,exploits,scripts}
}
###############################################################################################################
# Functions for giving data to... IP's
function settarget(){
ip_adress=$1
machine_name=$2
echo "$ip_adress $machine_name" > ~/.config/eww/scripts/target
notify-send "SYSTEM" "Target: $ip_adress - $machine_name"
}
function setuser1(){
user1=$1
user1pass=$2
echo "$user1 $user1pass" > ~/.config/rofi/scripts/credentials/user1creds
notify-send "SYSTEM" "User 1: $user1 - $user1pass"
}
function setuser2(){
user2=$1
user2pass=$2
echo "$user2 $user2pass" > ~/.config/rofi/scripts/credentials/user2creds
notify-send "SYSTEM" "User 2: $user2 - $user2pass"
}
function setdbcreds(){
db_user=$1
db_user_pass=$2
echo "$db_user $db_user_pass" > ~/.config/rofi/scripts/credentials/db_user_creds
notify-send "SYSTEM" "DB User: $db_user - $db_user_pass"
}
function setmainpage(){
mainpage=$1
echo "$mainpage" > ~/.config/rofi/scripts/credentials/mainpage
notify-send "SYSTEM" "Main Page: $mainpage"
}
###############################################################################################################
# Cute neofetch
function sysfetch(){
~/.config/bin/sys-fetch
}
# Function to go back X directories with 'cdback X'
function cdback() {
local num=$1
if [[ -z $num ]]; then
num=1
fi
while [[ $num -gt 0 ]]; do
cd ..
num=$((num-1))
done
}
# Extract nmap information
function extractPorts(){
ports="$(cat $1 | grep -oP '\d{1,5}/open' | awk '{print $1}' FS='/' | xargs | tr ' ' ',')"
ip_address="$(cat $1 | grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' | sort -u | head -n 1)"
echo -e "\n[*] Extracting information...\n" > extractPorts.tmp
echo -e "\t[*] IP Address: $ip_address" >> extractPorts.tmp
echo -e "\t[*] Open ports: $ports\n" >> extractPorts.tmp
echo $ports | tr -d '\n' | xclip -sel clip
echo -e "[*] Ports copied to clipboard\n" >> extractPorts.tmp
cat extractPorts.tmp; rm extractPorts.tmp
}
# Set 'man' colors
function man() {
env \
LESS_TERMCAP_mb=$'\e[01;31m' \
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
man "$@"
}
# fzf improvement
function fzf-lovely(){
if [ "$1" = "h" ]; then
fzf -m --reverse --preview-window down:20 --preview '[[ $(file --mime {}) =~ binary ]] &&
echo {} is a binary file ||
(bat --style=numbers --color=always {} ||
highlight -O ansi -l {} ||
coderay {} ||
rougify {} ||
cat {}) 2> /dev/null | head -500'
else
fzf -m --preview '[[ $(file --mime {}) =~ binary ]] &&
echo {} is a binary file ||
(bat --style=numbers --color=always {} ||
highlight -O ansi -l {} ||
coderay {} ||
rougify {} ||
cat {}) 2> /dev/null | head -500'
fi
}
function rmk(){
scrub -p dod $1
shred -zun 10 -v $1
}
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char
bindkey "^[[1;3C" forward-word
bindkey "^[[1;3D" backward-word