Skip to content

Commit f0e5ccd

Browse files
committed
Enhances shell scripts and VS Code tasks for usability
Adds `read` prompts to improve user interaction in shell scripts. Updates default values and environment handling for better flexibility. Enhances `dump_users` output with additional details. Introduces a `differ` function for file comparison. Refines VS Code settings and tasks for improved task execution and user guidance. Removes unused or redundant configurations and commands. Improves installer script by refining requirement checks and user prompts.
1 parent bce42a2 commit f0e5ccd

File tree

6 files changed

+84
-108
lines changed

6 files changed

+84
-108
lines changed

.vscode/.zshrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ if [ "$WEB_DELIVERY_MODE" ]; then
5252
# ProjectDiscovery/SimpleHTTPServer
5353
simplehttpserver -listen 0.0.0.0:$LISTEN_ON -verbose -upload
5454
# python3 -m http.server $LISTEN_ON
55+
read
5556
exit 0
5657
fi
5758

@@ -63,12 +64,14 @@ export METASPLOIT_INIT_COMMAND="${METASPLOIT_INIT_COMMAND} setg VHOST $DOMAIN;"
6364
if [ "$METASPLOIT_HANDLER_MODE" ]; then
6465
msfconsole -r "$PROJECT_FOLDER/.vscode/metasploit_handler.rc" \
6566
-x "${METASPLOIT_INIT_COMMAND}"
67+
read
6668
exit 0
6769
fi
6870

6971
if [ "$METASPLOIT_CONSOLE_MODE" ]; then
7072
msfconsole -r "$PROJECT_FOLDER/.vscode/msfconsole.rc" \
7173
-x "${METASPLOIT_INIT_COMMAND}"
74+
read
7275
exit 0
7376
fi
7477

@@ -81,7 +84,8 @@ if [ "$REVERSE_SHELL_MODE" ]; then
8184
echo "Advanced: "
8285
echo " https://rev.eson.ninja/?ip=${LHOST}&port=${LPORT}"
8386
echo ""
84-
rlwrap -I -cAr nc -lvvp ${LPORT}
87+
rlwrap -I -cAr netcat -lvvp ${LPORT}
88+
read;
8589
exit 0
8690
fi
8791

.vscode/env.zsh

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
################################################################
33
# Project settings for Zsh Prompt
44
# export HOST="[HackTheBox - Machine Name]"
5+
unset USER_ZDOTDIR
56

67
################################################################
78
# Self condition settings
89
# use this if you are using a VPS or cloud server it can automatically get your public IP.
910
# export LHOST=`curl ifconfig.me`
1011
# export LHOST=`curl ip.me`
11-
export LHOST=$(ifconfig | grep '10\.10\.' | cut -d ' ' -f2)
12+
export LHOST=${$(ifconfig | grep '10\.10\.' | cut -d ' ' -f2):-10.0.0.1}
1213
export ATTACKER_IP=$LHOST
1314

1415
export LPORT=6789
@@ -132,7 +133,7 @@ function update_user_cred_to_env() {
132133
local pass=$(echo "$usercred" | yq '.[0].password' -r)
133134
local nt_hash=$(echo "$usercred" | yq '.[0].nt_hash' -r)
134135
local login=$(echo "$usercred" | yq '.[0].login' -r)
135-
local LOGIN_${_var}=$login
136+
export LOGIN_${_var}=$login
136137
export USER_${_var}=$user
137138
export PASS_${_var}=$pass
138139
export NT_HASH_${_var}=$nt_hash
@@ -191,63 +192,19 @@ function current_status() {
191192
echo "Current User: ${CURRENT_USER} => ${USER}:${PASS} (${CURRENT_NT_HASH})"
192193
fi
193194
}
194-
current_status
195+
if [[ ! -z "$SHOW_CURRENT" ]]; then
196+
current_status
197+
fi
195198

196199
# export KRB5CCNAME=
197200

198-
# [[administrator]]ME settings
199201
# export LD_PRELOAD=/usr/local/lib/libfaketime.so.1
200202
# export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/faketime/libfaketime.so.1
201203
# export DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/opt/homebrew/Cellar/libfaketime/0.9.10/lib/faketime/libfaketime.1.dylib
202204
# export FAKETIME="-8h"
203205

204206
export METASPLOIT_INIT_COMMAND=""
205207

206-
################################################################
207-
# Advanced settings
208-
209-
# AWS settings
210-
# export AWS_DEFAULT_REGION=us-west-2
211-
# export AWS_ACCESS_KEY_ID=AKIA...
212-
# export AWS_SECRET_ACCESS_KEY=...
213-
# export AWS_SESSION_TOKEN=...
214-
# export AWS_ENDPOINT_URL=
215-
216-
# VAULT settings
217-
# export VAULT_ADDR=
218-
# export VAULT_TOKEN=...
219-
220-
# MINIO settings
221-
# export MINIO_ROOT_USER=... # access key
222-
# export MINIO_ROOT_PASSWORD=... # secret key
223-
# export MINIO_ENDPOINT=
224-
# export MC_HOST_myminio=http://${MINIO_ROOT_USER}:${MINIO_ROOT_PASSWORD}@${MINIO_ENDPOINT}
225-
226-
# Kubernetes settings
227-
# export KUBECONFIG=${PROJECT_FOLDER}/kubeconfig
228-
229-
# Terraform settings
230-
export TF_LOG=trace
231-
export TF_LOG_PATH=$PROJECT_FOLDER/terraform.log
232-
# export TF_VAR_aws_access_key=...
233-
# export TF_VAR_aws_secret_key=...
234-
# export TF_VAR_aws_session_token=...
235-
# export TF_VAR_aws_region=us-west-2
236-
237-
# OpenStack settings
238-
# export OS_USERNAME=username
239-
# export OS_PASSWORD=password
240-
# export OS_TENANT_NAME=projectName
241-
# export OS_AUTH_URL=https://identityHost:portNumber/v2
242-
# The following lines can be omitted
243-
# export OS_TENANT_ID=tenantIDString
244-
# export OS_REGION_NAME=regionName
245-
# export OS_CACERT=/path/to/cacertFile
246-
# export OS_TOKEN=tokenString
247-
248-
################################################################
249-
# More default settings
250-
251208
export PROJECT_WEB_DELIVERY=$PROJECT_FOLDER/.web-delivery # web-delivery is a folder in PROJECT_FOLDER
252209
unset SSS_LOADED # make sure sss init shell is not set
253210

@@ -262,7 +219,7 @@ unset https_proxy http_proxy all_proxy
262219
# Hashcat settings
263220

264221
# useful settings like ROCKYOU, SECLIST, etc.
265-
# export WORDLIST=/usr/share/wordlists
222+
export WORDLIST=${WORDLIST:-/usr/share/wordlists}
266223
export ROCKYOU=${WORDLIST}/rockyou.txt
267224
export SECLIST=${WORDLIST}/seclists/
268225
export TOP_DNS=${SECLIST}/Discovery/DNS/bitquark-subdomains-top100000.txt
@@ -460,14 +417,60 @@ function dump_hosts() {
460417
}
461418

462419
function dump_users() {
420+
echo "dumping impacket format for users:"
463421
for user in $(env|grep -E '^USER_'|grep -v 'USER_ALIAS'); do
464422
local _var=$(echo $user|sed -e 's/USER_//g' | cut -d '=' -f1) # replace _ with - to get the original username
465423
local _user=$(eval echo '$USER_'$_var)
466424
local _pass=$(eval echo '$PASS_'$_var)
467425
local _nt_hash=$(eval echo '$NT_HASH_'$_var)
426+
local _login=$(eval echo '$LOGIN_'$_var)
427+
if [[ "$_login" == "$_user" ]]; then
428+
_login=$DOMAIN
429+
fi
468430
if [[ "$_nt_hash" == "fffffffffffffffffffffffffffffffffff" ]]; then
469-
_nt_hash=$(ntlm "${_pass}")
431+
echo "\"${_login}\"/\"${_user}\":'${_pass}' (No NT Hash)"
432+
else
433+
echo "\"${_login}\"/\"${_user}\" (${_nt_hash})"
470434
fi
471-
echo "${_user}:${_pass}(${_nt_hash})"
472435
done
436+
echo ""
437+
echo "# dumping environment variables for users:"
438+
for user in $(env|grep -E '^USER_'|grep -v 'USER_ALIAS'); do
439+
local _var=$(echo $user|sed -e 's/USER_//g' | cut -d '=' -f1)
440+
local _user=$(eval echo '$USER_'$_var)
441+
echo "# user: $_user"
442+
local _pass=$(eval echo '$PASS_'$_var)
443+
local _nt_hash=$(eval echo '$NT_HASH_'$_var)
444+
local _login=$(eval echo '$LOGIN_'$_var)
445+
echo "export USER_${_var}=\"${_user}\""
446+
echo "export PASS_${_var}=\"${_pass}\""
447+
echo "export NT_HASH_${_var}=\"${_nt_hash}\""
448+
echo "export LOGIN_${_var}=\"${_login}\""
449+
done
450+
echo ""
451+
echo "# dumping current user environment variables:"
452+
echo "export USER=${CURRENT_USER}"
453+
echo "export USERNAME=${CURRENT_PASS}"
454+
echo "export PASS=${CURRENT_PASS}"
455+
echo "export PASSWORD=${CURRENT_PASS}"
456+
echo "export NT_HASH=${CURRENT_NT_HASH}"
457+
echo "export LOGIN=${CURRENT_LOGIN}"
458+
echo ""
459+
echo "export CURRENT_USER=${CURRENT_USER}"
460+
echo "export CURRENT_PASS=${CURRENT_PASS}"
461+
echo "export CURRENT_NT_HASH=${CURRENT_NT_HASH}"
462+
echo "export CURRENT_LOGIN=${CURRENT_LOGIN}"
463+
echo "export CURRENT=${CURRENT}"
464+
}
465+
466+
function differ() {
467+
if [[ -z $1 || -z $2 ]]; then
468+
echo "Usage: differ <file1> <file2>"
469+
return 1
470+
fi
471+
if [[ ! -f $1 || ! -f $2 ]]; then
472+
echo "File not found!"
473+
return 1
474+
fi
475+
code -d "$1" "$2"
473476
}

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"terminal.integrated.profiles.linux": {
33
"zsh-shell": {
44
"env": {
5-
"PROJECT_FOLDER": "${workspaceFolder}"
5+
"PROJECT_FOLDER": "${workspaceFolder}",
6+
"SHOW_CURRENT_STATUS": "True"
67
},
78
"path": "zsh"
89
},
@@ -42,7 +43,8 @@
4243
"terminal.integrated.profiles.osx": {
4344
"zsh-shell": {
4445
"env": {
45-
"PROJECT_FOLDER": "${workspaceFolder}"
46+
"PROJECT_FOLDER": "${workspaceFolder}",
47+
"SHOW_CURRENT_STATUS": "True"
4648
},
4749
"path": "zsh"
4850
},

.vscode/tasks.json

Lines changed: 3 additions & 47 deletions
Large diffs are not rendered by default.

completion_indexer/_weapon

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
update_user_cred_to_env
22
set_current_user
3+
dump_users
34
update_host_to_env
45
set_current_host
6+
dump_hosts
7+
dump_hosts | sudo tee -a /etc/hosts
8+
current_status
9+
proxys
10+
proxys on
11+
proxys off
12+
url encode "content=="
13+
url decode "content%3D%3D"
514
wfuzz_vhost_http $DOMAIN $TOP_DNS
615
wfuzz_vhost_https $DOMAIN $TOP_DNS
716
venv-init
@@ -14,4 +23,5 @@ cp xxx $PROJECT_FOLDER/
1423
cp xxx $PROJECT_WEB_DELIVERY/
1524
cat file |url encode
1625
cat file |url decode
17-
ntlm $PASS
26+
ntlm $PASS
27+
differ file1 file2

installer.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/bin/zsh
22

33
function check_command() {
4-
local prompt=$2
54
command -v "$1" >/dev/null 2>&1 && {
65
} || {
7-
echo "$1 is not installed."
8-
echo "Install it for better experience."
9-
echo "$prompt"
6+
echo "detect $1 is not installed."
7+
echo "$2"
108
return 2
119
}
1210
}
1311

1412
function check_requirements() {
13+
check_command "awk" "awk is required for parsing the output of commands, please install it." || return 2
14+
check_command "sed" "sed is required for parsing the output of commands, please install it." || return 2
1515
check_command "zsh" "zsh is core to WeaponizedVSCode integrated shell." || return 2
1616
check_command "vim" "vim is required for task edit /etc/hosts, please install it or change it." || return 2
1717
check_command "nc" "nc is core for netcat shell session handling or u can't use it, please install it." || return 2
@@ -22,6 +22,7 @@ function check_requirements() {
2222
check_command "simplehttpserver" "simplehttpserver is cool for serving files with upload feature and dump http requests, install it with https://github.com/projectdiscovery/simplehttpserver" || return 2
2323
check_command "rustscan" "rustscan is required for the auto scanning task in vscode, fast and reliable, install it with https://github.com/bee-san/RustScan" || return 2
2424
check_command "wfuzz" "wfuzz is required for command wfuzz_vhost_https and wfuzz_vhost_http, to fuzz the subdomain and vhost. install it or u can't use that" || return 2
25+
check_command "hashcat" "hashcat is required for the hashcat cracking task in vscode, install it with 'apt install hashcat' or 'brew install hashcat'." || return 2
2526
check_command "python3" "Python3 is required for the Python scripts in WeaponizedVSCode, please install it." || return 2
2627
check_command "uv" "uv is optional but recommended for better performance, install it with 'pip install uv'. Their script is useful"
2728
}
@@ -45,7 +46,7 @@ function main() {
4546
exit 0
4647
fi
4748
export LOCATION="$WEAPON_LOCATION"
48-
echo "Weapon will be installed to $LOCATION, Press any key to continue or Ctrl+C to cancel..."
49+
echo "Weapon will be installed to $LOCATION, Press Enter key to continue or Ctrl+C to cancel..."
4950
read
5051
echo "Installing Weapon..."
5152
mkdir -p $LOCATION && echo "Weapon directory created at $LOCATION."

0 commit comments

Comments
 (0)