forked from ikirt/htb-ohmyzsh-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhackthebox.zsh-theme
123 lines (105 loc) · 3.03 KB
/
hackthebox.zsh-theme
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
# █ █ ▐▌ ▄█▄ █ ▄▄▄▄
# █▄▄█ ▀▀█ █▀▀ ▐▌▄▀ █ █▀█ █▀█ █▌▄█ ▄▀▀▄ ▀▄▀
# █ █ █▄█ █▄▄ ▐█▀▄ █ █ █ █▄▄ █▌▄█ ▀▄▄▀ █▀█
#
# P E N - T E S T I N G L A B S
# HTB ZSH theme
# This is modified from https://gist.github.com/MadLittleMods/2dc87634c6f3649852fba89b9b98e366#file-eric-zsh-theme
# Modifier: triki
# Date: 06-16-20
# Custom Colors
green='82'
blue='21'
red='196'
CURRENT_BG='NONE'
() {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
SEGMENT_SEPARATOR_TOP='╭─['
SEGMENT_SEPARATOR_BOT='╰─'
}
# End the prompt, closing any open segments
prompt_end() {
if [[ $UID -eq 0 ]]; then
echo -n "%{%f%} %{%k%F{$red}%}#"
else
echo -n "%{%f%} %{%k%F{$green}%}$"
fi
CURRENT_BG=''
}
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ "$USER" != "root" ]]; then
echo -n "%(!.%{%F{red}%}.)%{%k%F{white}%}$USER%{%k%F{$green}%}@%{%k%F{$blue}%}%m%{%k%F{$green}%}]-["
else
echo -n "%(!.%{%F{red}%}.)%{%k%F{$red}%}$USER%{%k%F{$green}%}@%{%k%F{$blue}%}%m%{%k%F{$green}%}]-["
fi
}
# Dir: current working directory
prompt_dir() {
echo -n '%{%k%F{white}%}%~%{%k%F{$green}%}]'
}
# VPN: htb vpn location
prompt_vpn_loc() {
#this script can be found here https://github.com/theGuildHall/pwnbox
#htb_vpn_loc=`/opt/vpnserver.sh`
htb_vpn_loc=`cat /etc/openvpn/*.ovpn | grep "remote " | cut -d " " -f 2 | cut -d "." -f 1 | cut -d "-" -f 2-|head -n1`
if
echo -n "%{%k%F{white}%}${htb_vpn_loc}%{%k%F{$green}%}]-["
}
# VPN: htb vpn IP
prompt_vpn_ip() {
#this script can be found here https://github.com/theGuildHall/pwnbox
htb_vpn_ip=`/opt/vpnbash.sh`
echo -n "%{%k%F{white}%}${htb_vpn_ip}%{%k%F{$green}%}]-["
}
# Virtualenv: current working virtualenv
prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
echo -n "(`basename $virtualenv_path`)"
fi
}
# Status:
# - was there an error
# - am I root
# - are there background jobs?
prompt_status() {
local symbols
FAIL_CHAR=$'\u2622'
symbols=()
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{$red}%}${FAIL_CHAR}"
[[ $UID -eq 0 ]] && symbols+="%{%F{$red}%}⚡"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
[[ -n "$symbols" ]] && echo -n "%{%F{$green}%}[$symbols%{%F{$green}%}]"
}
prompt_newline() {
if [[ -n $CURRENT_BG ]]; then
echo -n "%{%k%F{$CURRENT_BG}%}
%{%k%F{$green}%}$SEGMENT_SEPARATOR_BOT"
else
echo -n "%{%k%}"
fi
echo -n "%{%f%}"
CURRENT_BG=''
}
prompt_spacer() {
echo -n "%{%k%F{$green}%}]-["
}
prompt_header() {
echo -n "%{%k%F{$green}%}$SEGMENT_SEPARATOR_TOP"
}
## Main prompt
build_prompt() {
RETVAL=$?
prompt_header
prompt_vpn_loc
prompt_vpn_ip
prompt_virtualenv
prompt_context
prompt_dir
prompt_newline
prompt_status
prompt_end
}
PROMPT='%{%f%B%k%}$(build_prompt) %{$reset_color%}'
zle_highlight=( default:bold,fg=$green )