Skip to content

Commit 170a16b

Browse files
author
tatanus
committed
refactored function names
1 parent 89c98b8 commit 170a16b

72 files changed

Lines changed: 230 additions & 179 deletions

Some content is hidden

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

SetupPentest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ done
169169
# -----------------------------------------------------------------------------
170170

171171
# Check if proxychains is required
172-
_Check_Proxy_Needed
172+
_check_proxy_needed
173173

174174
# -----------------------------------------------------------------------------
175175
# ---------------------------------- UTILITY ----------------------------------

config/lists.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,12 @@ if [[ -z "${LISTS_SH_LOADED:-}" ]]; then
372372
"Setup_Support_Scripts"
373373
"Fix_Dns"
374374

375-
"_Apt_Update"
376-
"_Install_Missing_Apt_Packages"
377-
"_Install_Python"
378-
"_Install_Python_Libs"
379-
"_Install_Go"
380-
"_Fix_Old_Python"
375+
"_apt_update"
376+
"_install_missing_apt_packages"
377+
"_install_python"
378+
"_install_python_libs"
379+
"_install_go"
380+
"_fix_old_python"
381381
)
382382

383383
# Array for FullSetup tasks
@@ -393,8 +393,8 @@ if [[ -z "${LISTS_SH_LOADED:-}" ]]; then
393393
INSTALL_TOOLS_MENU_ITEMS=(
394394
"_Install_All_Tools"
395395
"_Install_Inhouse_Tools"
396-
"_Install_Pipx_Tools"
397-
"_Install_Go_Tools"
398-
"_Install_Ruby_Gems"
396+
"_install_pipx_tools"
397+
"_install_go_tools"
398+
"_install_ruby_gems"
399399
)
400400
fi

lib/common_core

menu/install_tasks.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ if [[ -z "${INSTALL_TASKS_SH_LOADED:-}" ]]; then
2424
# Function to install Impacket
2525
# This function installs Python dependencies for the Impacket tool.
2626
function Install_Impacket() {
27-
_Pushd "${TOOLS_DIR}/impacket"
27+
_pushd "${TOOLS_DIR}/impacket"
2828

29-
if _Pip_Install "."; then
29+
if _pip_install "."; then
3030
pass "Installed pip packages for impacket."
3131
else
3232
fail "Failed to install pip packages for impacket."
3333
fi
34-
_Popd
34+
_popd
3535
}
3636

3737
function _Install_Tool() {
@@ -88,7 +88,7 @@ if [[ -z "${INSTALL_TASKS_SH_LOADED:-}" ]]; then
8888
return "${FAIL}"
8989
else
9090
pass "Successfully installed: ${script_file}"
91-
_Update_Menu_Timestamp "TOOL INSTALLATION MENU" "${script_file}"
91+
_update_menu_timestamp "TOOL INSTALLATION MENU" "${script_file}"
9292
return "${PASS}"
9393
fi
9494
else
@@ -148,12 +148,12 @@ if [[ -z "${INSTALL_TASKS_SH_LOADED:-}" ]]; then
148148

149149
info "Executing predefined installation function: ${item}"
150150
# This presumably calls a bash function named "${item}"
151-
if ! _Exec_Function "${item}"; then
151+
if ! _exec_function "${item}"; then
152152
fail "Failed to execute predefined installation function: ${item}"
153153
fi
154154

155155
# Update menu item timestamp persistently
156-
_Update_Menu_Timestamp "TOOL INSTALLATION MENU" "${item}"
156+
_update_menu_timestamp "TOOL INSTALLATION MENU" "${item}"
157157
done
158158

159159
# ------------------------------------------------------------------------------

menu/menu_tasks.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ if [[ -z "${MENU_TASKS_SH_LOADED:-}" ]]; then
4242
# Check if the item is "_Install_All_Tools"
4343
if [[ "${choice}" == "_Install_All_Tools" ]]; then
4444
# Pass TOOL_MENU_ITEMS[@] as arguments
45-
if ! _Exec_Function "${choice}" "${TOOL_MENU_ITEMS[@]}"; then
45+
if ! _exec_function "${choice}" "${TOOL_MENU_ITEMS[@]}"; then
4646
fail "Failed to execute predefined installation function: ${choice} with TOOL_MENU_ITEMS."
4747
return "${FAIL}"
4848
fi
4949
else
5050
# Execute the function without additional arguments
51-
if ! _Exec_Function "${choice}"; then
51+
if ! _exec_function "${choice}"; then
5252
fail "Failed to execute predefined installation function: ${choice}"
5353
return "${FAIL}"
5454
fi
@@ -143,7 +143,7 @@ if [[ -z "${MENU_TASKS_SH_LOADED:-}" ]]; then
143143

144144
# Process choices
145145
if [[ "${choice}" == "Setup PENTEST Environment" ]]; then
146-
_display_menu "Setup PENTEST Environment" "_Exec_Function" true "${PENTEST_ENVIRONMENT_MENU_ITEMS[@]}"
146+
_display_menu "Setup PENTEST Environment" "_exec_function" true "${PENTEST_ENVIRONMENT_MENU_ITEMS[@]}"
147147
elif [[ "${choice}" == "Install Tools" ]]; then
148148
TOOL_MENU_ITEMS=("${INSTALL_TOOLS_MENU_ITEMS[@]}")
149149
MODULES_DIR="modules/tools"

modules/extras/inhouse.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bash
2+
set -uo pipefail
3+
4+
# =============================================================================
5+
# NAME : inhouse.sh
6+
# DESCRIPTION : Dynamically copy in-house tools from modules/extras into TOOLS_DIR
7+
# AUTHOR : Adam Compton
8+
# DATE CREATED: 2024-12-09 20:51:59
9+
# =============================================================================
10+
# EDIT HISTORY:
11+
# DATE | EDITED BY | DESCRIPTION OF CHANGE
12+
# ---------------------|--------------|----------------------------------------
13+
# 2024-12-09 20:51:59 | Adam Compton | Initial creation.
14+
# =============================================================================
15+
16+
# Guard to prevent multiple sourcing
17+
if [[ -z "${INHOUSE_SH_LOADED:-}" ]]; then
18+
declare -g INHOUSE_SH_LOADED=true
19+
20+
# Ensure environment variables exist
21+
if [[ -z "${SCRIPT_DIR:-}" || -z "${TOOLS_DIR:-}" ]]; then
22+
echo "[ERROR] SCRIPT_DIR and TOOLS_DIR must be defined before sourcing this script."
23+
return 1 2> /dev/null || exit 1
24+
fi
25+
26+
src_dir="${SCRIPT_DIR}/modules/extras"
27+
28+
# Confirm source directory exists
29+
if [[ ! -d "${src_dir}" ]]; then
30+
fail "Source directory [${src_dir}] does not exist. Nothing to process."
31+
else
32+
shopt -s nullglob
33+
for dir in "${src_dir}"/*/; do
34+
dir="${dir%/}"
35+
name="$(basename -- "${dir}")"
36+
dest="${TOOLS_DIR%/}/${name}"
37+
38+
# Skip if not a directory (defensive)
39+
[[ -d "${dir}" ]] || {
40+
warn "Skipping non-directory: ${dir}"
41+
continue
42+
}
43+
44+
# Skip if destination already exists
45+
if [[ -e "${dest}" ]]; then
46+
warn "Destination already exists: ${dest}. Skipping ${name}."
47+
continue
48+
fi
49+
50+
# Attempt copy
51+
if cp -r -- "${dir}" "${TOOLS_DIR}/"; then
52+
pass "Copied ${name} to ${TOOLS_DIR}/"
53+
else
54+
fail "Failed to copy ${name} to ${TOOLS_DIR}/"
55+
continue
56+
fi
57+
58+
# Special case for impacket
59+
if [[ "${name,,}" == "impacket" ]]; then
60+
if declare -F Install_Impacket > /dev/null 2>&1; then
61+
pass "Detected impacket; running Install_Impacket()..."
62+
if Install_Impacket; then
63+
pass "Install_Impacket completed successfully for ${dest}."
64+
else
65+
fail "Install_Impacket returned non-zero for ${dest}."
66+
fi
67+
else
68+
warn "Copied impacket to ${dest}, but Install_Impacket() is not defined."
69+
fi
70+
fi
71+
done
72+
shopt -u nullglob
73+
fi
74+
fi

modules/scripts/inhouse.sh

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

modules/tools/aquatone.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ TOOL_CATEGORY_MAP["aquatone"]="intelligence-gathering"
1717
APP_TESTS["aquatone"]="aquatone -h"
1818

1919
function install_aquatone() {
20-
_Git_Clone https://github.com/shelld3v/aquatone.git
20+
_git_clone https://github.com/shelld3v/aquatone.git
2121

2222
# Build Aquatone binary
23-
_Pushd "${TOOLS_DIR}/aquatone" || return 1
24-
arch=$(_Get_Arch)
23+
_pushd "${TOOLS_DIR}/aquatone" || return 1
24+
arch=$(_get_arch)
2525
if ! GOOS=linux GOARCH=${arch} go build -o aquatone; then
2626
fail "Failed to build Aquatone."
27-
_Popd
27+
_popd
2828
return "${_FAIL}"
2929
fi
30-
_Popd
30+
_popd
3131

3232
# Add alias for Aquatone
3333
_add_tool_function "aquatone" "aquatone/aquatone"

modules/tools/autoproc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function install_autoproc() {
2121
mkdir -p "${TOOLS_DIR}/autoProc"
2222

2323
# Download autoProc.py
24-
if ! _Curl "https://gist.githubusercontent.com/knavesec/0bf192d600ee15f214560ad6280df556/raw/36ff756346ebfc7f9721af8c18dff7d2aaf005ce/autoProc.py" "${TOOLS_DIR}/autoProc/autoProc.py"; then
24+
if ! _curl "https://gist.githubusercontent.com/knavesec/0bf192d600ee15f214560ad6280df556/raw/36ff756346ebfc7f9721af8c18dff7d2aaf005ce/autoProc.py" "${TOOLS_DIR}/autoProc/autoProc.py"; then
2525
fail "Failed to download autoProc.py."
2626
return "${_FAIL}"
2727
fi

modules/tools/badrats.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ function install_badrats() {
2424
PIP_INSTALLS=()
2525

2626
# Call the function
27-
_Install_Git_Python_Tool "${TOOL_NAME}" "${GIT_URL}" false "${REQUIREMENTS_FILE}" "${PIP_INSTALLS[@]}"
27+
_install_git_python_tool "${TOOL_NAME}" "${GIT_URL}" false "${REQUIREMENTS_FILE}" "${PIP_INSTALLS[@]}"
2828
}

0 commit comments

Comments
 (0)