-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zsh_aliases.tmpl
312 lines (291 loc) · 11.1 KB
/
dot_zsh_aliases.tmpl
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#Variables
dns=$(ip r | grep dhcp | awk '{print $3}')
extip=$(curl -s http://ifconfig.me)
ip=$(hostname -i | awk '{print $1}')
mac=$(ip a | grep ether | awk '{print $2}')
#Functions
### Extract file, example. "ext package.tar.bz2"
ext() {
if [[ -f $1 ]]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo $1 cannot be extracted ;;
esac
else
echo $1 is not a valid file
fi
}
#run in background
bgrun () {
nohup "$@" &>/dev/null &
}
#Timers
countdown(){
date1=$((`date +%s` + $1));
while [ "$date1" -ge `date +%s` ]; do
## Is this more than 24h away?
days=$(($(($(( $date1 - $(date +%s))) * 1 ))/86400))
echo -ne "$days day(s) and $(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r";
sleep 0.1
done
}
stopwatch(){
date1=`date +%s`;
while true; do
days=$(( $(($(date +%s) - date1)) / 86400 ))
echo -ne "$days day(s) and $(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r";
sleep 0.1
done
}
#SSH
ssh_ky () {
USER=${1}
IP=${2}
pushd ~/.ssh/ 1>/dev/null
for x in $(ls *.pub); do ssh-copy-id -i $x ${USER}@${IP}; done
popd 1>/dev/null
}
ssh_px () {
USER=${1}
IP=${2}
echo "Setting up SOCKS Proxy on ${IP} ..."
ssh -i ~/.ssh/rta_ed25519 -f -N -D 9050 ${USER}@${IP}
}
ssh_pl () {
USER=${1}
IP=${2}
FILE=${3}
scp -i ~/.ssh/rta_ed25519 ${USER}@${IP}:${FILE} .
}
ssh_ph () {
USER=${1}
IP=${2}
FILE=${3}
scp -i ~/.ssh/rta_ed25519 ${FILE} ${USER}@${IP}:~
}
ssh_rs () {
USER=${1}
IP=${2}
FOLDER=${3}
rsync -rzLe "ssh -i ~/.ssh/rta_ed25519" ${USER}@${IP}:~/${FOLDER} .
}
{{ if eq .chezmoi.osRelease.id "kali" }}
#Kali Commands
#srv only available on localhost, a function so other functions can call
srvhttp_local () {
# python -c "import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer(('127.0.0.1', ${PORT}), shs.SimpleHTTPRequestHandler).serve_forever()"
python3 -m http.server ${1} --bind 127.0.0.1
}
srvsmb_v1 () {
echo "Serving SMBv1 share 'test' w/ anon access on 0.0.0.0 ..."
impacket-smbserver test .
}
srvsmb_v2 () {
echo "Serving SMBv2 share 'test' w/ test:test creds on 0.0.0.0 ..."
impacket-smbserver -user test -pass test -smb2support test .
}
#HTTrack Child Process Monitor
httrack-jobs(){
# watch -t "echo -n 'HTTrack Jobs Running: '
# ps aux | grep httrack | awk '{print \$2}' |
# while read line; do
# IFS=$'\n'; pstree -p \$line | awk -F'---' '{print \$NF}' | grep httrack
# done | grep -oP '\(\K[^)]+' | sort -u | wc -l"
ps aux | grep httrack | awk '{print $2}' |
while read line; do
IFS=$'\n'; pstree -p $line | awk -F'---' '{print $NF}' | grep httrack; done |
grep -oP '\(\K[^)]+' | sort -u |
tee >(echo Running HTTrack Jobs: $(wc -l)) |
xargs pwdx | awk -F '/' '{print $NF}' | sort
}
alias httrack-watcher="watch -t -x zsh -ic httrack-jobs"
#Documents Page
pentest_info () {
: ' Not accurate for MD/YAML
SITES=( $(find /opt/documents -type d -maxdepth 1 2>/dev/null| tail -n +2) )
COUNTER=$(find /opt/documents -type d -maxdepth 1 2>/dev/null| tail -n +2 |wc -l)
for x in $SITES;do
pushd $x
srvhttp_local $((9100+$COUNTER)) &>/dev/null &
popd &>/dev/null
let COUNTER-=1
done
'
pushd /home/overflow/Documents/Websites/ &>/dev/null
srvhttp_local 9100 &>/dev/null &
pushd /opt/documents/post-exploitation-wiki/ &>/dev/null
srvhttp_local 9101 &>/dev/null &
#pushd /opt/documents/LOLBAS-Project.github.io &>/dev/null
#nohup bundle exec jekyll serve -q -P 9102 &>/dev/null &
#pushd /opt/documents/GTFOBins.github.io &>/dev/null
#nohup bundle exec jekyll serve -q -P 9103 &>/dev/null &
nohup grip /opt/documents/RedTeaming-Tactics-and-Techniques/SUMMARY.md 9104 --quiet &>/dev/null &
nohup grip /opt/documents/hacktricks/SUMMARY.md 9105 --quiet &>/dev/null &
nohup grip /opt/documents/PayloadsAllTheThings/README_edited.md 9106 --quiet &>/dev/null &
nohup grip /opt/documents/atomic-red-team/atomics/index_edit.md 9107 --quiet &>/dev/null &
nohup grip /opt/documents/hacktricks-cloud/SUMMARY.md 9109 --quiet &>/dev/null &
pushd /opt/documents/Regex101 &>/dev/null
srvhttp_local 9108 &>/dev/null &
#cd ~5
cd ~3
dirs -c #popd all the stack
nohup gksu -u overflow google-chrome http://127.0.0.1:9100 &>/dev/null &
}
vpnc_monitor(){
while :
do
if [ "$(pidof vpnc)" ]; then
echo Running
else
echo Restarting
nmcli connection up Pen-VPNC
echo $(pidof vpnc)
fi
sleep 5
clear
done
}
{{ end -}}
#General
alias c='clear'
alias ..="cd .."
alias cd..="cd .."
alias du1="du -h --max-depth 1"
alias du2="du -h --max-depth 2"
alias du3="du -h --max-depth 3"
alias cl='clear ; ls -l'
alias clip='xclip -selection clipboard'
alias e='exit'
alias gcap='git add -A; git commit -m $(date +%m-%d-%Y:%M:%S); git push'
alias gip='grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"'
alias header="curl -I"
alias hs='history | grep'
alias i='echo ; echo ; echo "DNS " $dns ; echo ; ifconfig ; ping google.com -c3 ; echo ; echo'
alias kj='kill -9 `jobs -p`'
alias k='kill -9'
alias mkdir="mkdir -pv"
alias myip='dig +short -x `curl -s ifconfig.me`'
alias n='echo;
echo -n "External IP: "$extip ; echo ;
echo -n "Internal IP: "$ip ; echo ;
echo -n "MAC address: "$mac ; echo ;
echo -n "DNS: "$dns ; echo ;
echo ; netstat -antp; echo ;
ping -c3 google.com'
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias ports="netstat -tulanp"
#alias psg="ps aux | grep -i"
#alias psg='_psg(){ ps up $(pgrep "$1");}; _psg'
alias psg='ps aux | grep -v grep | grep -i'
alias sip='sort -V'
alias strings='strings -a'
alias srtu='sort -u'
alias srtuc='LC_ALL=C sort -u'
alias t2h='tmux new-session \; send-keys clear C-m \; split-pane -v \; send-keys clear C-m'
alias t2v='tmux new-session \; send-keys clear C-m \; split-pane -h \; send-keys clear C-m'
alias t3h='tmux new-session \; send-keys clear C-m \; split-pane -v \; send-keys clear C-m \; split-pane -h \; send-keys clear C-m'
alias t3v='tmux new-session \; send-keys clear C-m \; split-pane -h \; send-keys clear C-m \; split-pane -v \; send-keys clear C-m'
alias t4='tmux new-session \; send-keys clear C-m \; split-pane -v \; send-keys clear C-m \; split-pane -h \; send-keys clear C-m \; select-pane -t 0 \; split-pane -h \; send-keys clear C-m'
{{- if eq .chezmoi.osRelease.id "endeavouros" }}
alias terminator="terminator --profile=endeavouros"
alias stm='DISPLAY=:0 bgrun steam'
alias kstm='pgrep steam | xargs kill -9'
alias spt='DISPLAY=:0 bgrun spotify'
alias kspt='pgrep spotify | xargs kill -9'
alias esd='DISPLAY=:0 bgrun es-de'
alias kesd='killall es-de'
{{- end }}
alias ta='tmux attach'
alias tan='tmux attach -t'
alias tkss='tmux kill-session -t'
alias tksv='tmux kill-server'
alias tl='tmux list-sessions'
alias ts='tmux new-session'
alias tsn='tmux new-session -s'
#breaks other commands but good if only wanting 1 tmux alias
#alias tmux="tmux attach || tmux new"
alias urldecode='python3 -c "import sys, urllib.parse as ul; print(ul.unquote_plus(sys.argv[1]))"'
alias urlencode='python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))"'
alias whatip='ip=$(curl -s ifconfig.me); echo $ip && whois $ip | grep Org'
#Package Management
{{- if eq .chezmoi.osRelease.id "arch" "endeavouros" }}
alias ins='sudo pacman -S'
alias rem='sudo pacman -R'
alias upd='sudo pacman -Sy'
alias upg='sudo pacman -Syu'
alias upg-all='yay'
alias search='yay '
{{- else }}
alias fix='apt install -f'
alias ins="apt install"
alias rem="apt purge"
alias search="apt search"
alias upd="apt update"
alias upg-all='httrack-update & apt update & pipx upgrade-all; apt upgrade -y; apt dist-upgrade -y; git-update; service nessusd stop; nessuscli update --all & greenbone-feed-sync; bleachbit -c --preset; runuser -u overflow -- bleachbit -c --preset'
alias upg-more='apt update & pipx upgrade-all; apt upgrade -y; apt dist-upgrade -y; git-update; service nessusd stop; nessuscli update --all & greenbone-feed-sync;bleachbit -c --preset; runuser -u overflow -- bleachbit -c --preset'
alias upg-dist='apt update; apt upgrade -y; apt dist-upgrade -y; bleachbit -c --preset'
alias upg="apt update; apt upgrade -y; bleachbit -c --preset"
{{ end -}}
{{- if eq .chezmoi.osRelease.id "kali" }}
#Kali
alias aircrack-ng="aircrack-ng -z"
alias airodump-ng="airodump-ng --manufacturer --wps --uptime"
alias axel="axel -a"
function chrome-browse() { nohup gksu -u overflow google-chrome "$@" &>/dev/null & }
function chrome-test() { nohup gksu -u overflow "chromium --args --disable-web-security --allow-file-access-from-file" "$@" &>/dev/null & }
alias citrix-config='/opt/Citrix/ICAClient/util/configmgr'
alias cjtool='nohup gksu -u overflow google-chrome /opt/cjtool/cjtool.html &>/dev/null &'
alias d='cd /root/Desktop/ ; clear'
alias edb="cd /usr/share/exploitdb/exploitdb/"
alias faraday='service couchdb start;python-faraday'
alias fix='apt install -f'
alias ftproot="cd /var/ftp/"
alias fwoff='ufw disable'
alias fwon='ufw enable'
alias horizon='nohup vmware-view &>/dev/null &'
alias host_share='cd /media/sf_Host_Share/'
alias msfc="systemctl start postgresql; msfdb start; msfconsole -q \"$@\""
alias msf='service postgresql start;msfconsole -p pentest \"$@\"'
alias nessus-start='service nessusd start; nohup gksu -u overflow google-chrome https://localhost:8834 &>/dev/null &'
alias nessus-stop='service nessusd stop'
alias nexpose='service postgresql start ; cd /opt/nexpose/nsc ; ./nsc.sh'
alias nmap="nmap --reason --open"
alias openvas-start='gvm-start &>/dev/null &'
alias openvas-stop='gvm-stop &>/dev/null '
alias pentest_info_killsrv="echo This may kill python3 and ruby services other than servers.;killall python3 ruby2.7 grip"
alias pia="nohup /opt/piavpn/bin/pia-client &>/dev/null &"
alias pyinstall_pe32='wine32 "C:\Python27\python.exe" /usr/share/pyinstaller/pyinstaller.py'
alias r='cd /root/ ; clear'
alias rem="apt purge"
alias sambaroot="cd /var/samba/"
alias s='cd /opt/discover/ ; clear'
alias sqlm='sqlmap -o --batch --exclude-sysdbs --random-agent'
alias suof='su overflow'
alias srvftp='python3 -m pyftpdlib'
alias srvhttp='python3 -m http.server'
alias srvhttp_debug='serv'
alias srvtftp=ptftpd
alias tcpdump='sudo -u overflow tcpdump'
alias tftproot="cd /var/tftp/"
alias torbrowser='nohup gksu -u overflow /opt/tor-browser_en-US/Browser/start-tor-browser &>/dev/null &'
alias torservice='service tor start; service privoxy start'
alias vmroot="cd /mnt/hgfs/"
alias webhttrack='nohup gksu -u overflow webhttrack &>/dev/null &'
alias whatip='ip=$(curl -s ifconfig.me); echo $ip && whois $ip | grep Org'
alias wireshark='nohup gksu -u overflow wireshark &>/dev/null &'
alias wordlist="cd /usr/share/wordlist/"
alias wwwroot="cd /var/www/"
alias x11-sudo-fix="su - $SUDO_USER -c 'xauth list' | grep `echo $DISPLAY | cut -d ':' -f 2 | cut -d '.' -f 1 | sed -e s/^/:/` | xargs -n 3 xauth add"
alias xssvalidator='phantomjs /opt/Burpsuite/bapps/98275a25394a417c9480f58740c1d981/xss-detector/xss.js'
{{- end -}}