#!/usr/bin/env bash
#set -x

# ======================== !! NOTE !! ========================
#  ________ ________ ________ ________ ________ ________ ________ ________ ________     ___    ___
# |\  _____\\  _____\\  _____\\  _____\\  _____\\  _____\\  _____\\  _____\\   __  \   |\  \  /  /|
# \ \  \__/\ \  \__/\ \  \__/\ \  \__/\ \  \__/\ \  \__/\ \  \__/\ \  \__/\ \  \|\  \  \ \  \/  / /
#  \ \   __\\ \   __\\ \   __\\ \   __\\ \   __\\ \   __\\ \   __\\ \   __\\ \  \\\  \  \ \    / /
#   \ \  \_| \ \  \_| \ \  \_| \ \  \_| \ \  \_| \ \  \_| \ \  \_| \ \  \_| \ \  \\\  \  /     \/
#    \ \__\   \ \__\   \ \__\   \ \__\   \ \__\   \ \__\   \ \__\   \ \__\   \ \_______\/  /\   \
#     \|__|    \|__|    \|__|    \|__|    \|__|    \|__|    \|__|    \|__|    \|_______/__/ /\ __\
#                                                                                      |__|/ \|__|
# 注: 该脚本适用于 debian、kali、Ubuntu、Centos、RedHat、Fedora 等系列系统下
# 注: 完全适配 debian 系列系统
# 注: 基本适配 RedHat 系列系统
# 注: 完全适配 x86 和 arm 架构
# 注: 适配 Centos8 和 Fedora 系统时有些小bug,但不影响使用,可以忽略
# 注: 走代理时,请确认配置好 Proxychains-ng 代理
# Note: This script is available for debian, kali, Ubuntu, Centos, RedHat, Fedora, etc.
# Note: Fully compatible with debian series systems
# Note: Partially adapted to RedHat series systems
# Note: Fully compatible with x86 and arm architectures
# Note: There are some small bugs when adapting to Centos8 and Fedora systems, but it does not affect the use, can be ignored
# Note: When using a proxy, please make sure the Proxychains-ng proxy is configured.

# ===================== Basic variable settings =====================
P_Dir=/pentest
T_Dir=/ffffffff0x
Default_DNS=223.5.5.5
Proxy_URL="https://cdn.ffffffff0x.com/?durl=https://codeload.github.com/rofl0r/proxychains-ng/zip/master"
Proxy_OK=
Docker_OK=
error=0
Linux_architecture_Name=
F8x_Version="1.9.1 (2026/04/21)"
wget_option="-q --show-progress"

# ===================== Software version variable setting (dev) =====================
# https://www.ruby-lang.org/en/downloads/
Ruby_Ver="3.0"
Ruby_Dir="ruby-3.0.0"
Ruby_bin="ruby-3.0.0.tar.gz"
# https://go.dev/dl/
Go_Version="go1.25.7"
Go_Bin_amd64="go1.25.7.linux-amd64.tar.gz"
Go_Bin_arm64="go1.25.7.linux-arm64.tar.gz"
# https://nodejs.org/dist/
node_Ver="v25.7.0"
node_bin_amd64="node-v25.7.0-linux-x64.tar.xz"
node_bin_arm64="node-v25.7.0-linux-arm64.tar.xz"
node_Dir_amd64="node-v25.7.0-linux-x64"
node_Dir_arm64="node-v25.7.0-linux-arm64"
# http://nginx.org/en/download.html
nginx_Ver="1.28.2"
nginx_bin="nginx-1.28.2.tar.gz"
# https://www.lua.org/download.html
lua_bin="lua-5.4.3.tar.gz"
lua_dir="lua-5.4.3"
# https://github.com/stedolan/jq/releases
jq_bin="jq-1.8.0.zip"
jq_dir="jq-1.8.0"
jq_ver="jq-1.8.0"
# https://github.com/tsl0922/ttyd/releases
ttyd_Ver="1.7.7"
ttyd_bin_amd64="ttyd.x86_64"
ttyd_bin_arm64="ttyd.arm"
# https://github.com/coder/code-server
code_server_Ver="v4.115.0"
code_server_bin1_amd64="code-server-4.115.0-amd64.rpm"
code_server_bin2_amd64="code-server_4.115.0_amd64.deb"
code_server_bin1_arm64="code-server-4.115.0-arm64.rpm"
code_server_bin2_arm64="code-server_4.115.0_arm64.deb"
# https://www.python.org/downloads/
py37_ver="3.7.12"
py37_bin="Python-3.7.12.tar.xz"
py37_dir="Python-3.7.12"
py38_ver="3.8.12"
py38_bin="Python-3.8.12.tar.xz"
py38_dir="Python-3.8.12"
py39_ver="3.9.8"
py39_bin="Python-3.9.8.tar.xz"
py39_dir="Python-3.9.8"
py310_ver="3.10.4"
py310_bin="Python-3.10.4.tar.xz"
py310_dir="Python-3.10.4"
# https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2FLAST_CHANGE?alt=media
# https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/958422/
chromium_Ver="958422"
# https://phantomjs.org/download.html
phantomjs_bin="phantomjs-2.1.1-linux-x86_64.tar.bz2"
phantomjs_dir="phantomjs-2.1.1-linux-x86_64"

# ===================== Software version variable setting (pentest) =====================
# https://github.com/fatedier/frp/releases
frp_Ver="v0.68.1"
frp_File_amd64="frp_0.68.1_linux_amd64.tar.gz"
frp_File_arm64="frp_0.68.1_linux_arm64.tar.gz"
frp_Dir_amd64="frp_0.68.1_linux_amd64"
frp_Dir_arm64="frp_0.68.1_linux_arm64"
# https://github.com/ehang-io/nps/releases
nps_Ver="v0.26.10"
nps_File_amd64="linux_amd64_server.tar.gz"
nps_File_arm64="linux_arm64_server.tar.gz"
# https://github.com/wikiZ/RedGuard/releases
RedGuard_Ver="24.06.18"
RedGuard_File_amd64="RedGuard_64"
# https://github.com/RustScan/RustScan/releases
RustScan_Version="2.4.1"
RustScan_bin="rustscan.deb.zip"
RustScan_Install="rustscan_2.4.1-1_amd64.deb"
# https://github.com/boy-hack/ksubdomain/releases
ksubdomain_Ver="v2.4.0"
ksubdomain_Install="KSubdomain-v2.4.0-linux-amd64.zip"
# https://github.com/chaitin/xray/releases
xray_Ver="1.9.11"
xray_File_amd64="xray_linux_amd64.zip"
xray_bin_amd64="xray_linux_amd64"
xray_File_arm64="xray_linux_arm64.zip"
xray_bin_arm64="xray_linux_arm64"
# https://github.com/shadow1ng/fscan/releases
fscan_Ver="1.8.4"
fscan_Install_amd64="fscan"
fscan_Install_arm64="fscan_arm64"
# https://github.com/ffuf/ffuf/releases
ffuf_Ver="v2.1.0"
ffuf_Install_amd64="ffuf_2.1.0_linux_amd64.tar.gz"
ffuf_Install_arm64="ffuf_2.1.0_linux_arm64.tar.gz"
# https://github.com/projectdiscovery/nuclei/releases
Nuclei_Ver="v3.7.1"
Nuclei_Install_amd64="nuclei_3.7.1_linux_amd64.zip"
Nuclei_Install_arm64="nuclei_3.7.1_linux_arm64.zip"
# https://github.com/Ne0nd0g/merlin/releases
merlin_Ver="v2.1.4"
merlin_Install_amd64="merlinServer-Linux-x64.7z"
# https://github.com/chaitin/rad/releases
rad_Ver="1.0"
rad_File_amd64="rad_linux_amd64.zip"
rad_File_arm64="rad_linux_arm64.zip"
rad_bin_amd64="rad_linux_amd64"
rad_bin_arm64="rad_linux_arm64"
# https://github.com/Qianlitp/crawlergo/releases
crawlergo_Ver="v0.4.4"
crawlergo_File_amd64="crawlergo_linux_amd64"
crawlergo_File_arm64="crawlergo_linux_arm64"
# https://github.com/gloxec/CrossC2/releases
CrossC2_Ver="v3.3"
# https://github.com/mitmproxy/mitmproxy/releases
mitmproxy_Ver="12.2.2"
mitmproxy_bin="mitmproxy-12.2.2-linux-x86_64.tar.gz"
# https://github.com/projectdiscovery/naabu/releases
naabu_Ver="v2.5.0"
naabu_bin="naabu_2.5.0_linux_amd64.zip"
# https://github.com/hashcat/hashcat/releases
hashcat_Version="v7.1.2"
hashcat_File="hashcat-7.1.2.7z"
# https://github.com/projectdiscovery/subfinder/releases
subfinder_Ver="v2.13.0"
subfinder_bin_amd64="subfinder_2.13.0_linux_amd64.zip"
subfinder_bin_arm64="subfinder_2.13.0_linux_arm64.zip"
# https://github.com/zan8in/afrog
afrog_Ver="v3.5.2"
afrog_File_amd64="afrog_3.5.2_linux_amd64.zip"
afrog_File_arm64="afrog_3.5.2_linux_arm64.zip"
afrog_bin_amd64="afrog"
afrog_bin_arm64="afrog"
# https://github.com/SleepingBag945/dddd
dddd_Ver="v2.0.1"
dddd_bin_amd64="dddd_linux64"
dddd_bin_arm64="dddd_linux_arm64"
# https://github.com/projectdiscovery/httpx/releases
httpx_Ver="v1.9.0"
httpx_bin_amd64="httpx_1.9.0_linux_amd64.zip"
httpx_bin_arm64="httpx_1.9.0_linux_arm64.zip"
# https://github.com/projectdiscovery/mapcidr/releases
mapcidr_Ver="v1.1.97"
mapcidr_bin_amd64="mapcidr_1.1.97_linux_amd64.zip"
mapcidr_bin_arm64="mapcidr_1.1.97_linux_arm64.zip"
# https://github.com/ffffffff0x/iprange/releases
iprange_Ver="v1.0.2"
iprange_bin_amd64="iprange_1.0.2_linux_amd64.tar.gz"
iprange_bin_arm64="iprange_1.0.2_linux_arm64.tar.gz"
# https://github.com/projectdiscovery/dnsx/releases
dnsx_Ver="v1.2.3"
dnsx_bin_amd64="dnsx_1.2.3_linux_amd64.zip"
dnsx_bin_arm64="dnsx_1.2.3_linux_arm64.zip"
# https://github.com/iBotPeaches/Apktool/releases
apktool_Ver="v3.0.1"
apktool_bin="apktool_3.0.1.jar"
# https://github.com/lc/gau/releases
gau_Ver="v2.2.4"
gau_bin="gau_2.2.4_linux_amd64.tar.gz"
# https://github.com/skylot/jadx/releases
jadx_Ver="v1.5.5"
jadx_bin="jadx-1.5.5.zip"
# https://github.com/qtc-de/remote-method-guesser/releases
rmg_Ver="v5.1.0"
rmg_bin="rmg-5.1.0-jar-with-dependencies.jar"
# https://github.com/No-Github/anew/releases
anew_Ver="v1.0.3"
anew_bin_amd64="anew_1.0.3_linux_amd64.tar.gz"
anew_bin_arm64="anew_1.0.3_linux_arm64.tar.gz"
# https://github.com/zu1k/nali/releases
nali_Ver="v0.8.1"
nali_bin_amd64="nali-linux-amd64-v0.8.1.gz"
nali_bin_arm64="nali-linux-armv8-v0.8.1.gz"
# https://github.com/hahwul/dalfox/releases
dalfox_Ver="v2.12.0"
dalfox_bin_amd64="dalfox-linux-amd64.tar.gz"
dalfox_bin_arm64="dalfox-linux-arm64.tar.gz"
# https://github.com/WangYihang/Platypus/releases
Platypus_Ver="v1.5.1"
Platypus_bin_amd64="Platypus_linux_amd64"
Platypus_bin_arm64="Platypus_linux_arm64"
# https://github.com/OWASP/Amass/releases
Amass_Ver="v5.1.1"
Amass_bin_amd64="amass_linux_amd64.tar.gz"
Amass_bin_arm64="amass_linux_arm64.tar.gz"
# https://github.com/OJ/gobuster/releases
gobuster_Ver="v3.8.2"
gobuster_bin_amd64="gobuster_Linux_x86_64.tar.gz"
gobuster_bin_arm64="gobuster_Linux_arm64.tar.gz"
# https://github.com/jaeles-project/gospider/releases
gospider_Ver="v1.1.6"
gospider_bin_amd64="gospider_v1.1.6_linux_x86_64.zip"
gospider_dir_amd64="gospider_v1.1.6_linux_x86_64"
gospider_bin_arm64="gospider_v1.1.6_linux_arm64.zip"
gospider_dir_arm64="gospider_v1.1.6_linux_arm64"
# https://github.com/tomnomnom/unfurl/releases
unfurl_Ver="v0.4.3"
unfurl_Bin="unfurl-linux-amd64-0.4.3.tgz"
# https://github.com/tomnomnom/qsreplace/releases
qsreplace_Ver="v0.0.3"
qsreplace_bin="qsreplace-linux-amd64-0.0.3.tgz"
# https://github.com/lc/subjs/releases
subjs_Ver="v1.0.1"
subjs_bin="subjs_1.0.1_linux_amd64.tar.gz"
# https://github.com/tomnomnom/assetfinder/releases
assetfinder_Ver="v0.1.1"
assetfinder_bin="assetfinder-linux-amd64-0.1.1.tgz"
# https://github.com/zhzyker/dismap/releases
dismap_Ver="v0.4"
dismap_bin_amd64="dismap-0.4-linux-amd64"
dismap_bin_arm64="dismap-0.4-linux-arm64"
# https://github.com/wh1t3p1g/ysomap/releases
ysomap_Ver="v0.1.5"
ysomap_bin="ysomap.jar"
JNDIExploit_Ver="1.1"
JNDIExploit_bin="JNDIExploit.zip"
# https://github.com/shmilylty/netspy/releases
netspy_Ver="v0.0.5"
netspy_bin_amd64="netspy_linux_amd64.zip"
netspy_bin_arm64="netspy_linux_arm64.zip"
# https://github.com/cdk-team/CDK/releases
cdk_Ver="v1.5.6"
cdk_bin_amd64="cdk_linux_amd64"
cdk_bin_arm64="cdk_linux_arm64"
# https://github.com/Esonhugh/k8spider/releases
k8spider_Ver="v3.2.0"
# https://github.com/Esonhugh/ingressNightmare-CVE-2025-1974-exps/releases
ingressnightmare_Ver="v0.4.1"
# https://dl.k8s.io/release/stable.txt
kubectl_Ver="v1.35.3"
# https://github.com/cyberark/kubeletctl/releases
kubeletctl_Ver="v1.13"
# https://github.com/inguardians/peirates/releases
peirates_Ver="v1.29a"
# https://github.com/etcd-io/etcd/releases
etcdctl_Ver="v3.6.10"
# https://github.com/nicocha30/ligolo-ng/releases
ligolo_ng_Ver="v0.8.3"
# https://github.com/peass-ng/PEASS-ng/releases
peass_ng_Ver="20260412-090b08ae"
# https://github.com/BeichenDream/GodPotato/releases
GodPotato_Ver="V1.20"
# https://github.com/gentilkiwi/mimikatz/releases
mimikatz_Ver="2.2.0-20220919"
# https://github.com/BloodHoundAD/SharpHound/releases
SharpHound_Ver="v2.12.0"
# https://github.com/itm4n/PrintSpoofer/releases
PrintSpoofer_Ver="v1.0"
# https://github.com/QAX-A-Team/sharpwmi/releases
SharpWMI_Ver="v2"
# https://github.com/mandiant/SharPersist/releases
SharPersist_Ver="v1.0.1"
# https://github.com/FuzzySecurity/StandIn/releases
StandIn_Ver="v1.3"
# https://github.com/projectdiscovery/interactsh/releases
interactsh_Ver="v1.3.1"
interactsh_client_bin_amd64="interactsh-client_1.3.1_Linux_amd64.zip"
interactsh_server_bin_amd64="interactsh-server_1.3.1_Linux_amd64.zip"
interactsh_client_bin_arm64="interactsh-client_1.3.1_Linux_arm64.zip"
interactsh_server_bin_arm64="interactsh-server_1.3.1_Linux_arm64.zip"
# https://github.com/BishopFox/sliver/releases
sliver_Ver="v1.7.3"
sliver_Server_bin_amd64="sliver-server_linux-amd64"
sliver_Server_bin_arm64="sliver-server_linux-arm64"
sliver_Client_bin_amd64="sliver-client_linux-amd64"
sliver_Client_bin_arm64="sliver-client_linux-arm64"
# https://github.com/mstxq17/MoreFind/releases
MoreFind_Ver="v1.5.7"
MoreFind_bin_amd64="MoreFind_v1.5.7_linux_x86_64.tar.gz"
MoreFind_bin_arm64="MoreFind_v1.5.7_Linux_arm64.tar.gz"
# https://github.com/praetorian-inc/fingerprintx
fingerprintx_Ver="v1.1.13"
fingerprintx_Install_amd64="fingerprintx_1.1.13_linux_amd64.tar.gz"
fingerprintx_Install_arm64="fingerprintx_1.1.13_linux_arm64.tar.gz"
# https://github.com/teamssix/cf
cf_Ver="v0.5.0"
cf_Install_amd64="cf_v0.5.0_linux_amd64.tar.gz"
cf_Install_arm64="cf_v0.5.0_linux_arm64.tar.gz"
# https://github.com/su18/ysoserial
ysuserial_Ver="v1.5"
ysuserial_bin="ysuserial-1.5-su18-all.jar"
# https://github.com/projectdiscovery/katana
katana_Ver="v1.5.0"
katana_bin_amd64="katana_1.5.0_linux_amd64.zip"
katana_bin_arm64="katana_1.5.0_linux_arm64.zip"
# https://github.com/projectdiscovery/uncover
uncover_Ver="v1.2.0"
uncover_bin_amd64="uncover_1.2.0_linux_amd64.zip"
uncover_bin_arm64="uncover_1.2.0_linux_arm64.zip"
# https://github.com/pmiaowu/HostCollision
HostCollision_Ver="HostCollision-2.2.9"
HostCollision_Bin="HostCollision-2.2.9.zip"
HostCollision_dir="HostCollision-2.2.9"
# https://github.com/projectdiscovery/asnmap
asnmap_Ver="v1.1.1"
asnmap_bin_amd64="asnmap_1.1.1_linux_amd64.zip"
asnmap_bin_arm64="asnmap_1.1.1_linux_arm64.zip"
# https://github.com/projectdiscovery/tlsx
tlsx_Ver="v1.2.2"
tlsx_bin_amd64="tlsx_1.2.2_linux_amd64.zip"
tlsx_bin_arm64="tlsx_1.2.2_linux_arm64.zip"
# https://github.com/chainreactors/gogo
gogo_Ver="v2.14.1"
gogo_File_amd64="gogo_linux_amd64"
gogo_File_arm64="gogo_linux_arm64"
# https://github.com/chainreactors/spray
spray_Ver="v1.2.6"
spray_File_amd64="spray_linux_amd64"
spray_File_arm64="spray_linux_arm64"
# https://github.com/chainreactors/zombie
zombie_Ver="v1.2.2"
zombie_File_amd64="zombie_linux_amd64"
zombie_File_arm64="zombie_linux_arm64"
# https://github.com/EddieIvan01/iox/releases
iox_Ver="v0.4"
iox_File_amd64="iox_v0.4-next_Linux_x86_64.tar.gz"
iox_File_arm64="iox_v0.4-next_Linux_i386.tar.gz"
# https://github.com/jpillora/chisel/releases
chisel_Ver="v1.11.5"
chisel_File_amd64="chisel_1.11.5_linux_amd64.gz"
chisel_File_arm64="chisel_1.11.5_linux_arm64.gz"
# https://github.com/projectdiscovery/simplehttpserver
simplehttpserver_Ver="v0.0.6"
simplehttpserver_bin_amd64="simplehttpserver_0.0.6_linux_amd64.zip"
simplehttpserver_bin_arm64="simplehttpserver_0.0.6_linux_arm64.zip"
# https://github.com/ropnop/kerbrute
kerbrute_bin="kerbrute_linux_amd64"
kerbrute_Ver="v1.0.3"
# https://github.com/lzzbb/Adinfo
Adinfo_bin="Adinfo_linux"
Adinfo_Ver="v0.3"
# https://github.com/zema1/suo5
suo5_Ver="v2.1.0"
suo5_bin_amd64="suo5-linux-amd64"
suo5_bin_arm64="suo5-linux-arm64"
# https://github.com/projectdiscovery/alterx
alterx_Ver="v0.1.0"
alterx_bin_amd64="alterx_0.1.0_linux_amd64.zip"
alterx_bin_arm64="alterx_0.1.0_linux_arm64.zip"
# https://github.com/rmb122/rogue_mysql_server/releases
rogue_mysql_server_Ver="v1.0.1"
rogue_mysql_server_bin_amd64="rogue_mysql_server-v1.0.1-linux-amd64.zip"
rogue_mysql_server_bin_arm64="rogue_mysql_server-v1.0.1-linux-arm64.zip"

# ===================== Software version variable setting (other) =====================
# https://github.com/AdguardTeam/AdGuardHome/releases
AdGuardHome_Version="v0.107.73"
AdGuardHome_File_amd64="AdGuardHome_linux_amd64.tar.gz"
AdGuardHome_File_arm64="AdGuardHome_linux_arm64.tar.gz"
# https://github.com/junegunn/fzf/releases
fzf_Ver="v0.71.0"
fzf_bin_amd64="fzf-0.71.0-linux_amd64.tar.gz"
fzf_bin_arm64="fzf-0.71.0-linux_arm64.tar.gz"
# https://github.com/iawia002/lux/releases
lux_Ver="v0.24.1"
lux_bin_amd64="lux_0.24.1_Linux_x86_64.tar.gz"
lux_bin_arm64="lux_0.24.1_Linux_ARM64.tar.gz"
# https://github.com/tomnomnom/gron/releases
gron_Ver="v0.7.1"
gron_bin_amd64="gron-linux-amd64-0.7.1.tgz"
gron_bin_arm64="gron-linux-arm64-0.7.1.tgz"
# https://github.com/abhimanyu003/sttr/releases
sttr_Ver="v0.2.30"
sttr_bin_amd64="sttr_Linux_x86_64.tar.gz"
sttr_bin_arm64="sttr_Linux_arm64.tar.gz"
# https://github.com/sharkdp/bat/releases
bat_Ver="v0.26.1"
bat_bin_amd64="bat-musl_0.26.1_musl-linux-amd64.deb"
bat_bin_arm64="bat-musl_0.26.1_musl-linux-i686.deb"
# https://github.com/muesli/duf/releases
duf_Ver="v0.9.1"
duf_bin1_amd64="duf_0.9.1_linux_amd64.rpm"
duf_bin2_amd64="duf_0.9.1_linux_amd64.deb"
duf_bin1_arm64="duf_0.9.1_linux_arm64.rpm"
duf_bin2_arm64="duf_0.9.1_linux_arm64.deb"
# https://github.com/dalance/procs/releases
procs_Ver="v0.14.11"
procs_bin="procs-v0.14.11-x86_64-linux.zip"
# https://github.com/sharkdp/fd/releases
fd_Ver="v10.4.2"
fd_bin_amd64="fd_10.4.2_amd64.deb"
fd_bin_arm64="fd_10.4.2_arm64.deb"
# https://github.com/hashicorp/terraform/releases
Terraform_Ver="1.14.8"
Terraform_bin_amd64="terraform_1.14.8_linux_amd64.zip"
Terraform_bin_arm64="terraform_1.14.8_linux_arm64.zip"
# https://github.com/aliyun/aliyun-cli/releases
aliyun_cli_Ver="v3.3.6"
aliyun_cli_bin_amd64="aliyun-cli-linux-3.3.6-amd64.tgz"
aliyun_cli_bin_arm64="aliyun-cli-linux-3.3.6-arm64.tgz"
# https://github.com/wgpsec/redc/releases
redc_Ver="v3.1.9"
redc_bin_amd64="redc_v3.1.9_linux_amd64.tar.gz"
redc_bin_arm64="redc_v3.1.9_linux_arm64.tar.gz"
# https://github.com/bcicen/ctop/releases/
ctop_Ver="v0.7.7"
ctop_bin_amd64="ctop-0.7.7-linux-amd64"
ctop_bin_arm64="ctop-0.7.7-linux-arm64"
# https://github.com/mikefarah/yq
yq_Ver="v4.52.5"
yq_bin_amd64="yq_linux_amd64"
yq_bin_arm64="yq_linux_arm64"
yq_File_amd64="yq_linux_amd64.tar.gz"
yq_File_arm64="yq_linux_arm64.tar.gz"
# https://github.com/Dreamacro/clash
clash_Ver="v1.17.0"
clash_bin_amd64="clash-linux-amd64-v1.17.0.gz"
clash_bin_arm64="clash-linux-arm64-v1.17.0.gz"
clash_File_amd64="clash-linux-amd64-v1.17.0"
clash_File_arm64="clash-linux-arm64-v1.17.0"

# ===================== 不可以修改的版本(从我的仓库下载,如果修改版本号,需要同时修改下载链接) =====================
# https://www.oracle.com/java/technologies/downloads/
jdk8_Version="jdk1.8.0_321"
orclejdk_tmp_ver="1.0.5"
orclejdk8_bin_amd64="jdk-8u321-linux-x64.tar.gz"
orclejdk8_bin_arm64="jdk-8u321-linux-aarch64.tar.gz"
jdk11_Version="jdk-11.0.15"
orclejdk11_bin_amd64="jdk-11.0.15_linux-x64_bin.tar.gz"
orclejdk11_bin_arm64="jdk-11.0.15_linux-aarch64_bin.tar.gz"
jdk17_Version="jdk-17.0.8"
orclejdk17_bin_amd64="jdk-17.0.8_linux-x64_bin.tar.gz"
orclejdk17_bin_arm64="jdk-17.0.8_linux-aarch64_bin.tar.gz"
CS_File="CobaltStrike4.3.zip"
CS_Version="CobaltStrike4.3"
CS45_File="CobaltStrike4.5.zip"
CS45_Version="CobaltStrike4.5"

# 加载自定义版本配置
if test -e f8x_version.sh
then
    . ./f8x_version.sh
fi

# ===================== Base Folder =====================
Base_Dir(){

    mkdir -p /tmp > /dev/null 2>&1

    if test -d $T_Dir
    then
        Echo_INFOR "$T_Dir folder already exists"
    else
        mkdir -p $T_Dir && Echo_INFOR "$T_Dir folder created"
    fi

    date +"%Y-%m-%d" > /tmp/f8x_error.log

}

# ===================== Unlock Module =====================
Rm_Lock(){

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            rm -f /var/run/yum.pid 1> /dev/null 2>> /tmp/f8x_error.log
            rm -f /var/cache/dnf/metadata_lock.pid 1> /dev/null 2>> /tmp/f8x_error.log
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            rm -rf /var/cache/apt/archives/lock > /dev/null 2>&1
            rm -rf /var/lib/dpkg/lock-frontend > /dev/null 2>&1
            rm -rf /var/lib/dpkg/lock > /dev/null 2>&1
            rm -rf /var/lib/apt/lists/lock > /dev/null 2>&1
            apt-get --fix-broken -y install > /dev/null 2>&1
            rm -rf /var/cache/apt/archives/lock > /dev/null 2>&1
            rm -rf /var/lib/dpkg/lock-frontend > /dev/null 2>&1
            rm -rf /var/lib/dpkg/lock > /dev/null 2>&1
            rm -rf /var/lib/apt/lists/lock > /dev/null 2>&1
            ;;
        *) ;;
    esac

}

Docker_run_Check(){

    if test -e /.dockerenv
    then
        case $(ls -alh /.dockerenv 2>> /tmp/f8x_error.log) in
        *"docker"*)
            Echo_ALERT "Currently running in a Docker environment, there may be unanticipated problems"
            Docker_OK=1
            ;;
        esac
    else
        case $(cat /proc/1/cgroup 2>> /tmp/f8x_error.log) in
        *"docker"*)
            Echo_ALERT "Currently running in a Docker environment, there may be unanticipated problems"
            Docker_OK=1
            ;;
        esac
    fi

}

# ===================== Dependency Check Module =====================
Base_Check(){

    Echo_ALERT "Dependencies being checked"
    which unzip > /dev/null 2>&1 || error=1
    which wget > /dev/null 2>&1 || error=1
    which curl > /dev/null 2>&1 || error=1
    which vim > /dev/null 2>&1 || error=1
    which git > /dev/null 2>&1 || error=1
    which 7za > /dev/null 2>&1 || error=1

    if [ $error == 1 ]
    then
        Echo_ALERT "Dependencies are not passed, basic dependencies will be installed automatically"
        Base_Install
        error=0
    else
        Echo_INFOR "Base dependencies passed"
    fi

}

Py_Check(){

    Echo_ALERT "Checking Python environment availability"
    which python2 > /dev/null 2>&1 || error=1
    which python3 > /dev/null 2>&1 || error=1
    which pip3 > /dev/null 2>&1 || error=1

    if [ $error == 1 ]
    then
        Echo_ALERT "Python environment check does not pass and starts installing Python environment automatically"
        Python3_def_Install
        Python2_Install
        error=0
    else
        Echo_INFOR "Python environment passed"
    fi

}

pip2_Check(){

    case $Linux_Version in
        *"Debian"*)
            case $Linux_Version_Num in
                "12")
                    python2 -m pip --version > /dev/null 2>&1
                    ;;
                *)
                    which pip2 > /dev/null 2>&1
                    ;;
            esac
            ;;
        *)
            which pip2 > /dev/null 2>&1
        ;;
    esac

    if [ $? == 0 ]
    then
        Echo_INFOR "pip2 dependencies are normal"
    else
        Echo_ALERT "Dependencies not passed, start automatic installation of pip2"
        pip2_Install
        #Python2_Install
    fi
}

pip3_Check(){

    which pip3 > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "pip3 dependencies are normal"
    else
        Echo_ALERT "Dependencies not passed, start automatic installation of pip3"
        Python3_def_Install
    fi
}

nn_Check(){

    echo -e "\033[1;33m\n>> Checking npm & nodejs environment availability\n\033[0m"
    npm version > /dev/null 2>&1 && Echo_INFOR "npm available" || error=1
    node --version > /dev/null 2>&1 && Echo_INFOR "node $(node --version) available" || error=1

    if [ $error == 1 ]
    then
        Echo_ALERT "Dependencies not passed, start automatic installation of npm & nodejs"
        nn_Install
        error=0
    else
        Echo_INFOR "npm & nodejs passed"
    fi

}

Rust_Check(){

    echo -e "\033[1;33m\n>> Checking Rust environment availability\n\033[0m"
    cargo -V > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "Rust passed~"
    else
        Echo_ALERT "Dependencies not passed, start automatic installation of Rust"
        Rust_Install
    fi

}

JDK_Check(){

    Echo_INFOR "Checking JDK environment availability"
    which java > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "jdk passed~"
    else
        Echo_ALERT "Dependencies not passed, start automatic installation of oracle-jdk"
        Oraclejdk_Install
    fi

}

GO_Check(){

    Echo_INFOR "Checking GO environment availability"
    which go > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "go passed~"
    else
        Echo_ALERT "Dependencies not passed, start automatic installation of go"
        echo -e "\033[1;33m\n>> Installing Go\n\033[0m"
        Go_Install
    fi

}

Ruby_Check(){

    Echo_INFOR "Checking Ruby environment availability"
    which gem > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "Ruby passed~"
    else
        Echo_ALERT "Dependencies not passed, start automatic installation of Ruby"
        Ruby_Install
    fi

}

Docker_Check(){

    Echo_INFOR "Checking Docker environment availability"
    which docker > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "Docker passed~"
        service docker start > /dev/null 2>&1
        systemctl start docker > /dev/null 2>&1
    else
        Echo_ALERT "Dependencies not passed, start automatic installation of Docker"
        Docker_Install
    fi

}

Docker_Compose_Check(){

    docker compose version > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_INFOR "Docker passed~"
    else
        docker_compose_Install
    fi

    docker-compose -version > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_INFOR "Docker passed~"
    else
        docker_compose_Install
    fi

}

mac_Check(){

    case $Running_Mode in
        *"Darwin"*)
            Echo_ALERT "Not supported on mac platform"
            exit 1
            ;;
    esac

}

linux_arm64_Check(){

    case $Linux_architecture_Name in
        *"linux-arm64"*)
            Echo_ALERT "Not supported on current architecture"
            exit 1
            ;;
    esac

}

# ===================== Abbreviations =====================
Echo_INFOR(){

    echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;32m[INFOR]\033[0m - \033[1;32m$1\033[0m"

}

Echo_ALERT(){

    echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;33m[ALERT]\033[0m - \033[1;33m$1\033[0m"

}

Echo_ERROR(){

    echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;31m[ERROR]\033[0m - \033[1;31m$1\n\033[0m"

}

Echo_ERROR2(){

    Echo_ERROR "$name download failed, please check if the network is reachable, proxychains4 configuration is correct"

}

Echo_ERROR3(){

    Echo_ERROR "$name installation failed"

}

Echo_ERROR4(){

    Echo_ERROR "$1 git clone failed"

}

Install_Switch(){

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            yum install -y $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 " && return 0 || { Echo_ERROR "$1 installation failed"; return 1; }
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            apt-get install -y $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 " && return 0 || { Echo_ERROR "$1 installation failed"; return 1; }
            ;;
        *) ;;
    esac

}

Install_Switch2(){

    apt-get install -yq --no-install-recommends $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 " || Echo_ERROR "$1 installation failed"

}

Install_Switch3(){

    python2 -m pip install $1 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $1 (python2)" && return 0 || { Echo_ERROR "$1 module installation failed, please try changing the pip proxy or check if python2 is installed!"; return 1; }

}

Install_Switch4(){

    case $Linux_Version in
        *"Debian"*)
            python3 -m pip install $1 --break-system-packages 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || { pip3 install $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || Echo_ERROR "$1 module installation failed"; return 1; }
            ;;
        *)
            pip3 install $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || { pip3 install $1 --break-system-packages 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || Echo_ERROR "$1 module installation failed"; return 1; }
        ;;
    esac

}

Install_Switch5(){

    python3 -m pip install $1 --break-system-packages 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || { python3 -m pip install $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || Echo_ERROR "$1 module installation failed"; return 1; }

}

Install_Switch6(){

    python3 -m pip install -r $1 --break-system-packages 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || { python3 -m pip install -r $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || Echo_ERROR "$1 module installation failed"; return 1; }

}

Install_Switch7(){

    case $Linux_Version in
        *"Debian"*)
            python3 -m pip install -r $1 --break-system-packages 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || { pip3 install -r $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3)" && return 0 || Echo_ERROR "$1 module installation failed"; return 1; }
            ;;
        *)
            pip3 install -r $1 > /dev/null 2>&1
        ;;
    esac

}

Install_Switch8(){

    pipx install $1 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "Successfully installed $1 (python3 pipx)" && return 0 || { Echo_ERROR "$1 module installation failed"; return 1; }

}

# ===================== Proxy Switch =====================
Proxy_Switch(){

    if test -e /tmp/IS_CI
    then
        Echo_INFOR "IS_CI"
    else
        Echo_ALERT "Some regions can be configured to use proxies to increase speed"
        echo -e "\033[1;33m\n>> Does the runtime need to use a proxy? [y/N,Default N] \033[0m" && read -r input
        case $input in
            [yY][eE][sS]|[Yy])
                export GOPROXY=https://goproxy.io,direct

                case $Linux_Version in
                    *"Kali"*|*"kali"*)
                        proxychins_file="/etc/proxychains4.conf"
                        ;;
                    *)
                        proxychins_file="/etc/proxychains.conf"
                        ;;
                esac

                if test -e $proxychins_file
                then
                    Echo_INFOR "Proxychains-ng is being called"
                    Proxy_OK=proxychains4
                else
                    Echo_ALERT "Proxychains-ng is not detected, start automatic installation"
                    Proxychains_Install
                    Proxy_OK=proxychains4
                fi
                ;;
            *)
                Echo_INFOR "Pass~"
                ;;
        esac
    fi

}

Banner(){

    echo -e "\033[1;34m  _______   ___   ___   ___ \033[0m"
    echo -e "\033[1;32m |   ____| / _ \  \  \ /  / \033[0m"
    echo -e "\033[1;36m |  |__   | (_) |  \  V  / \033[0m"
    echo -e "\033[1;31m |   __|   > _ <    >   < \033[0m"
    echo -e "\033[1;35m |  |     | (_) |  /  .  \ \033[0m"
    echo -e "\033[1;33m |__|      \___/  /__/ \__\ \n\033[0m"

}

# ===================== Default =====================
Sys_Version(){

    case "$(uname -m)" in
        *"arm64"*|*"aarch64"*)
            Linux_architecture_Name="linux-arm64"
            ;;
        *"x86_64"*)
            Linux_architecture_Name="linux-x86_64"
            ;;
        *)
            echo "Not supported on current architecture"
            exit 1
            ;;
    esac

    case $(cat /etc/*-release | head -n 3) in
        *"Kali"*|*"kali"*)
            Linux_Version="Kali"
            case $(cat /etc/*-release | head -n 4) in
                *"2022"*)
                    Linux_Version_Num="kali-rolling"
                    Linux_Version_Name="buster"
                    ;;
                *"2021"*)
                    Linux_Version_Num="kali-rolling"
                    Linux_Version_Name="buster"
                    ;;
                *"2020"*)
                    Linux_Version_Num="kali-rolling"
                    Linux_Version_Name="buster"
                    ;;
                *)
                    Linux_Version_Num="kali-rolling"
                    Linux_Version_Name="stretch"
                    ;;
            esac
            ;;
        *"Ubuntu"*|*"ubuntu"*)
            Linux_Version="Ubuntu"
            case $(cat /etc/*-release | head -n 4) in
                *"oracular"*)
                    Linux_Version_Num="24.10"
                    Linux_Version_Name="oracular"
                    ;;
                *"noble"*)
                    Linux_Version_Num="24.04"
                    Linux_Version_Name="noble"
                    ;;
                *"mantic"*)
                    Linux_Version_Num="23.10"
                    Linux_Version_Name="mantic"
                    ;;
                *"lunar"*)
                    Linux_Version_Num="23.04"
                    Linux_Version_Name="lunar"
                    ;;
                *"kinetic"*)
                    Linux_Version_Num="22.10"
                    Linux_Version_Name="kinetic"
                    ;;
                *"jammy"*)
                    Linux_Version_Num="22.04"
                    Linux_Version_Name="jammy"
                    ;;
                *"impish"*)
                    Linux_Version_Num="21.10"
                    Linux_Version_Name="impish"
                    ;;
                *"hirsute"*)
                    Linux_Version_Num="21.04"
                    Linux_Version_Name="hirsute"
                    ;;
                *"groovy"*)
                    Linux_Version_Num="20.10"
                    Linux_Version_Name="groovy"
                    ;;
                *"focal"*)
                    Linux_Version_Num="20.04"
                    Linux_Version_Name="focal"
                    ;;
                *"eoan"*)
                    Linux_Version_Num="19.10"
                    Linux_Version_Name="eoan"
                    ;;
                *"disco"*)
                    Linux_Version_Num="19.04"
                    Linux_Version_Name="disco"
                    ;;
                *"cosmic"*)
                    Linux_Version_Num="18.10"
                    Linux_Version_Name="cosmic"
                    ;;
                *"bionic"*)
                    Linux_Version_Num="18.04"
                    Linux_Version_Name="bionic"
                    ;;
                *"xenial"*)
                    Linux_Version_Num="16.04"
                    Linux_Version_Name="xenial"
                    ;;
                *"vivid"*)
                    Linux_Version_Num="15.04"
                    Linux_Version_Name="vivid"
                    ;;
                *"trusty"*)
                    Linux_Version_Num="14.04"
                    Linux_Version_Name="trusty"
                    ;;
                *"precise"*)
                    Linux_Version_Num="12.04"
                    Linux_Version_Name="precise"
                    ;;
                *)
                    Echo_ALERT "Unknown Ubuntu Codename, attempting automatic adaptation."
                    Linux_Version_Num=$(cat /etc/*-release | awk -F "=" '/DISTRIB_RELEASE/ {print $2}')
                    Linux_Version_Name=$(cat /etc/*-release | awk -F "=" '/DISTRIB_CODENAME/ {print $2}')
                    ;;
            esac
            ;;
        *"Debian"*|*"debian"*)
            Linux_Version="Debian"
            case $(cat /etc/*-release | head -n 4) in
                *"bookworm"*)
                    Linux_Version_Num="12"
                    Linux_Version_Name="bookworm"
                    ;;
                *"bullseye"*)
                    Linux_Version_Num="11"
                    Linux_Version_Name="bullseye"
                    ;;
                *"buster"*)
                    Linux_Version_Num="10"
                    Linux_Version_Name="buster"
                    ;;
                *"stretch"*)
                    Linux_Version_Num="9"
                    Linux_Version_Name="stretch"
                    ;;
                *"jessie"*)
                    Linux_Version_Num="8"
                    Linux_Version_Name="jessie"
                    ;;
                *"wheezy"*)
                    Linux_Version_Num="7"
                    Linux_Version_Name="wheezy"
                    ;;
                *)
                    Echo_ALERT "Unknown Debian Codename, attempting automatic adaptation."
                    Linux_Version_Num=$(grep -Po '(?<=VERSION_ID=")\d+' /etc/*-release)
                    Linux_Version_Name=$(cat /etc/*-release | awk -F "=" '/VERSION_CODENAME/ {print $2}')
                    ;;
            esac
            ;;
        *"CentOS"*|*"centos"*)
            wget_option=""
            echo -e "\033[1;31mPlease replace your Centos, as Centos will not be maintained.\033[0m"
            Linux_Version="CentOS"
            case $(cat /etc/*-release | head -n 1) in
                *"Stream release 9"*)
                    Linux_Version_Num="9 Stream"
                    Linux_Version_Name=""
                    ;;
                *"Stream release 8"*)
                    Linux_Version_Num="8 Stream"
                    Linux_Version_Name=""
                    ;;
                *"release 8"*)
                    Linux_Version_Num="8"
                    Linux_Version_Name=""
                    ;;
                *"release 7"*)
                    Linux_Version_Num="7"
                    Linux_Version_Name=""
                    ;;
                *"release 6"*)
                    Linux_Version_Num="6"
                    Linux_Version_Name=""
                    ;;
                *)
                    Echo_ERROR "Unknown CentOS Codename"
                    exit 1
                    ;;
            esac
            ;;
        *"RedHat"*|*"redhat"*)
            Linux_Version="RedHat"
            ;;
        *"Fedora"*|*"fedora"*)
            Linux_Version="Fedora"
            case $(cat /etc/*-release | head -n 1) in
                *"release 40"*)
                    Linux_Version_Num="40"
                    Linux_Version_Name=""
                    ;;
                *"release 39"*)
                    Linux_Version_Num="39"
                    Linux_Version_Name=""
                    ;;
                *"release 38"*)
                    Linux_Version_Num="38"
                    Linux_Version_Name=""
                    ;;
                *"release 37"*)
                    Linux_Version_Num="37"
                    Linux_Version_Name=""
                    ;;
                *"release 36"*)
                    Linux_Version_Num="36"
                    Linux_Version_Name=""
                    ;;
                *"release 35"*)
                    Linux_Version_Num="35"
                    Linux_Version_Name=""
                    ;;
                *"release 34"*)
                    Linux_Version_Num="34"
                    Linux_Version_Name=""
                    ;;
                *"release 33"*)
                    Linux_Version_Num="33"
                    Linux_Version_Name=""
                    ;;
                *"release 32"*)
                    Linux_Version_Num="32"
                    Linux_Version_Name=""
                    ;;
                *)
                    Echo_ALERT "Unknown Fedora Codename, attempting automatic adaptation."
                    Linux_Version_Num=$(cat /etc/*-release | awk -F "=" '/VERSION_ID/ {print $2}')
                    Linux_Version_Name=""
                    ;;
            esac
            ;;
        *"AlmaLinux"*)
            Linux_Version="AlmaLinux"
            ;;
        *"Virtuozzo"*)
            Linux_Version="VzLinux"
            ;;
        *"Rocky"*)
            Linux_Version="Rocky"
            ;;
        *)
            Echo_ERROR "Unknown version"
            echo -e "\033[1;33m\nPlease enter distribution Kali[k] Ubuntu[u] Debian[d] Centos[c] RedHat[r] Fedora[f] AlmaLinux[a] VzLinux[v] Rocky[r]\033[0m" && read -r input
            case $input in
                [kK])
                    Linux_Version="Kali"
                    ;;
                [uU])
                    Linux_Version="Ubuntu"
                    echo -e "\033[1;33m\nPlease enter the system version number [22.04] [21.10] [21.04] [20.10] [20.04] [19.10] [19.04] [18.10] [18.04] [16.04] [15.04] [14.04] [12.04]\033[0m" && read -r input
                    Linux_Version_Name=$input
                    ;;
                [dD])
                    Linux_Version="Debian"
                    echo -e "\033[1;33m\nPlease enter the system version number [11] [10] [9] [8] [7]\033[0m" && read -r input
                    Linux_Version_Name=$input
                    ;;
                [cC])
                    Linux_Version="CentOS"
                    echo -e "\033[1;33m\nPlease enter the system version number [9 Stream] [8 Stream] [8] [7] [6]\033[0m" && read -r input
                    Linux_Version_Name=$input
                    ;;
                [rR])
                    Linux_Version="RedHat"
                    ;;
                [aA])
                    Linux_Version="AlmaLinux"
                    ;;
                [fF])
                    Linux_Version="Fedora"
                    echo -e "\033[1;33m\nPlease enter the system version number [36] [35] [34] [33] [32]\033[0m" && read -r input
                    Linux_Version_Name=$input
                    ;;
                [vV])
                    Linux_Version="VzLinux"
                    ;;
                [rR])
                    Linux_Version="Rocky"
                    ;;
                *)
                    Echo_ERROR "Unknown version"
                    exit 1
                    ;;
            esac
            ;;
    esac

}

Sys_Version_Mac(){

    Linux_Version="$(sw_vers -ProductName)"

    case "$(uname -m)" in
        *"arm64"*)
            Linux_architecture_Name="mac-arm64"
            Linux_Version_Num="$(sw_vers -productVersion)"
            Linux_Version_Name="$(sw_vers -BuildVersion)"

            P_Dir="~/pentest"
            T_Dir="~/ffffffff0x"
            ;;
        *)
            echo "Not supported on current architecture"
            exit 1
            ;;
    esac

}

Sys_Info(){

    echo -e "\033[1;32mUID           :\033[0m \033[1;35m$UID \033[0m"
    echo -e "\033[1;32mUser          :\033[0m \033[1;35m$(whoami) \033[0m"
    echo -e "\033[1;32mDate          :\033[0m \033[1;35m$(date +"%Y-%m-%d") \033[0m"
    echo -e "\033[1;32mTime          :\033[0m \033[1;35m$(date +"%H:%M:%S") \033[0m"
    echo -e "\033[1;32mRuntime       :\033[0m \033[1;35m$(uptime 2>/dev/null | awk '{print $3 $4}' | sed 's/\,.*$//g') \033[0m"
    echo -e "\033[1;32mHostname      :\033[0m \033[1;35m$(hostname) \033[0m"
    echo -e "\033[1;32mDistribution  :\033[0m \033[1;35m$Linux_Version $Linux_Version_Num $Linux_Version_Name $Linux_architecture_Name\033[0m"
    echo -e "\033[1;32mf8x Version   :\033[0m \033[1;35m$F8x_Version \033[0m"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            if test -e /var/log/secure
            then
                echo -e "\033[1;32mLast login IP :\033[0m"
                echo -e "\033[1;35m$(grep 'Accepted' /var/log/secure | awk '{print $11}' | sort | uniq -c | sort -nr) \033[0m"
            fi
            ;;
        *"Kali"*)
                echo "" > /dev/null
            ;;
        *)
            if test -e /var/log/auth.log
            then
                echo -e "\033[1;32mLast login IP :\033[0m"
                echo -e "\033[1;35m$(grep --text "Accepted " /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -nr) \033[0m"
            fi
            ;;

    esac

}

# ===================== Update apt source =====================
Update_APT_Mirror(){

    Echo_INFOR "Updating $Linux_Version apt source"

    case $Linux_Version in
        *"Kali"*)
            Echo_INFOR "kali"
            Echo_INFOR "Backed up apt source"
            Update_kali_Mirror "$1" > /dev/null
            ;;
        *"Ubuntu"*)
            case $Linux_Version_Num in
                "24.10")
                    Echo_INFOR "Ubuntu24.10"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2410_Mirror "$1" > /dev/null
                    ;;
                "24.04")
                    Echo_INFOR "Ubuntu24.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2404_Mirror "$1" > /dev/null
                    ;;
                "23.10")
                    Echo_INFOR "Ubuntu23.10"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2310_Mirror "$1" > /dev/null
                    ;;
                "23.04")
                    Echo_INFOR "Ubuntu23.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2304_Mirror "$1" > /dev/null
                    ;;
                "22.10")
                    Echo_INFOR "Ubuntu22.10"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2210_Mirror "$1" > /dev/null
                    ;;
                "22.04")
                    Echo_INFOR "Ubuntu22.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2204_Mirror "$1" > /dev/null
                    ;;
                "21.10")
                    Echo_INFOR "Ubuntu21.10"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2110_Mirror "$1" > /dev/null
                    ;;
                "21.04")
                    Echo_INFOR "Ubuntu21.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2104_Mirror "$1" > /dev/null
                    ;;
                "20.10")
                    Echo_INFOR "Ubuntu20.10"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2010_Mirror "$1" > /dev/null
                    ;;
                "20.04")
                    Echo_INFOR "Ubuntu20.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu2004_Mirror "$1" > /dev/null
                    ;;
                "19.10")
                    Echo_INFOR "Ubuntu19.10"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1910_Mirror "$1" > /dev/null
                    ;;
                "19.04")
                    Echo_INFOR "Ubuntu19.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1804_Mirror "$1" > /dev/null
                    ;;
                "18.10")
                    Echo_INFOR "Ubuntu18.10"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1804_Mirror "$1" > /dev/null
                    ;;
                "18.04")
                    Echo_INFOR "Ubuntu18.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1804_Mirror "$1" > /dev/null
                    ;;
                "16.04")
                    Echo_INFOR "Ubuntu16.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1604_Mirror "$1" > /dev/null
                    ;;
                "15.04")
                    Echo_INFOR "Ubuntu15.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1504_Mirror "$1" > /dev/null
                    ;;
                "14.04")
                    Echo_INFOR "Ubuntu14.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1404_Mirror "$1" > /dev/null
                    ;;
                "12.04")
                    Echo_INFOR "Ubuntu12.04"
                    Echo_INFOR "Backed up apt source"
                    Update_Ubuntu1204_Mirror "$1" > /dev/null
                    ;;
                *)
                    Echo_ERROR "Version error"
                    ;;
            esac
            ;;
        *"Debian"*)
            case $Linux_Version_Num in
                "12")
                    Echo_INFOR "Debian12"
                    Echo_INFOR "Backed up apt source"
                    Update_Debian12_Mirror "$1" > /dev/null
                    ;;
                "11")
                    Echo_INFOR "Debian11"
                    Echo_INFOR "Backed up apt source"
                    Update_Debian11_Mirror "$1" > /dev/null
                    ;;
                "10")
                    Echo_INFOR "Debian10"
                    Echo_INFOR "Backed up apt source"
                    Update_Debian10_Mirror "$1" > /dev/null
                    ;;
                "9")
                    Echo_INFOR "Debian9"
                    Echo_INFOR "Backed up apt source"
                    Update_Debian9_Mirror "$1" > /dev/null
                    ;;
                "8")
                    Echo_INFOR "Debian8"
                    Echo_INFOR "Backed up apt source"
                    Update_Debian8_Mirror "$1" > /dev/null
                    ;;
                "7")
                    Echo_INFOR "Debian7"
                    Echo_INFOR "Backed up apt source"
                    Update_Debian7_Mirror > /dev/null
                    ;;
                *)
                    Echo_ERROR "Version error"
                    ;;
            esac
            ;;
    esac

    Echo_INFOR "Updating apt package list"
    Rm_Lock
    apt-get update 1> /dev/null 2>> /tmp/f8x_error.log || Echo_ERROR "Update apt package list failed"

}

# ===================== Modify kali apt source =====================
Update_kali_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.aliyun.com/kali kali-rolling main non-free contrib
# deb-src https://mirrors.aliyun.com/kali kali-rolling main non-free contrib
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
EOF

fi

}

# ===================== Modify Ubuntu apt sources =====================
Update_Ubuntu2410_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ oracular main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ oracular-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ oracular-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ oracular-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ oracular main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ oracular-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ oracular-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ oracular-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2404_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2310_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ mantic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ mantic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ mantic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ mantic-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ mantic-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2304_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ lunar main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ lunar-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ lunar-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ lunar-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2210_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ kinetic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ kinetic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ kinetic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ kinetic-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ kinetic-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2204_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2110_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ impish main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ impish-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ impish-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ impish-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ impish-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2104_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ hirsute main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ hirsute-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ hirsute-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ hirsute-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ hirsute-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2010_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ groovy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ groovy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ groovy-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ groovy-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu2004_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu1910_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ eoan main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ eoan-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ eoan-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ eoan-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu1804_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu1604_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu1504_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ vivid main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ vivid-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ vivid-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ vivid-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu1404_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
EOF

fi

}

Update_Ubuntu1204_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ precise-security main restricted universe multiverse
EOF

fi

}

# ===================== 修改 Debian apt 源 (Modifying Debian apt sources) =====================
Update_Debian12_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/debian/ bookworm main non-free contrib
deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bookworm-backports main non-free contrib
deb http://mirrors.aliyun.com/debian-security bookworm/updates main
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free
EOF

fi

}

Update_Debian11_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
#deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
#deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
EOF

fi

}

Update_Debian10_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian/ buster main non-free contrib
deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian-security buster/updates main
deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian/ buster-updates main non-free contrib
deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian/ buster main non-free contrib
deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian-security buster/updates main
deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian/ buster-updates main non-free contrib
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
EOF

fi

}

Update_Debian9_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.aliyun.com/debian-archive/debian stretch main contrib non-free
#deb https://mirrors.aliyun.com/debian-archive/debian stretch-proposed-updates main non-free contrib
#deb https://mirrors.aliyun.com/debian-archive/debian stretch-backports main non-free contrib
deb https://mirrors.aliyun.com/debian-archive/debian-security stretch/updates main contrib non-free
deb-src https://mirrors.aliyun.com/debian-archive/debian stretch main contrib non-free
#deb-src https://mirrors.aliyun.com/debian-archive/debian stretch-proposed-updates main contrib non-free
#deb-src https://mirrors.aliyun.com/debian-archive/debian stretch-backports main contrib non-free
deb-src https://mirrors.aliyun.com/debian-archive/debian-security stretch/updates main contrib non-free
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates main contrib non-free
EOF

fi

}

Update_Debian8_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib
deb-src https://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib
EOF

else

tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ jessie main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ jessie-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security jessie/updates main contrib non-free
EOF

fi

}

Update_Debian7_Mirror(){
rm -f /etc/apt/sources.list.bak > /dev/null 2>&1 && cp /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1
tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.aliyun.com/debian-archive/debian/ wheezy main non-free contrib
#deb https://mirrors.aliyun.com/debian-archive/debian/ wheezy-proposed-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian-archive/debian/ wheezy main non-free contrib
#deb-src https://mirrors.aliyun.com/debian-archive/debian/ wheezy-proposed-updates main non-free contrib
EOF

}

# ===================== Modifying YUM sources =====================
Update_YUM_Mirror(){

    Echo_ALERT "Updating $Linux_Version yum sources"

    case $Linux_Version in
        *"CentOS"*)
            Update_CentOS_Mirror "$1"
            Update_EPEL_Mirror "$1"
            ;;
        *"RedHat"*)
            Echo_INFOR "RedHat Pass~"
            ;;
        *"AlmaLinux"*)
            Echo_INFOR "AlmaLinux Pass~"
            ;;
        *"VzLinux"*)
            Echo_INFOR "VzLinux Pass~"
            ;;
        *"Rocky"*)
            Echo_INFOR "Rocky Pass~"
            ;;
        *"Fedora"*)
            Echo_INFOR "Fedora"
            rm -f /etc/yum.repos.d/fedora.repo.repo.bak > /dev/null 2>&1 && cp /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora.repo.bak > /dev/null 2>&1 && Echo_INFOR "Backed up Yum sources"

            if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/fedora.repo http://mirrors.aliyun.com/repo/fedora.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun Yum sources" || Echo_ERROR "aliyun Yum sources download failed"
                curl -o /etc/yum.repos.d/fedora-updates.repo http://mirrors.aliyun.com/repo/fedora-updates.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun Yum update sources" || Echo_ERROR "aliyun Yum update sources download failed"
            elif [ $1 == huawei ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/fedora.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/fedora.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded huaweicloud Yum sources" || Echo_ERROR "huaweicloud Yum sources download failed"
                curl -o /etc/yum.repos.d/fedora-updates.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/fedora-updates.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded huaweicloud Yum update sources" || Echo_ERROR "huaweicloud Yum update sources download failed"
            elif [ $1 == tuna ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/fedora.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/fedora.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna Yum sources" || Echo_ERROR "tuna Yum sources download failed"
                curl -o /etc/yum.repos.d/fedora-updates.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/fedora-updates.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna Yum update sources" || Echo_ERROR "tuna Yum update sources download failed"
            fi
            ;;
    esac

    Echo_ALERT "Updating yum cache"
    yum clean all > /dev/null 2>&1
    Rm_Lock

    case $Linux_Version in
        *"Fedora"*)
            Echo_ALERT "Fedora ＞﹏＜"
            ;;
        *)
            yum makecache 1> /dev/null 2>> /tmp/f8x_error.log /dev/null || Echo_ERROR "Yum makecache failed"
            ;;
    esac

}

# ===================== Modify CentOS EPEL sources =====================
Update_EPEL_Mirror(){

    if test -e /etc/yum.repos.d/epel.repo
    then
        Echo_INFOR "EPEL source is installed"
    else
        Echo_ALERT "epel source not detected, being installed automatically"
        Rm_Lock
        case $Linux_Version_Num in
            "9 Stream")
                Install_Switch "epel-release"
                ;;
            "8 Stream")
                Install_Switch "epel-release"
                ;;
            8)
                if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
                then
                    yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun EPEL sources" || Echo_ERROR "aliyun EPEL sources download failed"
                    sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
                    sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
                elif [ $1 == huawei ] 2>> /tmp/f8x_error.log
                then
                    yum install -y https://mirrors.huaweicloud.com/epel/epel-release-latest-8.noarch.rpm > /dev/null 2>&1 && Echo_INFOR "Downloaded huaweicloud EPEL sources" || Echo_ERROR "huaweicloud EPEL sources download failed"
                elif [ $1 == tuna ] 2>> /tmp/f8x_error.log
                then
                    curl -o /etc/yum.repos.d/epel.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/tuna/epel-8.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna EPEL sources" || Echo_ERROR "tuna EPEL sources download failed"
                fi
                ;;
            7)
                if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
                then
                    curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun EPEL sources" || Echo_ERROR "aliyun EPEL sources download failed"
                elif [ $1 == huawei ] 2>> /tmp/f8x_error.log
                then
                    curl -o /etc/yum.repos.d/epel.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/tuna/epel-7.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded huaweicloud EPEL sources" || Echo_ERROR "huaweicloud EPEL sources download failed"
                elif [ $1 == tuna ] 2>> /tmp/f8x_error.log
                then
                    curl -o /etc/yum.repos.d/epel.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/tuna/epel-7.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna EPEL sources" || Echo_ERROR "tuna EPEL sources download failed"
                fi
                ;;
            6)
                if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
                then
                    curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun EPEL sources" || Echo_ERROR "aliyun EPEL sources download failed"
                else
                    curl -o /etc/yum.repos.d/epel.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/tuna/epel-6.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna EPEL sources" || Echo_ERROR "tuna EPEL sources download failed"
                fi
                ;;
            *)
                Echo_ERROR "Version error"
                ;;
        esac
    fi

}

# ===================== Modify CentOS YUM sources =====================
Update_CentOS_Mirror(){
# CentOS 8和CentOS 6 及以下版本已被华为云官网下线

    case $Linux_Version_Num in
        "9 Stream")
            Echo_INFOR "pass"
            ;;
        "8 Stream")
            Echo_INFOR "pass"
            ;;
        8)
            rm -f /etc/yum.repos.d/CentOS-Base.repo.bak > /dev/null 2>&1 && cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak > /dev/null 2>&1 && Echo_INFOR "Backed up Yum sources"
            if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun Yum sources" || Echo_ERROR "aliyun Yum sources download failed"
            else
                curl -o /etc/yum.repos.d/CentOS-Base.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/tuna/Centos-8.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna Yum sources" || Echo_ERROR "tuna Yum sources download failed"
            fi
            ;;
        7)
            rm -f /etc/yum.repos.d/CentOS-Base.repo.bak > /dev/null 2>&1 && cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak > /dev/null 2>&1 && Echo_INFOR "Backed up Yum sources"

            if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun Yum sources" || Echo_ERROR "aliyun Yum sources download failed"
            elif [ $1 == huawei ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/CentOS-Base.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/Centos-7.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded huaweicloud Yum sources" || Echo_ERROR "huaweicloud Yum sources download failed"
            elif [ $1 == tuna ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/CentOS-Base.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/tuna/Centos-7.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna Yum sources" || Echo_ERROR "tuna Yum sources download failed"
            fi
            ;;
        6)
            rm -f /etc/yum.repos.d/CentOS-Base.repo.bak > /dev/null 2>&1 && cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak > /dev/null 2>&1 && Echo_INFOR "Backed up Yum sources"

            if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
            then
                curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded aliyun Yum sources" || Echo_ERROR "aliyun Yum sources download failed"
            else
                curl -o /etc/yum.repos.d/CentOS-Base.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/tuna/Centos-6.repo > /dev/null 2>&1 && Echo_INFOR "Downloaded tuna Yum sources" || Echo_ERROR "tuna Yum sources download failed"
            fi
            ;;
        *)
            Echo_ERROR "Version error"
            ;;
    esac

}

# ===================== Modify system package manager source =====================
Mirror(){

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            echo -e "\033[1;33m\n>> Update yum source? [Y/n,Default Y]\033[0m" && read -r input
            case $input in
                [nN][oO]|[nN])
                    Echo_INFOR "Pass~"
                    ;;
                *)
                    Update_YUM_Mirror "$1"
                    Echo_INFOR "yum source updated"
                    ;;
            esac
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            echo -e "\033[1;33m\n>> Update apt source? [Y/n,Default Y]\033[0m" && read -r input
            case $input in
                [nN][oO]|[nN])
                    Echo_INFOR "Pass~"
                    ;;
                *)
                    Update_APT_Mirror "$1"
                    Echo_INFOR "apt source updated"
                    ;;

            esac
            ;;
        *)
            Echo_ERROR "Unknown version, update package source failed"
            ;;
    esac

    echo -e "\033[1;33m\n>> Configuring the pip proxy\n\033[0m"
    pip_Proxy "$1" > /dev/null

    Echo_INFOR "Updated pip Proxy"

    echo -e "\033[1;33m\n>> Configuring the docker proxy\n\033[0m"
    Docker_Proxy > /dev/null
    systemctl restart docker > /dev/null 2>&1
    systemctl daemon-reload > /dev/null 2>&1

    Echo_INFOR "Updated docker Proxy"

}

# ===================== Check DNS IP format =====================
Change_DNS_IP(){

    read -r input

    case $input in
        [nN][oO]|[nN])
            Echo_INFOR "Pass~"
            ;;
        *)
            echo -e "\033[5;33mPlease enter the DNS server address [Default is $Default_DNS]\033[0m" && read -r input

            VALID_CHECK=$(echo "$input"|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}')
            if echo "$input"|grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$">/dev/null; then
                if [ "${VALID_CHECK:-no}" == "yes" ]; then
                    Default_DNS=$input
                    Change_DNS
                else
                    Echo_ERROR "$input invalid"
                    Change_DNS
                fi
            else
                Echo_ERROR "$input invalid"
                Change_DNS
            fi
            ;;
    esac

}

# ===================== Update DNS =====================
Change_DNS(){

    echo "nameserver $Default_DNS" > /etc/resolv.conf
    Echo_INFOR "The default DNS is configured as: $Default_DNS"

}

# ===================== Install DNS tools =====================
DNS_T00ls(){

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Echo_INFOR "RedHat system does not have resolvconf, this item Pass"
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Rm_Lock
            Install_Switch "resolvconf"
            echo "nameserver $Default_DNS" > /etc/resolvconf/resolv.conf.d/head
            resolvconf -u ;;
        *) ;;
    esac

}

# ===================== Install Proxychains-ng =====================
Proxychains_Install(){

    Rm_Lock
    Install_Switch "gcc"
    Install_Switch "git"
    Install_Switch "vim"
    Install_Switch "make"
    Install_Switch "wget"
    Install_Switch "zip"
    Install_Switch "unzip"
    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Install_Switch "gcc-c++"
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Install_Switch "g++"
            Install_Switch "ca-certificates"
            ;;
        *) ;;
    esac

    case $Linux_Version in
        *"Kali"*)
            rm -f /etc/proxychains.conf > /dev/null 2>&1
            ;;
        *) ;;
    esac

    if test -e /etc/proxychains.conf
    then
        Echo_ALERT "Proxychains-ng installed"
    else
        echo -e "\033[1;33m\n>> Do you need to install proxychains-ng from ffffffff0x.com [Y/n,Default Y]\033[0m" && read -r input

        case $input in
            [nN][oO]|[nN])
                cd $T_Dir && rm -rf proxychains-ng* > /dev/null 2>&1 && git clone --depth 1 ${GitProxy}https://github.com/rofl0r/proxychains-ng.git $T_Dir/proxychains-ng > /dev/null 2>&1 && Echo_INFOR "Downloaded from github.com" || Echo_ERROR "Download failed"
                ;;
            *)
                cd $T_Dir && rm -rf proxychains-ng* > /dev/null 2>&1 && wget -O proxychains-ng.zip "$Proxy_URL" ${wget_option} && Echo_INFOR "Downloaded from ffffffff0x.com" || Echo_ERROR "Download failed"
                unzip proxychains-ng.zip > /dev/null 2>&1 && rm -f proxychains-ng.zip > /dev/null 2>&1
                mv --force proxychains-ng-master proxychains-ng
                ;;
        esac

        chmod -R 777 $T_Dir/proxychains-ng > /dev/null 2>&1
        cd $T_Dir/proxychains-ng && chmod +x configure > /dev/null 2>&1
        ./configure > /dev/null 2>&1
        chmod +x ./tools/install.sh > /dev/null 2>&1
        make > /dev/null 2>&1 && make install > /dev/null 2>&1
        cp $T_Dir/proxychains-ng/src/proxychains.conf /etc/proxychains.conf
        cd .. && rm -rf proxychains-ng > /dev/null 2>&1
        vim /etc/proxychains.conf
        Echo_INFOR "Successfully installed Proxychains-ng, the configuration file is /etc/proxychains.conf"
    fi

}

# ===================== pip proxy =====================
pip_Proxy(){

mkdir -p ~/.pip/

if [ $1 == aliyun ] 2>> /tmp/f8x_error.log
then

tee ~/.pip/pip.conf <<-'EOF'
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com
EOF

else

tee ~/.pip/pip.conf <<-'EOF'
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple/

[install]
trusted-host=https://pypi.tuna.tsinghua.edu.cn
EOF

fi

}

# ===================== docker proxy =====================
Docker_Proxy(){

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
EOF

}

# ===================== Install basic tools =====================
Base_Tools(){

    case $Linux_Version in
        *"CentOS"*)
            Update_EPEL_Mirror
            ;;
        *"AlmaLinux"*)
            Rm_Lock
            Install_Switch "epel-release"
            ;;
        *"VzLinux"*)
            Rm_Lock
            Install_Switch "epel-release"
            ;;
        *"Rocky"*)
            Rm_Lock
            Install_Switch "epel-release"
            ;;
        *) ;;
    esac

    Rm_Lock

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Install_Switch "yum-utils"
            Install_Switch "dnf"
            Install_Switch "gcc-c++"
            Install_Switch "glibc-headers"
            Install_Switch "openssl-devel"
            Install_Switch "kernel-devel"
            yum upgrade -y wget > /dev/null 2>&1
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            apt-get update > /dev/null 2>&1
            Install_Switch "zip"
            Install_Switch "apt-transport-https"
            Install_Switch "ca-certificates"
            Install_Switch "p7zip-full"
            Install_Switch "libssl-dev"
            Install_Switch "libssh2-1-dev"
            Install_Switch "aptitude"
            Install_Switch "libcurl4-openssl-dev"
            Install_Switch "apt-file"
            Install_Switch "g++"
            ;;
        *) ;;
    esac

    Install_Switch "vim"
    Install_Switch "make"
    Install_Switch "cmake"
    Install_Switch "gcc"
    Install_Switch "git"
    Install_Switch "curl"
    Install_Switch "wget"
    Install_Switch "lrzsz"
    Install_Switch "unzip"
    Install_Switch "p7zip"
    Install_Switch "jq"
    Install_Switch "openssl"
    Install_Switch "net-tools"
    Install_Switch "dos2unix"
    Install_Switch "tmux"

}

# ===================== Install development environment dependencies =====================
Dev_Base_Install(){

    if test -e /tmp/f8x_Dev_Base.txt
    then
        Echo_ALERT "Dependent installation records are detected, skip this step"
    else
        echo -e "\033[1;33m\n>> Installing development environment dependencies\n\033[0m"

        Rm_Lock
        Install_Switch "tree"
        Install_Switch "tcpdump"
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                yum groupinstall -y "Development Tools" > /dev/null 2>&1 && Echo_INFOR "Successfully installed Development Tools" || Echo_ERROR "Failed to install Development Tools"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "software-properties-common"
                Install_Switch "build-essential"
                Install_Switch "xfonts-intl-chinese"
                Install_Switch "ttf-wqy-microhei"
                Install_Switch "ttf-wqy-zenhei"
                Install_Switch "xfonts-wqy"
                Install_Switch "nethogs"
                ;;
            *)
                ;;
        esac

        touch /tmp/f8x_Dev_Base.txt > /dev/null 2>&1
    fi

}

# ===================== Install Python and pip =====================
Python3_Install(){

    name="Python3"

    case "$1" in
        py37)
            pyenv_Install
            Python37_Install_with_pyenv
            # Python37_Install
            ;;
        py38)
            pyenv_Install
            Python38_Install_with_pyenv
            # Python38_Install
            ;;
        py39)
            pyenv_Install
            Python39_Install_with_pyenv
            # Python39_Install
            ;;
        py310)
            pyenv_Install
            Python310_Install_with_pyenv
            # Python310_Install
            ;;
        *)
            Python3_def_Install
            ;;
    esac

}

pyenv_Install(){

    name="pyenv"
    dir="$T_Dir/.pyenv"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    which pyenv > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "$name installed"
    else
        if test -d $dir
        then
            Echo_ALERT "$name is already installed in $dir"
        else
            Base_Tools

            Dev_Base_Install

            case $Linux_Version in
                *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                    Install_Switch "bzip2"
                    Install_Switch "bzip2-devel"
                    Install_Switch "readline-devel"
                    Install_Switch "sqlite"
                    Install_Switch "sqlite-devel"
                    Install_Switch "openssl-devel"
                    Install_Switch "tk-devel"
                    Install_Switch "libffi-devel"
                    Install_Switch "xz-devel"
                    Install_Switch "zlib-devel"
                    ;;
                *"Kali"*|*"Ubuntu"*|*"Debian"*)
                    Install_Switch "zlib1g-dev"
                    Install_Switch "libbz2-dev"
                    Install_Switch "libedit-dev"
                    Install_Switch "libncurses5-dev"
                    Install_Switch "libreadline-dev"
                    Install_Switch "libsqlite3-dev"
                    Install_Switch "llvm"
                    Install_Switch "libncursesw5-dev"
                    Install_Switch "xz-utils"
                    Install_Switch "tk-dev"
                    Install_Switch "libffi-dev"
                    Install_Switch "liblzma-dev"
                    ;;
                *) ;;
            esac

            $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/pyenv/pyenv.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed pyenv, environment variables may need to be re-entered in bash to take effect\nexport PYENV_ROOT=\"$T_Dir/.pyenv\"\ncommand -v pyenv >/dev/null || export PATH=\"\$PYENV_ROOT/bin:\$PATH\"\neval \"\$(pyenv init -)\"" || Echo_ERROR2

            case $Linux_Version in
                *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                    echo "export PYENV_ROOT=\"$T_Dir/.pyenv\"" >> /etc/bashrc
                    echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> /etc/bashrc
                    echo 'eval "$(pyenv init -)"' >> /etc/bashrc
                    ;;
                *"Kali"*|*"Ubuntu"*|*"Debian"*)
                    echo "export PYENV_ROOT=\"$T_Dir/.pyenv\"" >> /etc/bash.bashrc
                    echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> /etc/bash.bashrc
                    echo 'eval "$(pyenv init -)"' >> /etc/bash.bashrc
                    ;;
                *) ;;
            esac

            Install_Switch "pipx"
            pipx ensurepath
        fi
    fi

}

Python3_def_Install(){

    Rm_Lock
    Install_Switch "python3"
    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Install_Switch "python3-devel"
            Install_Switch "python3-pip"
            Install_Switch "pipx"
            pipx ensurepath
            python3 -m pip install --upgrade pip > /dev/null 2>&1 && Echo_INFOR "Updated python3-pip" || Echo_ERROR "Update python3-pip failed"

            Install_Switch4 "setuptools"
            Install_Switch4 "virtualenv"
            ;;
        *"Kali"*|*"Debian"*)
            apt-get update > /dev/null 2>&1
            Install_Switch "python3-dev"
            Install_Switch "python3-pip"
            Install_Switch "python3-venv"
            Install_Switch "python3-distutils" > /dev/null 2>&1
            Install_Switch "pipx"
            pipx ensurepath
            python3 -m pip install --upgrade pip > /dev/null 2>&1 && Echo_INFOR "Updated python3-pip" || Echo_ERROR "Update python3-pip failed"
            ;;
        *"Ubuntu"*)
            apt-get update > /dev/null 2>&1
            Install_Switch "python3-dev"
            Install_Switch "python3-pip"
            Install_Switch "python3-venv"
            Install_Switch "python3-distutils"
            Install_Switch "pipx"
            pipx ensurepath
            case $Linux_Version_Num in
                "16.04")
                    mkdir -p /tmp/get-pip && cd /tmp/get-pip && rm -rf get-pip.py && $Proxy_OK wget https://bootstrap.pypa.io/pip/3.5/get-pip.py > /dev/null 2>&1
                    $Proxy_OK python3 get-pip.py > /dev/null 2>&1
                    rm -rf /tmp/get-pip && cd /tmp
                    ;;
            esac
            python3 -m pip install --upgrade pip > /dev/null 2>&1 && Echo_INFOR "Updated python3-pip" || Echo_ERROR "Update python3-pip failed"
            ;;
        *)
            ;;
    esac

}

Python37_Install_with_pyenv(){

    name="Python3.7"

    export PYENV_ROOT="$T_Dir/.pyenv"
    command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" > /dev/null 2>&1
    eval "$(pyenv init -)" > /dev/null 2>&1

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if [ "$(pyenv versions | grep $py37_ver)" ]
    then
        Echo_INFOR "$name installed, Please run the following command:\npyenv global $py37_ver && pyenv local $py37_ver"
        pyenv global $py37_ver && pyenv local $py37_ver
    else
        mkdir -p ~/.pyenv/cache/ && cd $_ && rm -f $py37_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py37_ver/$py37_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
        pyenv install $py37_ver && pyenv global $py37_ver && pyenv local $py37_ver && Echo_INFOR "Successfully installed Python, Please run the following command:\npyenv global $py37_ver && pyenv local $py37_ver"
        rm -rf $py37_bin && cd /tmp
    fi

}

Python37_Install(){

    name="Python3.7"
    mkdir -p /tmp/py37 && cd $_ && rm -f $py37_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py37_ver/$py37_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
    tar -xvJf $py37_bin > /dev/null 2>&1 && cd $py37_dir
    Echo_INFOR "configure"
    ./configure --prefix=/usr/local/python3 > /dev/null 2>&1
    Echo_INFOR "make"
    make > /dev/null 2>&1
    Echo_INFOR "make install"
    make install > /dev/null 2>&1

    rm -f /usr/bin/python3
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    python3 -V > /dev/null 2>&1 && Echo_INFOR "Installation Location : /usr/local/python3" || Echo_ERROR3
    Echo_INFOR "py3 output: $(python3 -V)"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bashrc
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bash.bashrc
            ;;
        *) ;;
    esac

    rm -f /usr/bin/lsb_release > /dev/null 2>&1
    python3 -m ensurepip > /dev/null 2>&1
    python3 -m pip install --upgrade pip > /dev/null 2>&1

    Echo_INFOR "pip3 output: $(pip3 -V)"
    rm -rf /tmp/py37 && cd /tmp

}

Python38_Install_with_pyenv(){

    name="Python3.8"

    export PYENV_ROOT="$T_Dir/.pyenv"
    command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" > /dev/null 2>&1
    eval "$(pyenv init -)" > /dev/null 2>&1

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if [ "$(pyenv versions | grep $py38_ver)" ]
    then
        Echo_INFOR "$name installed, Please run the following command:\npyenv global $py38_ver && pyenv local $py38_ver"
        pyenv global $py38_ver && pyenv local $py38_ver
    else
        mkdir -p ~/.pyenv/cache/ && cd $_ && rm -f $py38_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py38_ver/$py38_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
        pyenv install $py38_ver && pyenv global $py38_ver && pyenv local $py38_ver && Echo_INFOR "Successfully installed Python, Please run the following command:\npyenv global $py38_ver && pyenv local $py38_ver"
        rm -rf $py38_bin && cd /tmp
    fi

}

Python38_Install(){

    name="Python3.8"
    mkdir -p /tmp/py38 && cd $_ && rm -f $py38_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py38_ver/$py38_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
    tar -xvJf $py38_bin > /dev/null 2>&1 && cd $py38_dir
    Echo_INFOR "configure"
    ./configure --prefix=/usr/local/python3 > /dev/null 2>&1
    Echo_INFOR "make"
    make > /dev/null 2>&1
    Echo_INFOR "make install"
    make install > /dev/null 2>&1

    rm -f /usr/bin/python3
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    python3 -V > /dev/null 2>&1 && Echo_INFOR "Installation Location : /usr/local/python3" || Echo_ERROR3
    Echo_INFOR "py3 output: $(python3 -V)"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bashrc
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bash.bashrc
            ;;
        *) ;;
    esac

    rm -f /usr/bin/lsb_release > /dev/null 2>&1
    python3 -m ensurepip > /dev/null 2>&1
    python3 -m pip install --upgrade pip > /dev/null 2>&1

    Echo_INFOR "pip3 output: $(pip3 -V)"
    rm -rf /tmp/py38 && cd /tmp

}

Python39_Install_with_pyenv(){

    name="Python3.9"

    export PYENV_ROOT="$T_Dir/.pyenv"
    command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" > /dev/null 2>&1
    eval "$(pyenv init -)" > /dev/null 2>&1

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if [ "$(pyenv versions | grep $py39_ver)" ]
    then
        Echo_INFOR "$name installed, Please run the following command:\npyenv global $py39_ver && pyenv local $py39_ver"
        pyenv global $py39_ver && pyenv local $py39_ver
    else
        mkdir -p ~/.pyenv/cache/ && cd $_ && rm -f $py39_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py39_ver/$py39_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
        pyenv install $py39_ver && pyenv global $py39_ver && pyenv local $py39_ver && Echo_INFOR "Successfully installed Python, Please run the following command:\npyenv global $py39_ver && pyenv local $py39_ver"
        rm -rf $py39_bin && cd /tmp
    fi

}

Python39_Install(){

    name="Python3.9"
    mkdir -p /tmp/py39 && cd $_ && rm -f $py39_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py39_ver/$py39_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
    tar -xvJf $py39_bin > /dev/null 2>&1 && cd $py39_dir
    Echo_INFOR "configure"
    ./configure --prefix=/usr/local/python3 > /dev/null 2>&1
    Echo_INFOR "make"
    make > /dev/null 2>&1
    Echo_INFOR "make install"
    make install > /dev/null 2>&1

    rm -f /usr/bin/python3
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    python3 -V > /dev/null 2>&1 && Echo_INFOR "Installation Location : /usr/local/python3" || Echo_ERROR3
    Echo_INFOR "py3 output: $(python3 -V)"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bashrc
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bash.bashrc
            ;;
        *) ;;
    esac

    rm -f /usr/bin/lsb_release > /dev/null 2>&1
    python3 -m ensurepip > /dev/null 2>&1
    python3 -m pip install --upgrade pip > /dev/null 2>&1

    Echo_INFOR "pip3 output: $(pip3 -V)"
    rm -rf /tmp/py39 && cd /tmp

}

Python310_Install_with_pyenv(){

    name="Python3.10"

    export PYENV_ROOT="$T_Dir/.pyenv"
    command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" > /dev/null 2>&1
    eval "$(pyenv init -)" > /dev/null 2>&1

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if [ "$(pyenv versions | grep $py310_ver)" ]
    then
        Echo_INFOR "$name installed, Please run the following command:\npyenv global $py310_ver && pyenv local $py310_ver"
        pyenv global $py310_ver && pyenv local $py310_ver
    else
        mkdir -p ~/.pyenv/cache/ && cd $_ && rm -f $py310_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py310_ver/$py310_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
        pyenv install $py310_ver && pyenv global $py310_ver && pyenv local $py310_ver && Echo_INFOR "Successfully installed Python, Please run the following command:\npyenv global $py310_ver && pyenv local $py310_ver"
        rm -rf $py310_bin && cd /tmp
    fi

}

Python310_Install(){

    name="Python3.10"
    mkdir -p /tmp/py310 && cd $_ && rm -f $py310_bin && $Proxy_OK wget https://www.python.org/ftp/python/$py310_dir/$py310_bin ${wget_option} && Echo_INFOR "Downloaded from python.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
    tar -xvJf $py310_bin > /dev/null 2>&1 && cd $py310_dir
    Echo_INFOR "configure"
    ./configure --prefix=/usr/local/python3 > /dev/null 2>&1
    Echo_INFOR "make"
    make > /dev/null 2>&1
    Echo_INFOR "make install"
    make install > /dev/null 2>&1

    rm -f /usr/bin/python3
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    python3 -V > /dev/null 2>&1 && Echo_INFOR "Installation Location : /usr/local/python3" || Echo_ERROR3
    Echo_INFOR "py3 output: $(python3 -V)"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bashrc
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            echo "PATH=\$PATH:/usr/local/python3/bin" >> /etc/bash.bashrc
            ;;
        *) ;;
    esac

    rm -f /usr/bin/lsb_release > /dev/null 2>&1
    python3 -m ensurepip > /dev/null 2>&1
    python3 -m pip install --upgrade pip > /dev/null 2>&1

    Echo_INFOR "pip3 output: $(pip3 -V)"
    rm -rf /tmp/py310 && cd /tmp

}

# -go
Go_Option(){

    name="go"
    which go > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Go_Version=$(curl -L -s https://golang.org/VERSION?m=text | grep -o 'go[0-9]\+\.[0-9]\+\.[0-9]\+' | awk '{print $1}')
        if test -e /tmp/IS_CI
        then
            input="y"
        else
            Echo_ALERT "已安装 $(go version),是否升级至 $Go_Version? [y/N,默认No]" && read -r input
        fi

        case $input in
            [yY][eE][sS]|[Yy])
                case $Linux_architecture_Name in
                    *"linux-x86_64"*)
                        Go_Bin="${Go_Version}.linux-amd64.tar.gz"
                        ;;
                    *"linux-arm64"*)
                        Go_Bin="${Go_Version}.linux-arm64.tar.gz"
                        ;;
                esac

                rm -rf /usr/bin/go > /dev/null 2>&1
                rm -rf /usr/local/go > /dev/null 2>&1
                cd /tmp
                Echo_ALERT "Downloading Go (~120M)" && $Proxy_OK wget -O $T_Dir/$Go_Bin ${GitProxy2}https://golang.org/dl/$Go_Bin ${wget_option} && tar -C /usr/local -xzf $T_Dir/$Go_Bin && Echo_INFOR "Downloaded from golang.org" || { Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct" ; rm -f ${T_Dir:?}/${Go_Bin} > /dev/null 2>&1; }
                ln -s /usr/local/go/bin/go /usr/bin/go > /dev/null 2>&1
                Echo_INFOR "$(go version)" || Echo_ERROR3
                rm -f ${T_Dir:?}/${Go_Bin} > /dev/null 2>&1
                ;;
            *)
                Echo_INFOR "Pass~"
                ;;
        esac
    else
        Go_Install
    fi

}

# ===================== Install Go =====================
Go_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            Go_Bin=$Go_Bin_amd64
            ;;
        *"linux-arm64"*)
            Go_Bin=$Go_Bin_arm64
            ;;
    esac

    name="go"
    which go > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Echo_ALERT "Downloading Go (~120M)" && $Proxy_OK wget -O $T_Dir/$Go_Bin ${GitProxy2}https://go.dev/dl/$Go_Bin ${wget_option} && tar -C /usr/local -xzf $T_Dir/$Go_Bin && Echo_INFOR "Downloaded from golang.org" || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"

        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                #export PATH=\$PATH:/usr/local/go/bin
                #export GOROOT=/usr/local/go
                export GOPATH=$HOME/go

                echo "GOROOT=/usr/local/go" >> /etc/bashrc && Echo_INFOR "GOROOT : /usr/local/go"
                echo "GOBIN=\$GOROOT/bin" >> /etc/bashrc && Echo_INFOR "GOBIN : \$GOROOT/bin"
                echo "GOPATH=\$HOME/go" >> /etc/bashrc && Echo_INFOR "GOPATH : \$HOME/go"
                echo "PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin:\$GOBIN" >> /etc/bashrc
                source /etc/bashrc
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                #export PATH=\$PATH:/usr/local/go/bin
                #export GOROOT=/usr/local/go
                export GOPATH=$HOME/go

                echo "GOROOT=/usr/local/go" >> /etc/bash.bashrc && Echo_INFOR "GOROOT : /usr/local/go"
                echo "GOBIN=\$GOROOT/bin" >> /etc/bash.bashrc && Echo_INFOR "GOBIN : \$GOROOT/bin"
                echo "GOPATH=\$HOME/go" >> /etc/bash.bashrc && Echo_INFOR "GOPATH : \$HOME/go"
                echo "PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin:\$GOBIN" >> /etc/bash.bashrc
                source /etc/bash.bashrc
                ;;
            *) ;;
        esac
        cd /tmp
        ln -s /usr/local/go/bin/go /usr/bin/go > /dev/null 2>&1
        Echo_INFOR "$(go version)" || Echo_ERROR3
        rm -f ${T_Dir:?}/${Go_Bin} > /dev/null 2>&1
    fi

}

# ===================== Install Docker =====================
Docker_Install(){

    name="Docker"
    which docker > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
        service docker start > /dev/null 2>&1
        systemctl start docker > /dev/null 2>&1
    else
        Rm_Lock
        case $Linux_Version in
            *"Fedora"*)
                Install_Switch "device-mapper-persistent-data"
                Install_Switch "lvm2"

                Echo_ALERT "Installing docker" && $Proxy_OK yum install -y docker > /dev/null 2>&1 && Echo_INFOR "Successfully installed docker" || Echo_ERROR "docker installation failed, please check if the network is reachable, proxychains4 configuration is correct"
                ;;
            *"CentOS"*|*"RedHat"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "device-mapper-persistent-data"
                Install_Switch "lvm2"

                if [ $1 == tuna ] 2>> /tmp/f8x_error.log
                then
                    $Proxy_OK curl -o /etc/yum.repos.d/docker-ce.repo https://raw.githubusercontent.com/No-Github/Archive/master/cdn/docker-ce.repo > /dev/null 2>&1 && Echo_INFOR "Finished downloading the docker yum source from mirrors.tuna.tsinghua.edu.cn" || Echo_ERROR "Failed to download docker yum source"
                else
                    # https://docs.docker.com/engine/install/centos/#set-up-the-repository
                    $Proxy_OK yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
                fi

                $Proxy_OK yum makecache > /dev/null 2>&1 || Echo_ERROR "yum Docker source update failed, please check if the network is reachable, proxychains4 configuration is correct"
                Rm_Lock
                # https://docs.docker.com/engine/install/centos/#install-docker-engine
                Echo_ALERT "Installing docker" && $Proxy_OK yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin > /dev/null 2>&1 && Echo_INFOR "Successfully installed docker" || Echo_ERROR "docker installation failed, please check if the network is reachable, proxychains4 configuration is correct"

                which docker > /dev/null 2>&1
                if [ $? == 0 ]
                then
                    service docker start > /dev/null 2>&1
                    systemctl start docker > /dev/null 2>&1
                else
                    Echo_ALERT "Installing docker(podman emulate)" && $Proxy_OK yum install -y docker docker-buildx-plugin docker-compose-plugin > /dev/null 2>&1 && Echo_INFOR "Successfully installed docker" || Echo_ERROR "docker installation failed, please check if the network is reachable, proxychains4 configuration is correct"
                fi
                ;;
            *"Ubuntu"*|*"Debian"*)
                Echo_INFOR "Uninstalling the Docker environment"

                # https://docs.docker.com/engine/install/debian/#uninstall-old-versions
                apt remove -y $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)
                #apt-get remove -y docker > /dev/null 2>&1
                #apt-get remove -y docker-engine > /dev/null 2>&1
                #apt-get remove -y docker.io > /dev/null 2>&1
                Rm_Lock

                apt-get update > /dev/null 2>&1 || Echo_ERROR "Update apt package list failed"
                Install_Switch "apt-transport-https"
                Install_Switch "ca-certificates"
                Install_Switch "curl"
                Install_Switch "software-properties-common"
                Install_Switch "gnupg"

                if [ $1 == tuna ] 2>> /tmp/f8x_error.log
                then
                    $Proxy_OK curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg | apt-key add -

                    case $Linux_Version in
                        *"Kali"*|*"Debian"*)
                            echo -e 'deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian' "$Linux_Version_Name" 'stable'> /etc/apt/sources.list.d/docker.list
                            ;;
                        *"Ubuntu"*)
                            echo -e 'deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/' "$Linux_Version_Name" 'stable'> /etc/apt/sources.list.d/docker.list
                            ;;
                    esac
                else
                    $Proxy_OK curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

                    case $Linux_Version in
                        *"Kali"*|*"Debian"*)
                            # Add Docker's official GPG key:
                            sudo install -m 0755 -d /etc/apt/keyrings
                            $Proxy_OK curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
                            chmod a+r /etc/apt/keyrings/docker.asc

                            # Add the repository to Apt sources:
                            tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF

                            # echo -e 'deb https://download.docker.com/linux/debian' "$Linux_Version_Name" 'stable'> /etc/apt/sources.list.d/docker.list
                            ;;
                        *"Ubuntu"*)
                            # Add Docker's official GPG key:
                            apt update
                            apt install -y ca-certificates curl
                            install -m 0755 -d /etc/apt/keyrings
                            $Proxy_OK curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
                            chmod a+r /etc/apt/keyrings/docker.asc

                            # Add the repository to Apt sources:
                            tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
                            # echo -e 'deb https://download.docker.com/linux/ubuntu/' "$Linux_Version_Name" 'stable'> /etc/apt/sources.list.d/docker.list
                            ;;
                    esac
                fi

                apt update
                apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

                # Echo_INFOR "Updating apt package list" && apt-get update > /dev/null 2>&1 || Echo_ERROR "Update apt package list failed"
                # Echo_ALERT "Installing docker" && $Proxy_OK apt-get install -y docker-ce > /dev/null 2>&1 && Echo_INFOR "Successfully installed docker-ce" || Echo_ERROR "docker-ce installation failed, please check if the network is reachable, proxychains4 configuration is correct"
                rm -f /etc/apt/sources.list.d/docker.list > /dev/null 2>&1
                rm -f /etc/apt/sources.list.d/docker.sources > /dev/null 2>&1
                ;;
            *"Kali"*)
                Echo_INFOR "Uninstalling the Docker environment"
                Rm_Lock
                apt-get update > /dev/null 2>&1 || Echo_ERROR "Update apt package list failed"

                Echo_ALERT "Installing docker" && apt-get install -y docker.io
                apt-get install -y docker-compose
                ;;
            *)
            ;;
        esac

        service docker start > /dev/null 2>&1
        systemctl start docker > /dev/null 2>&1 && Echo_INFOR "docker service is started" || Echo_ERROR "docker service startup failed"
        systemctl enable docker > /dev/null 2>&1 && Echo_INFOR "Configure the docker service to start on boot" || Echo_ERROR "Failed to configure boot items"
    fi

    # new
    docker_compose_Install

}

# ===================== Install docker_compose =====================
docker_compose_Install(){

    name="docker compose"
    docker compose version > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed (docker compose version)"
    else
        Rm_Lock
        # ref https://docs.docker.com/compose/install/linux/
        Install_Switch "docker-compose-plugin"
    fi

    # old
    docker compose version > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "docker-compose installed (docker compose version)"
    else
        pip3_Check && pip3 install --upgrade pip > /dev/null 2>&1
        Install_Switch5 "docker-compose"
    fi

}

# ===================== Install SDKMAN =====================
SDKMAN_Install(){

    name="SDKMAN"
    sdk version > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/SDKMAN && cd /tmp/SDKMAN && $Proxy_OK curl -o sdkman.sh "https://get.sdkman.io" > /dev/null 2>&1 && $Proxy_OK bash sdkman.sh > /dev/null 2>&1
        source "/root/.sdkman/bin/sdkman-init.sh"
        sdk version && Echo_INFOR "Successfully installed $name" || Echo_ERROR3

        rm -rf /tmp/SDKMAN && cd /tmp
    fi

}

# ===================== Install Terraform =====================
Terraform_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            Terraform_bin=$Terraform_bin_amd64
            ;;
        *"linux-arm64"*)
            Terraform_bin=$Terraform_bin_arm64
            ;;
    esac

    name="terraform"
    which terraform > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Echo_ALERT "Downloading $name"
        mkdir -p /tmp/terraform && cd /tmp/terraform && $Proxy_OK wget https://releases.hashicorp.com/terraform/$Terraform_Ver/$Terraform_bin > /dev/null 2>&1 && Echo_INFOR "Downloaded from hashicorp.com" || Echo_ERROR2
        unzip $Terraform_bin > /dev/null 2>&1
        mv --force terraform /usr/local/bin/terraform > /dev/null 2>&1 && chmod +x /usr/local/bin/terraform && Echo_INFOR "Successfully installed $name $Terraform_Ver" || Echo_ERROR3
        rm -rf /tmp/terraform && cd /tmp
    fi

}

# ===================== Install aliyun-cli =====================
aliyun-cli_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            aliyun_cli_bin=$aliyun_cli_bin_amd64
            ;;
        *"linux-arm64"*)
            aliyun_cli_bin=$aliyun_cli_bin_arm64
            ;;
    esac

    name="aliyun"
    which aliyun > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/aliyun-cli && cd /tmp/aliyun-cli && $Proxy_OK wget https://github.com/aliyun/aliyun-cli/releases/download/$aliyun_cli_Ver/$aliyun_cli_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $aliyun_cli_bin > /dev/null 2>&1
        mv --force aliyun /usr/local/bin/aliyun > /dev/null 2>&1 && chmod +x /usr/local/bin/aliyun && Echo_INFOR "Successfully installed $name $aliyun-cli_Ver" || Echo_ERROR3
        rm -rf /tmp/aliyun-cli && cd /tmp
    fi

}

# ===================== Install aws-cli =====================
aws-cli_Install(){

    name="aws"
    which aws > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Echo_ALERT "Downloading $name"
        mkdir -p /tmp/aws-cli && cd /tmp/aws-cli && $Proxy_OK curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" > /dev/null 2>&1 || Echo_ERROR2
        unzip awscliv2.zip > /dev/null 2>&1
        ./aws/install && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
        rm -rf /tmp/aws-cli && cd /tmp
    fi

}


# ===================== Install redc =====================
redc_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            redc_bin=$redc_bin_amd64
            ;;
        *"linux-arm64"*)
            redc_bin=$redc_bin_arm64
            ;;
    esac

    name="redc"
    which redc > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/redc && cd /tmp/redc && $Proxy_OK wget https://github.com/wgpsec/redc/releases/download/$redc_Ver/$redc_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $redc_bin > /dev/null 2>&1
        mv --force redc /usr/local/bin/redc > /dev/null 2>&1 && chmod +x /usr/local/bin/redc && Echo_INFOR "Successfully installed $name $redc_Ver" || Echo_ERROR3
        rm -rf /tmp/redc && cd /tmp
    fi

}

# ===================== Install Serverless_Framework =====================
Serverless_Framework_Install(){

    name="Serverless Framework"

    which serverless > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        npm config set prefix /usr/local
        $Proxy_OK npm install -g serverless
        serverless -v && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install wrangler =====================
wrangler_Install(){

    name="wrangler"

    which wrangler > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        $Proxy_OK cargo install wrangler
        wrangler -V && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install SSH =====================
SSH_Tools(){

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Echo_INFOR "RedHat is available by default, this item Pass"
            ;;
        *"Kali"*|*"Debian"*)
            Rm_Lock
            Install_Switch "ssh"
            echo "PermitRootLogin yes" >> /etc/ssh/sshd_config && echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
            yes|ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key > /dev/null 2>&1
            yes|ssh-keygen -t dsa -f /etc/ssh/ssh_host_rsa_key > /dev/null 2>&1
            systemctl start ssh > /dev/null 2>&1 && Echo_INFOR "SSH initialization completed" || Echo_ERROR "SSH initialization failed"
            systemctl enable ssh > /dev/null 2>&1 && Echo_INFOR "SSH configuration boot-up" || Echo_ERROR "SSH configuration boot failure"
            ;;
        *"Ubuntu"*)
            Rm_Lock
            echo "PermitRootLogin yes" >> /etc/ssh/sshd_config && echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
            yes|ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key > /dev/null 2>&1
            yes|ssh-keygen -t dsa -f /etc/ssh/ssh_host_rsa_key > /dev/null 2>&1
            apt remove -y openssh-server > /dev/null 2>&1
            apt remove -y ssh > /dev/null 2>&1
            Install_Switch "openssh-server"
            Install_Switch "ssh"
            systemctl start ssh > /dev/null 2>&1 && Echo_INFOR "SSH initialization completed" || Echo_ERROR "SSH initialization failed"
            systemctl enable ssh > /dev/null 2>&1 && Echo_INFOR "SSH configuration boot-up" || Echo_ERROR "SSH configuration boot failure"
            ;;
        *) ;;
    esac

}

# ===================== pentest directory detection =====================
Pentest_Base_Install(){

    if test -d $P_Dir
    then
        Echo_ALERT "$P_Dir folder already exists"
    else
        mkdir -p $P_Dir && Echo_INFOR "$P_Dir folder created"
    fi

}

# ===================== AboutSecurity dictionary library =====================
Pentest_Dic_Install(){

    name="AboutSecurity"

    if test -d $P_Dir/$name
    then
        Echo_ALERT "$name dictionary already exists"
    else
        rm -rf $P_Dir/$name > /dev/null 2>&1 && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/wgpsec/AboutSecurity.git $P_Dir/$name > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $P_Dir/$name" || Echo_ERROR "Failed to download the $name dictionary from github"
    fi

}

# ===================== Install pentest misc tools =====================
Pentest_Misc_Install(){

    if test -e /tmp/f8x_misc.txt
    then
        Echo_ALERT "Tool installation record is detected, skip this step"
    else
        Rm_Lock
        Install_Switch "parallel"
        Install_Switch "rlwrap"
        Install_Switch "yara"
        touch /tmp/f8x_misc.txt > /dev/null 2>&1
    fi

}

# ===================== Install pentest pip module =====================
Pentest_pip_Install(){

    if test -e /tmp/f8x_pip.txt
    then
        Echo_ALERT "pip module record detected, skip this step"
    else
        # python3 -m pip install --upgrade pip > /dev/null 2>&1 || Echo_ERROR "python3-pip update failed"
        Install_Switch5 "PyJWT"
        Install_Switch5 "pyshark"
        Install_Switch5 "requests"
        Install_Switch5 "sqlparse"
        Install_Switch5 "threadpool"
        Install_Switch5 "urllib3"
        Install_Switch5 "lxml"
        Install_Switch5 "pyzbar"
        Install_Switch5 "bs4"
        Install_Switch5 "ftfy"
        Install_Switch5 "trzsz"
        pip3 install updog > /dev/null 2>&1
        pip3 install pefile > /dev/null 2>&1
        Install_Switch3 "yara"
        Install_Switch3 "pycrypto"
        Install_Switch3 "openpyxl"
        python2 -m pip install ujson > /dev/null 2>&1
        Install_Switch3 "Crypto"
        Install_Switch3 "pycryptodome"
        Install_Switch3 "pytz"
        python2 -m pip install pefile > /dev/null 2>&1
        touch /tmp/f8x_pip.txt > /dev/null 2>&1
    fi

}

# ===================== Install nmap =====================
Pentest_nmap_Install(){

    name="nmap"

    which nmap > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        Install_Switch "nmap"
    fi

}

# ===================== Install ffuf =====================
Pentest_ffuf_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            ffuf_Install=$ffuf_Install_amd64
            ;;
        *"linux-arm64"*)
            ffuf_Install=$ffuf_Install_arm64
            ;;
    esac

    name="ffuf"
    which ffuf > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/ffuf && cd /tmp/ffuf && rm -f $ffuf_Install && $Proxy_OK wget ${GitProxy}https://github.com/ffuf/ffuf/releases/download/$ffuf_Ver/$ffuf_Install > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $ffuf_Install > /dev/null 2>&1
        mv --force ffuf /usr/local/bin/ && chmod +x /usr/local/bin/ffuf
        rm -rf /tmp/ffuf && cd /tmp
        ffuf -V > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $ffuf_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install JSFinder =====================
Pentest_JSFinder_Install(){

    name="JSFinder"
    dir="$P_Dir/JSFinder"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/Threezh1/JSFinder.git $dir > /dev/null 2>&1 && cd $dir || Echo_ERROR2
        python3 JSFinder.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install SecretFinder =====================
Pentest_SecretFinder_Install(){

    name="SecretFinder"
    dir="$P_Dir/SecretFinder"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/m4ll0k/SecretFinder.git $dir > /dev/null 2>&1 && cd $dir || Echo_ERROR2
        Install_Switch6 "requirements.txt" && Echo_INFOR "Installed dependency modules" || { Echo_ERROR "Failed to install dependency module"; }
        python3 SecretFinder.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install OneForAll =====================
Pentest_OneForAll_Install(){

    name="OneForAll"
    dir="$P_Dir/OneForAll"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch5 "setuptools"
        Install_Switch5 "wheel"
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/shmilylty/OneForAll.git $dir > /dev/null 2>&1 && cd $dir || Echo_ERROR "$name download failed, please check if the network is reachable, proxychains4 configuration is correct, or download using gitee git clone https://gitee.com/shmilylty/OneForAll.git "
        Echo_ALERT "Installing dependency modules\033[0m" && Install_Switch6 "requirements.txt" || { Echo_ERROR "Failed to install dependency module"; }
        python3 oneforall.py version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" && aarch64_massdns_Install || Echo_ERROR3
    fi

}

aarch64_massdns_Install(){

    case $Linux_architecture_Name in
        *"linux-arm64"*)
            mkdir -p /tmp/massdns && cd $_
            $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/blechschmidt/massdns.git > /dev/null 2>&1
            cd /tmp/massdns/massdns && make > /dev/null 2>&1
            mv /tmp/massdns/massdns/bin/massdns $P_Dir/OneForAll/thirdparty/massdns/massdns_linux_aarch64 && Echo_INFOR "Successfully installed massdns in the $P_Dir/OneForAll/thirdparty/massdns/" && rm -rf /tmp/massdns && cd /tmp
            ;;
    esac

}

# ===================== Install ksubdomain =====================
Pentest_ksubdomain_Install(){

    name="ksubdomain"

    which ksubdomain > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                Rm_Lock
                case $Linux_Version in
                    *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                        Install_Switch "libpcap"
                        Install_Switch "libpcap-devel"
                        ;;
                    *"Kali"*|*"Ubuntu"*|*"Debian"*)
                        Install_Switch "libpcap-dev"
                        ;;
                    *) ;;
                esac

                mkdir -p /tmp/ksubdomain && cd /tmp/ksubdomain && rm -f ${ksubdomain_Install} && $Proxy_OK wget ${GitProxy}https://github.com/boy-hack/ksubdomain/releases/download/$ksubdomain_Ver/$ksubdomain_Install > /dev/null 2>&1 || Echo_ERROR2
                unzip ${ksubdomain_Install} > /dev/null 2>&1
                mv --force ksubdomain /usr/local/bin/ksubdomain && chmod +x /usr/local/bin/ksubdomain
                rm -rf /tmp/ksubdomain && cd /tmp
                ksubdomain > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $ksubdomain_Ver in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                Rm_Lock
                case $Linux_Version in
                    *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                        Install_Switch "libpcap"
                        Install_Switch "libpcap-devel"
                        ;;
                    *"Kali"*|*"Ubuntu"*|*"Debian"*)
                        Install_Switch "libpcap-dev"
                        ;;
                    *) ;;
                esac

                mkdir -p /tmp/ksubdomain && cd /tmp/ksubdomain && go install github.com/boy-hack/ksubdomain/cmd/ksubdomain@latest
                mv $GOPATH/bin/ksubdomain /usr/local/bin/ksubdomain && chmod +x /usr/local/bin/ksubdomain || { mv /root/go/bin/ksubdomain /usr/local/bin/ksubdomain; chmod +x /usr/local/bin/ksubdomain; }
                rm -rf /tmp/ksubdomain && cd /tmp
                which ksubdomain > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install masscan =====================
Pentest_masscan_Install(){

    name="masscan"

    which masscan > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        Install_Switch "masscan"
    fi

}

# ===================== Install fscan =====================
Pentest_fscan_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            fscan_Install=$fscan_Install_amd64
            ;;
        *"linux-arm64"*)
            fscan_Install=$fscan_Install_arm64
            ;;
    esac

    name="fscan"
    which fscan > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/fscan && cd /tmp/fscan && rm -f $fscan_Install && $Proxy_OK wget ${GitProxy}https://github.com/shadow1ng/fscan/releases/download/$fscan_Ver/$fscan_Install > /dev/null 2>&1 || Echo_ERROR2
        mv --force $fscan_Install /usr/local/bin/fscan && chmod +x /usr/local/bin/fscan
        which fscan > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $fscan_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/fscan && cd /tmp
    fi

}

# ===================== Install fingerprintx =====================
Pentest_fingerprintx_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            fingerprintx_Install=$fingerprintx_Install_amd64
            ;;
        *"linux-arm64"*)
            fingerprintx_Install=$fingerprintx_Install_arm64
            ;;
    esac

    name="fingerprintx"
    which fingerprintx > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/fingerprintx && cd /tmp/fingerprintx && rm -f $fingerprintx_Install > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/praetorian-inc/fingerprintx/releases/download/$fingerprintx_Ver/$fingerprintx_Install > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $fingerprintx_Install > /dev/null 2>&1
        mv --force fingerprintx /usr/local/bin/fingerprintx && chmod +x /usr/local/bin/fingerprintx
        which fingerprintx > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $fingerprintx_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/fingerprintx && cd /tmp
    fi

}

# ===================== Install HostCollision =====================
Pentest_HostCollision_Install(){

    JDK_Check

    name="HostCollision"
    dir="$P_Dir/HostCollision"

    if test -e $dir/HostCollision.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir
        mkdir -p /tmp/HostCollision && cd /tmp/HostCollision && rm -f $HostCollision_Bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/pmiaowu/HostCollision/releases/download/$HostCollision_Ver/$HostCollision_Bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $HostCollision_Bin > /dev/null 2>&1
        mv --force $HostCollision_dir/* $dir
        if test -e $dir/HostCollision.jar
        then
            Echo_INFOR "Successfully installed $name $HostCollision_Ver in the $dir"
        else
            Echo_ERROR3
        fi
        rm -rf /tmp/HostCollision && cd /tmp
    fi

}

# ===================== Install asnmap =====================
Pentest_asnmap_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            asnmap_bin=$asnmap_bin_amd64
            ;;
        *"linux-arm64"*)
            asnmap_bin=$asnmap_bin_arm64
            ;;
    esac

    name="asnmap"

    which asnmap > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/asnmap && cd /tmp/asnmap && rm -f $asnmap_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/asnmap/releases/download/$asnmap_Ver/$asnmap_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $asnmap_bin > /dev/null 2>&1
        mv --force asnmap /usr/local/bin/asnmap && chmod +x /usr/local/bin/asnmap
        which asnmap > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $asnmap_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/asnmap && cd /tmp
    fi

}

# ===================== Install tlsx =====================
Pentest_tlsx_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            tlsx_bin=$tlsx_bin_amd64
            ;;
        *"linux-arm64"*)
            tlsx_bin=$tlsx_bin_arm64
            ;;
    esac

    name="tlsx"

    which tlsx > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/tlsx && cd /tmp/tlsx && rm -f $tlsx_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/tlsx/releases/download/$tlsx_Ver/$tlsx_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $tlsx_bin > /dev/null 2>&1
        mv --force tlsx /usr/local/bin/tlsx && chmod +x /usr/local/bin/tlsx
        which tlsx > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $tlsx_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/tlsx && cd /tmp
    fi

}

# ===================== Install gogo =====================
Pentest_gogo_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            gogo_File=$gogo_File_amd64
            ;;
        *"linux-arm64"*)
            gogo_File=$gogo_File_arm64
            ;;
    esac

    name="gogo"

    which gogo > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/gogo && cd /tmp/gogo && rm -f $gogo_File > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/chainreactors/gogo/releases/download/$gogo_Ver/$gogo_File > /dev/null 2>&1 || Echo_ERROR2
        mv --force $gogo_File /usr/local/bin/gogo && chmod +x /usr/local/bin/gogo
        which gogo > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $gogo_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/gogo && cd /tmp
    fi

}

# ===================== Install spray =====================
Pentest_spray_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            spray_File=$spray_File_amd64
            ;;
        *"linux-arm64"*)
            spray_File=$spray_File_arm64
            ;;
    esac

    name="spray"

    which spray > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/spray && cd /tmp/spray && rm -f $spray_File > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/chainreactors/spray/releases/download/$spray_Ver/$spray_File > /dev/null 2>&1 || Echo_ERROR2
        mv --force $spray_File /usr/local/bin/spray && chmod +x /usr/local/bin/spray
        which spray > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $spray_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/spray && cd /tmp
    fi

}

# ===================== Install zombie =====================
Pentest_zombie_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            zombie_File=$zombie_File_amd64
            ;;
        *"linux-arm64"*)
            zombie_File=$zombie_File_arm64
            ;;
    esac

    name="zombie"

    which zombie > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/zombie && cd /tmp/zombie && rm -f $zombie_File > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/chainreactors/zombie/releases/download/$zombie_Ver/$zombie_File > /dev/null 2>&1 || Echo_ERROR2
        mv --force $zombie_File /usr/local/bin/zombie && chmod +x /usr/local/bin/zombie
        which zombie > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $zombie_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/zombie && cd /tmp
    fi

}

# ===================== Install ccupp =====================
Pentest_ccupp_Install(){

    name="ccupp"
    dir="$P_Dir/ccupp"

    which ccupp > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p $dir && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/WangYihang/ccupp.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR2
        cd $dir && rm -rf benchmark_data benchmark-site && $Proxy_OK pipx install . > /dev/null 2>&1
        which ccupp > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install GitHacker =====================
Pentest_GitHacker_Install(){

    name="GitHacker"
    which githacker > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "GitHacker"
        which githacker > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name via pip" || Echo_ERROR3
    fi

}

# ===================== Install iox =====================
Pentest_iox_Install(){

    name="iox"

    which iox > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/iox && cd /tmp/iox && rm -f $iox_File_amd64 > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/EddieIvan01/iox/releases/download/$iox_Ver/$iox_File_amd64 > /dev/null 2>&1 || Echo_ERROR2
                tar -zxf $iox_File_amd64 > /dev/null 2>&1 && mv --force iox /usr/local/bin/iox && chmod +x /usr/local/bin/iox
                rm -rf /tmp/iox && cd /tmp
                ;;
            *"linux-arm64"*)
                # iox 没有 arm64 预编译文件，需要 Go 源码编译
                mkdir -p /tmp/iox && cd /tmp/iox
                $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/EddieIvan01/iox.git . > /dev/null 2>&1 || Echo_ERROR2
                CGO_ENABLED=0 go build -o /usr/local/bin/iox . > /dev/null 2>&1 && chmod +x /usr/local/bin/iox
                rm -rf /tmp/iox && cd /tmp
                ;;
        esac
        which iox > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install chisel =====================
Pentest_chisel_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            chisel_File=$chisel_File_amd64
            ;;
        *"linux-arm64"*)
            chisel_File=$chisel_File_arm64
            ;;
    esac

    name="chisel"

    which chisel > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/chisel && cd /tmp/chisel && rm -f $chisel_File > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/jpillora/chisel/releases/download/$chisel_Ver/$chisel_File > /dev/null 2>&1 || Echo_ERROR2
        gunzip $chisel_File > /dev/null 2>&1
        chisel_bin=$(echo $chisel_File | sed 's/.gz$//')
        mv --force $chisel_bin /usr/local/bin/chisel && chmod +x /usr/local/bin/chisel
        which chisel > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $chisel_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/chisel && cd /tmp
    fi

}

# ===================== Install csprecon =====================
Pentest_csprecon_Install(){

    GO_Check

    name="csprecon"
    which csprecon > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/csprecon && cd /tmp/csprecon && go install github.com/edoardottt/csprecon/cmd/csprecon@latest
        mv $GOPATH/bin/csprecon /usr/local/bin/csprecon && chmod +x /usr/local/bin/csprecon || { mv /root/go/bin/csprecon /usr/local/bin/csprecon; chmod +x /usr/local/bin/csprecon; }
        rm -rf /tmp/csprecon && cd /tmp
        which csprecon > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install rad =====================
Pentest_rad_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            rad_File=$rad_File_amd64
            rad_bin=$rad_bin_amd64
            ;;
        *"linux-arm64"*)
            rad_File=$rad_File_arm64
            rad_bin=$rad_bin_arm64
            ;;
    esac

    name="rad"
    which rad > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/rad && cd /tmp/rad && rm -f ${rad_File} > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/chaitin/rad/releases/download/$rad_Ver/$rad_File > /dev/null 2>&1 || Echo_ERROR2
        unzip $rad_File > /dev/null 2>&1
        mv --force $rad_bin /usr/local/bin/rad && chmod +x /usr/local/bin/rad
        rm -rf /tmp/rad && cd /tmp
        which rad > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $rad_Ver in the /usr/local/bin/" || Echo_ERROR3
        Echo_INFOR "$name needs to be used with chromium, you can install chromium with the -chromium option"
    fi

}

# ===================== Install crawlergo =====================
Pentest_crawlergo_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            crawlergo_File=$crawlergo_File_amd64
            ;;
        *"linux-arm64"*)
            crawlergo_File=$crawlergo_File_arm64
            ;;
    esac

    name="crawlergo"
    which crawlergo > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/crawlergo && cd /tmp/crawlergo && rm -f $crawlergo_File && $Proxy_OK wget ${GitProxy}https://github.com/Qianlitp/crawlergo/releases/download/$crawlergo_Ver/$crawlergo_File > /dev/null 2>&1 || Echo_ERROR2
        # unzip $crawlergo_File > /dev/null 2>&1
        mv --force $crawlergo_File /usr/local/bin/crawlergo && chmod +x /usr/local/bin/crawlergo && Echo_INFOR "Successfully installed $name $crawlergo_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/crawlergo && cd /tmp
        Echo_INFOR "$name needs to be used with chromium, you can install chromium with the -chromium option"
    fi

}

# ===================== Install katana =====================
Pentest_katana_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            katana_bin=$katana_bin_amd64
            ;;
        *"linux-arm64"*)
            katana_bin=$katana_bin_arm64
            ;;
    esac

    name="katana"
    which katana > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/katana && cd /tmp/katana && rm -f $katana_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/katana/releases/download/$katana_Ver/$katana_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $katana_bin > /dev/null 2>&1
        mv --force katana /usr/local/bin/katana && chmod +x /usr/local/bin/katana
        which katana > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $katana_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/katana && cd /tmp
    fi

}

# ===================== Install Arjun =====================
Pentest_Arjun_Install(){

    name="Arjun"

    which arjun > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "arjun"
    fi

}

# ===================== Install gospider =====================
Pentest_gospider_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            gospider_bin=$gospider_bin_amd64
            gospider_dir=$gospider_dir_amd64
            ;;
        *"linux-arm64"*)
            gospider_bin=$gospider_bin_arm64
            gospider_dir=$gospider_dir_arm64
            ;;
    esac

    name="gospider"
    which gospider > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/gospider && cd /tmp/gospider && rm -f ${gospider_bin} && rm -rf ${gospider_dir} && $Proxy_OK wget ${GitProxy}https://github.com/jaeles-project/gospider/releases/download/$gospider_Ver/$gospider_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip ${gospider_bin} > /dev/null 2>&1
        mv --force ${gospider_dir}/gospider /usr/local/bin/gospider && chmod +x /usr/local/bin/gospider
        rm -rf /tmp/gospider && cd /tmp
        which gospider > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $gospider_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install naabu =====================
Pentest_naabu_Install(){

    name="naabu"

    which naabu > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                Rm_Lock
                case $Linux_Version in
                    *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                        Install_Switch "libpcap"
                        Install_Switch "libpcap-devel"
                        ;;
                    *"Kali"*|*"Ubuntu"*|*"Debian"*)
                        Install_Switch "libpcap-dev"
                        ;;
                    *) ;;
                esac
                mkdir -p /tmp/naabu && cd /tmp/naabu && go install github.com/projectdiscovery/naabu/v2/cmd/naabu@latest
                mv $GOPATH/bin/naabu /usr/local/bin/naabu && chmod +x /usr/local/bin/naabu || { mv /root/go/bin/naabu /usr/local/bin/naabu; chmod +x /usr/local/bin/naabu; }
                rm -rf /tmp/naabu && cd /tmp
                which naabu > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                # mkdir -p /tmp/naabu && cd /tmp/naabu && rm -f $naabu_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/naabu/releases/download/$naabu_Ver/$naabu_bin > /dev/null 2>&1 || Echo_ERROR2
                # unzip $naabu_bin > /dev/null 2>&1
                # mv --force naabu /usr/local/bin/naabu && chmod +x /usr/local/bin/naabu
                # rm -rf /tmp/naabu
                # naabu -version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $naabu_Ver in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                Rm_Lock
                case $Linux_Version in
                    *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                        Install_Switch "libpcap"
                        Install_Switch "libpcap-devel"
                        ;;
                    *"Kali"*|*"Ubuntu"*|*"Debian"*)
                        Install_Switch "libpcap-dev"
                        ;;
                    *) ;;
                esac
                mkdir -p /tmp/naabu && cd /tmp/naabu && go install github.com/projectdiscovery/naabu/v2/cmd/naabu@latest
                mv $GOPATH/bin/naabu /usr/local/bin/naabu && chmod +x /usr/local/bin/naabu || { mv /root/go/bin/naabu /usr/local/bin/naabu; chmod +x /usr/local/bin/naabu; }
                rm -rf /tmp/naabu && cd /tmp
                which naabu > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install httpx =====================
Pentest_httpx_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            httpx_bin=$httpx_bin_amd64
            ;;
        *"linux-arm64"*)
            httpx_bin=$httpx_bin_arm64
            ;;
    esac

    name="httpx"
    which httpx > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/httpx && cd /tmp/httpx && rm -f ${httpx_bin} && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/httpx/releases/download/$httpx_Ver/$httpx_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $httpx_bin > /dev/null 2>&1
        mv --force httpx /usr/local/bin/httpx && chmod +x /usr/local/bin/httpx
        rm -rf /tmp/httpx && cd /tmp
        httpx -version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $httpx_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi
``
}

# ===================== Install subfinder =====================
Pentest_subfinder_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            subfinder_bin=$subfinder_bin_amd64
            ;;
        *"linux-arm64"*)
            subfinder_bin=$subfinder_bin_arm64
            ;;
    esac

    name="subfinder"
    which subfinder > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/subfinder && cd /tmp/subfinder && rm -f $subfinder_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/subfinder/releases/download/$subfinder_Ver/$subfinder_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $subfinder_bin > /dev/null 2>&1
        mv --force subfinder /usr/local/bin/subfinder && chmod +x /usr/local/bin/subfinder
        rm -rf /tmp/subfinder && cd /tmp
        subfinder -version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $subfinder_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install afrog =====================
Pentest_afrog_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            afrog_File=$afrog_File_amd64
            afrog_bin=$afrog_bin_amd64
            ;;
        *"linux-arm64"*)
            afrog_File=$afrog_File_arm64
            afrog_bin=$afrog_bin_arm64
            ;;
    esac

    name="afrog"
    which afrog > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/afrog && cd /tmp/afrog && rm -f $afrog_File > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/zan8in/afrog/releases/download/$afrog_Ver/$afrog_File > /dev/null 2>&1 || Echo_ERROR2
        unzip $afrog_File > /dev/null 2>&1
        mv --force $afrog_bin /usr/local/bin/afrog && chmod +x /usr/local/bin/afrog
        rm -rf /tmp/afrog && cd /tmp
        afrog -version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $afrog_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install dddd =====================
Pentest_dddd_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            dddd_bin=$dddd_bin_amd64
            ;;
        *"linux-arm64"*)
            dddd_bin=$dddd_bin_arm64
            ;;
    esac

    name="dddd"
    which dddd > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/dddd && cd /tmp/dddd && rm -f $subfinder_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/SleepingBag945/dddd/releases/download/$dddd_Ver/$dddd_bin > /dev/null 2>&1 || Echo_ERROR2
        mv --force $dddd_bin /usr/local/bin/dddd && chmod +x /usr/local/bin/dddd
        rm -rf /tmp/dddd && cd /tmp
        dddd -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $dddd_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install gau =====================
Pentest_gau_Install(){

    name="gau"

    which gau > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/gau && cd /tmp/gau && rm -f $gau_bin && $Proxy_OK wget ${GitProxy}https://github.com/lc/gau/releases/download/$gau_Ver/$gau_bin > /dev/null 2>&1 || Echo_ERROR2
                tar -zxvf $gau_bin > /dev/null 2>&1
                mv --force gau /usr/local/bin/gau && chmod +x /usr/local/bin/gau
                rm -rf /tmp/gau && cd /tmp
                which gau > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $gau_Ver in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                mkdir -p /tmp/gau && cd /tmp/gau && go install github.com/lc/gau/v2/cmd/gau@latest
                mv $GOPATH/bin/gau /usr/local/bin/gau && chmod +x /usr/local/bin/gau || { mv /root/go/bin/gau /usr/local/bin/gau; chmod +x /usr/local/bin/gau; }
                rm -rf /tmp/gau && cd /tmp
                which gau > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install apktool =====================
Pentest_apktool_Install(){

    JDK_Check

    name="apktool"

    which apktool > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/apktool && cd /tmp/apktool && rm -f apktool && $Proxy_OK wget -O apktool ${GitProxy}https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool > /dev/null 2>&1 || Echo_ERROR2
        rm -f $apktool_bin && $Proxy_OK wget ${GitProxy}https://github.com/iBotPeaches/Apktool/releases/download/$apktool_Ver/$apktool_bin > /dev/null 2>&1 || Echo_ERROR2
        mv $apktool_bin apktool.jar && mv --force apktool.jar /usr/local/bin/apktool.jar && chmod +x /usr/local/bin/apktool.jar
        mv --force apktool /usr/local/bin/apktool && chmod +x /usr/local/bin/apktool
        rm -rf /tmp/apktool && cd /tmp
        which apktool > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $apktool_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install apkleaks =====================
Pentest_apkleaks_Install(){

    name="apkleaks"
    which apkleaks > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "apkleaks"
    fi

}

# ===================== Install ApkAnalyser =====================
Pentest_ApkAnalyser_Install(){

    name="ApkAnalyser"
    dir="$P_Dir/"

    if test -e $P_Dir/apkAnalyser.py
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch5 "apkutils" > /dev/null 2>&1
        $Proxy_OK curl -o $P_Dir/apkAnalyser.py https://cdn.jsdelivr.net/gh/TheKingOfDuck/ApkAnalyser/apkAnalyser.py > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install Diggy =====================
Pentest_Diggy_Install(){

    name="Diggy"
    dir="$P_Dir/"

    if test -e $P_Dir/diggy.sh
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK curl -o diggy.sh https://cdn.jsdelivr.net/gh/s0md3v/Diggy/diggy.sh > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install AppInfoScanner =====================
Pentest_AppInfoScanner_Install(){

    name="AppInfoScanner"
    dir="$P_Dir/AppInfoScanner"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/kelvinBen/AppInfoScanner.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
        cd $dir && Install_Switch6 "requirements.txt" && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install Amass =====================
Pentest_Amass_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            Amass_bin=$Amass_bin_amd64
            ;;
        *"linux-arm64"*)
            Amass_bin=$Amass_bin_arm64
            ;;
    esac

    name="Amass"
    which amass > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/Amass && cd /tmp/Amass && rm -rf ${Amass_bin} && $Proxy_OK wget ${GitProxy}https://github.com/owasp-amass/amass/releases/download/$Amass_Ver/$Amass_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf ${Amass_bin} > /dev/null 2>&1 && rm -rf ${Amass_bin}
        mv --force amass_*/amass /usr/local/bin/amass && chmod +x /usr/local/bin/amass
        rm -rf /tmp/Amass && cd /tmp
        which amass > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $Amass_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install gobuster =====================
Pentest_gobuster_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            gobuster_bin=$gobuster_bin_amd64
            ;;
        *"linux-arm64"*)
            gobuster_bin=$gobuster_bin_arm64
            ;;
    esac

    name="gobuster"

    which gobuster > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/gobuster && cd /tmp/gobuster && rm -f ${gobuster_bin} && rm -rf gobuster-linux-amd64 && $Proxy_OK wget ${GitProxy}https://github.com/OJ/gobuster/releases/download/$gobuster_Ver/$gobuster_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $gobuster_bin > /dev/null 2>&1 && rm -f $gobuster_bin > /dev/null 2>&1
        mv --force gobuster /usr/local/bin/gobuster && chmod +x /usr/local/bin/gobuster
        rm -rf /tmp/gobuster && cd /tmp
        which gobuster > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $gobuster_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install dirsearch =====================
Pentest_dirsearch_Install(){

    name="dirsearch"
    dir="$P_Dir/dirsearch"

    if test -d $dir
    then
        Echo_ALERT "$name installed"
    else
        cd $P_Dir && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/maurosoria/dirsearch.git > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && Install_Switch7 "requirements.txt"
        if test -d $dir
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# ===================== Install dismap =====================
Pentest_dismap_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            dismap_bin=$dismap_bin_amd64
            ;;
        *"linux-arm64"*)
            dismap_bin=$dismap_bin_arm64
            ;;
    esac

    name="dismap"
    which dismap > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/dismap && cd /tmp/dismap && rm -f ${dismap_bin} && $Proxy_OK wget ${GitProxy}https://github.com/zhzyker/dismap/releases/download/$dismap_Ver/$dismap_bin > /dev/null 2>&1 || Echo_ERROR2
        mv --force $dismap_bin /usr/local/bin/dismap && chmod +x /usr/local/bin/dismap
        rm -rf /tmp/dismap && cd /tmp
        which dismap > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $dismap_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install htpwdScan =====================
Pentest_htpwdScan_Install(){

    name="htpwdScan"
    dir="$P_Dir/htpwdScan"

    if test -d $dir
    then
        Echo_ALERT "$name installed"
    else
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/lijiejie/htpwdScan.git > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && Install_Switch7 "requirements.txt" && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install WebCrack =====================
Pentest_WebCrack_Install(){

    name="WebCrack"
    dir="$P_Dir/WebCrack"

    if test -d $dir
    then
        Echo_ALERT "$name installed"
    else
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/yzddmr6/WebCrack.git > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && Install_Switch7 "requirements.txt" && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install netspy =====================
Pentest_netspy_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            netspy_bin=$netspy_bin_amd64
            ;;
        *"linux-arm64"*)
            netspy_bin=$netspy_bin_arm64
            ;;
    esac

    name="netspy"
    which netspy > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/netspy && cd /tmp/netspy && $Proxy_OK wget ${GitProxy}https://github.com/shmilylty/netspy/releases/download/$netspy_Ver/$netspy_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $netspy_bin > /dev/null 2>&1
        mv --force $netspy_bin /usr/local/bin/netspy && chmod +x /usr/local/bin/netspy
        which netspy > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $netspy_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/netspy && cd /tmp
    fi

}

Pentest_zscan_Install(){

    name="zscan"
    which zscan > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/zscan && cd /tmp/zscan && go install github.com/zyylhn/zscan@latest
        mv $GOPATH/bin/zscan /usr/local/bin/zscan && chmod +x /usr/local/bin/zscan || { mv /root/go/bin/zscan /usr/local/bin/zscan; chmod +x /usr/local/bin/zscan; }
        rm -rf /tmp/zscan && cd /tmp
        which zscan > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install Metasploit =====================
Pentest_Metasploit_Install(){

    name="Metasploit"

    which msfconsole > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed , consider running 'msfupdate' to update to the latest version."
        Echo_INFOR "Before running msfconsole for the first time, it is necessary to start the database by running: msfdb init && msfdb start."
    else
        Rm_Lock
        mkdir -p /tmp/Metasploit && cd /tmp/Metasploit && rm -f msfinstall && $Proxy_OK curl -o msfinstall https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > /dev/null 2>&1 && chmod 777 msfinstall
        Echo_ALERT "Downloading Metasploit" && $Proxy_OK ./msfinstall > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" && Echo_INFOR "Before running msfconsole for the first time, it is necessary to start the database by running: msfdb init && msfdb start." || Echo_ERROR3
        rm -rf /tmp/Metasploit && cd /tmp
    fi

}

# ===================== Install Sqlmap =====================
Pentest_Sqlmap_Install(){

    name="Sqlmap"
    dir="$P_Dir/sqlmap"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Echo_ALERT "Downloading Sqlmap" && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/sqlmapproject/sqlmap $dir > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && Echo_INFOR "Successfully installed $name $(python3 sqlmap.py --version) in the $P_Dir/sqlmap" || Echo_ERROR3
    fi

    # 创建软链接，确保 sqlmap 在 PATH 中可用
    if [ -f "$dir/sqlmap.py" ] && ! which sqlmap > /dev/null 2>&1; then
        ln -sf $dir/sqlmap.py /usr/local/bin/sqlmap 2>/dev/null
    fi

}

# ===================== Install xray =====================
Pentest_xray_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            xray_File=$xray_File_amd64
            xray_bin=$xray_bin_amd64
            ;;
        *"linux-arm64"*)
            xray_File=$xray_File_arm64
            xray_bin=$xray_bin_arm64
            ;;
    esac

    name="xray"
    which xray > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/xray && cd /tmp/xray && rm -f $xray_File && $Proxy_OK wget ${GitProxy}https://github.com/chaitin/xray/releases/download/$xray_Ver/$xray_File > /dev/null 2>&1 || Echo_ERROR2
        unzip $xray_File > /dev/null 2>&1 && rm -f $xray_File && mv --force $xray_bin /usr/local/bin/xray && chmod +x /usr/local/bin/xray
        rm -rf /tmp/xray && cd /tmp
        which xray > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $xray_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

    #name="xray poc"
    #dir="$P_Dir/xray"

    #if test -d $dir
    #then
        #Echo_ALERT "$name poc is already installed in $dir"
    #else
        #$Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/chaitin/xray.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name poc in the $dir" || Echo_ERROR4 "chaitin/xray"
    #fi

}

# ===================== Install pocsuite3 =====================
Pentest_pocsuite3_Install(){

    name="pocsuite3"

    which pocsuite > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "pocsuite3"
    fi

}

# ===================== Install Nuclei =====================
Pentest_Nuclei_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            Nuclei_Install=$Nuclei_Install_amd64
            ;;
        *"linux-arm64"*)
            Nuclei_Install=$Nuclei_Install_arm64
            ;;
    esac

    name="Nuclei"
    which nuclei > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/nuclei && cd /tmp/nuclei && rm -f $Nuclei_Install && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/nuclei/releases/download/$Nuclei_Ver/$Nuclei_Install > /dev/null 2>&1 || Echo_ERROR2
        unzip $Nuclei_Install > /dev/null 2>&1
        mv --force nuclei /usr/local/bin/nuclei && chmod +x /usr/local/bin/nuclei
        rm -rf /tmp/nuclei && cd /tmp
        which nuclei > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $Nuclei_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

Pentest_nuclei-templates_Install(){

    echo -e "\033[1;33m\n>> Updating nuclei-templates\n\033[0m"
    cd $P_Dir && $Proxy_OK nuclei -update-templates > /dev/null 2>&1 && Echo_INFOR "Updated nuclei-templates " || Echo_ERROR "nuclei-templates update failed"

}

# ===================== Install w13scan =====================
Pentest_w13scan_Install(){

    name="w13scan"
    dir="$P_Dir/w13scan"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/w-digital-scanner/w13scan.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
        cd $dir && Install_Switch7 "requirements.txt" && Install_Switch5 "cowpy" && cd W13SCAN && python3 w13scan.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || { Echo_ERROR3; }
    fi

}

# ===================== Install commix =====================
Pentest_commix_Install(){

    name="commix"
    dir="$P_Dir/commix"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/commixproject/commix.git $dir > /dev/null 2>&1 && cd $dir || Echo_ERROR2
        python3 commix.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install tplmap =====================
Pentest_tplmap_Install(){

    name="tplmap"
    dir="$P_Dir/tplmap"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/epinna/tplmap.git $dir > /dev/null 2>&1 && cd $dir || Echo_ERROR2
        python2 tplmap.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install OpenRedireX =====================
Pentest_OpenRedireX_Install(){

    name="OpenRedireX"
    dir="$P_Dir/OpenRedireX"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/No-Github/OpenRedireX.git > /dev/null 2>&1
        cd $dir && Install_Switch5 "aiohttp" && Echo_INFOR "Successfully installed $name in the $dir" || { Echo_ERROR3; }
    fi

}

# ===================== Install CORScanner =====================
Pentest_CORScanner_Install(){

    name="CORScanner"
    dir="$P_Dir/CORScanner"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/chenjj/CORScanner.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
        cd $dir && Install_Switch7 "requirements.txt" && python3 cors_scan.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || { Echo_ERROR3; }
    fi

}

# ===================== Install swagger-exp =====================
Pentest_swagger-exp_Install(){

    name="swagger-exp"
    dir="$P_Dir/swagger-exp"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/lijiejie/swagger-exp.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install swagger-hack =====================
Pentest_swagger-hack_Install(){

    name="swagger-hack"
    dir="$P_Dir/swagger-hack"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch5 "loguru"
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/jayus0821/swagger-hack.git > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
    fi

}

# jitpack.io often download fails
# ===================== Install ysoserial =====================
Pentest_ysoserial_Install(){

    name="ysoserial"
    dir="$P_Dir/ysoserial"

    if test -e $dir/ysoserial.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_ && rm -f ysoserial.jar > /dev/null 2>&1 && $Proxy_OK wget -O ysoserial.jar ${GitProxy}https://github.com/frohoff/ysoserial/releases/download/v0.0.6/ysoserial-all.jar > /dev/null 2>&1 || Echo_ERROR2
        if test -e $dir/ysoserial.jar
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# ===================== Install ysuserial =====================
Pentest_ysuserial_Install(){

    name="ysuserial"
    dir="$P_Dir/ysuserial"

    if test -e $dir/ysuserial.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_ && rm -f ysuserial.jar > /dev/null 2>&1 && $Proxy_OK wget -O ysuserial.jar ${GitProxy}https://github.com/su18/ysoserial/releases/download/$ysuserial_Ver/$ysuserial_bin > /dev/null 2>&1 || Echo_ERROR2
        if test -e $dir/ysuserial.jar
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# ===================== Install remote-method-guesser =====================
Pentest_remote-method-guesser_Install(){

    JDK_Check

    name="remote-method-guesser"
    dir="$P_Dir/remote-method-guesser"

    if test -e $dir/rmg.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_ && rm -f rmg.jar > /dev/null 2>&1 && $Proxy_OK wget -O rmg.jar ${GitProxy}https://github.com/qtc-de/remote-method-guesser/releases/download/$rmg_Ver/$rmg_bin > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && java -jar rmg.jar --help > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install SSRFmap =====================
Pentest_SSRFmap_Install(){

    name="SSRFmap"
    dir="$P_Dir/SSRFmap"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/swisskyrepo/SSRFmap.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
        cd $dir && Install_Switch7 "requirements.txt" && python3 ssrfmap.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || { Echo_ERROR3; }
    fi

}

# ===================== Install testssl =====================
Pentest_testssl_Install(){

    name="testssl"
    dir="$P_Dir/testssl.sh/"

    if test -e $P_Dir/testssl.sh
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "bind-utils"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "dnsutils"
                ;;
            *) ;;
        esac
        cd $P_Dir && git clone --depth 1 https://github.com/drwetter/testssl.sh.git > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install dalfox =====================
Pentest_dalfox_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            dalfox_bin=$dalfox_bin_amd64
            ;;
        *"linux-arm64"*)
            dalfox_bin=$dalfox_bin_arm64
            ;;
    esac

    name="dalfox"
    which dalfox > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/dalfox && cd /tmp/dalfox && rm -f $dalfox_bin && $Proxy_OK wget ${GitProxy}https://github.com/hahwul/dalfox/releases/download/$dalfox_Ver/$dalfox_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $dalfox_bin > /dev/null 2>&1
        mv dalfox /usr/local/bin/dalfox && chmod +x /usr/local/bin/dalfox
        rm -rf /tmp/dalfox && cd /tmp
        which dalfox > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $dalfox_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install JNDI-Injection-Exploit =====================
Pentest_JNDI-Injection-Exploit_Install(){

    name="JNDI-Injection-Exploit"
    dir="$P_Dir/JNDI-Injection-Exploit"

    if test -e $dir/JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_ && rm -f JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar > /dev/null 2>&1 && $Proxy_OK wget -O JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar ${GitProxy}https://github.com/welk1n/JNDI-Injection-Exploit/releases/download/v1.0/JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar > /dev/null 2>&1 || Echo_ERROR2
        if test -e $dir/JNDI-Injection-Exploit-1.0-SNAPSHOT-all.jar
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# ===================== Install Gopherus =====================
Pentest_Gopherus_Install(){

    name="Gopherus"
    which gopherus > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        cd $P_Dir && rm -rf Gopherus && $Proxy_OK git clone ${GitProxy}https://github.com/tarunkant/Gopherus.git > /dev/null 2>&1 || Echo_ERROR2
        Install_Switch3 "argparse"
        Install_Switch3 "requests"
        cd Gopherus && chmod +x gopherus.py
        ln -sf $(pwd)/gopherus.py /usr/local/bin/gopherus
        which gopherus > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $P_Dir" || Echo_ERROR3
    fi

}

# ===================== Install rogue_mysql_server =====================
Pentest_rogue_mysql_server_Install(){

    name="rogue_mysql_server"
    dir="$P_Dir/rogue_mysql_server"

    if test -x "$dir/rogue_mysql_server"
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)  rogue_mysql_server_bin="${rogue_mysql_server_bin_amd64}" ;;
            *"linux-arm64"*)   rogue_mysql_server_bin="${rogue_mysql_server_bin_arm64}" ;;
            *)                 rogue_mysql_server_bin="${rogue_mysql_server_bin_amd64}" ;;
        esac
        mkdir -p "$dir"
        $Proxy_OK wget ${GitProxy}https://github.com/rmb122/rogue_mysql_server/releases/download/${rogue_mysql_server_Ver}/${rogue_mysql_server_bin} \
            -O "$dir/${rogue_mysql_server_bin}" ${wget_option} 2>/dev/null || Echo_ERROR2
        cd "$dir" && unzip -o "${rogue_mysql_server_bin}" > /dev/null 2>&1
        chmod +x "$dir/rogue_mysql_server"
        rm -f "$dir/${rogue_mysql_server_bin}"
        test -x "$dir/rogue_mysql_server" && Echo_INFOR "Successfully installed $name $rogue_mysql_server_Ver in $dir" || Echo_ERROR3
    fi

}

# ===================== Install redis-rogue-server =====================
Pentest_redis-rogue-server_Install(){

    name="redis-rogue-server"
    dir="$P_Dir/redis-rogue-server"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/Dliv3/redis-rogue-server.git $dir > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && python3 redis-rogue-server.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install redis-rogue-server-win =====================
Pentest_redis-rogue-server-win_Install(){

    name="redis-rogue-server-win"
    dir="$P_Dir/redis-rogue-server-win"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/No-Github/redis-rogue-server-win.git $dir > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && python3 redis-rogue-server.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install redis-rce =====================
Pentest_redis-rce_Install(){

    name="redis-rce"
    dir="$P_Dir/redis-rce"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch5 "six"
        rm -rf $dir && cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/Ridter/redis-rce.git $dir > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && python3 redis-rce.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
        cp $P_Dir/redis-rogue-server/exp.so $dir && Echo_INFOR "Copied exp.so to $dir"
    fi

}

# ===================== Install redis_lua_exploit =====================
Pentest_redis_lua_exploit_Install(){

    name="redis_lua_exploit"
    dir="$P_Dir/redis_lua_exploit"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch3 "redis"
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/QAX-A-Team/redis_lua_exploit.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
    fi

}

# ===================== Install shiro_rce_tool =====================
Pentest_shiro_rce_tool_Install(){

    name="shiro_rce_tool"
    dir="$P_Dir/shiro_tool"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $dir && rm -f shiro_tool.jar && $Proxy_OK wget -O shiro_tool.jar ${GitProxy}https://github.com/No-Github/Archive/releases/download/shiro/shiro_tool.jar > /dev/null 2>&1 || Echo_ERROR2
        Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install shiro-exploit =====================
Pentest_shiro-exploit_Install(){

    name="shiro-exploit"
    dir="$P_Dir/shiro-exploit"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && $Proxy_OK git clone ${GitProxy}https://github.com/Ares-X/shiro-exploit.git $dir > /dev/null 2>&1 || Echo_ERROR2
        Install_Switch4 "pycryptodome"
        cd $dir && python3 shiro-exploit.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install marshalsec =====================
Pentest_marshalsec_Install(){

    name="marshalsec"
    dir="$P_Dir/marshalsec"

    if test -e $dir/marshalsec-0.0.3-SNAPSHOT-all.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_ && rm -f marshalsec-0.0.3-SNAPSHOT-all.jar > /dev/null 2>&1
        $Proxy_OK wget -O marshalsec-0.0.3-SNAPSHOT-all.jar ${GitProxy}https://github.com/No-Github/marshalsec/releases/download/v0.0.3/marshalsec-0.0.3-SNAPSHOT-all.jar > /dev/null 2>&1 || rm marshalsec-0.0.3-SNAPSHOT-all.jar
        if test -e $dir/marshalsec-0.0.3-SNAPSHOT-all.jar
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# ===================== Install ysomap =====================
Pentest_ysomap_Install(){

    name="ysomap"
    dir="$P_Dir/ysomap"

    if test -e $dir/$ysomap_bin
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_ && rm -f $ysomap_bin > /dev/null 2>&1
        $Proxy_OK wget -O $ysomap_bin ${GitProxy}https://github.com/wh1t3p1g/ysomap/releases/download/$ysomap_Ver/$ysomap_bin > /dev/null 2>&1 || rm $ysomap_bin
        if test -e $dir/$ysomap_bin
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# ===================== Install CDK =====================
Pentest_CDK_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            cdk_bin=$cdk_bin_amd64
            ;;
        *"linux-arm64"*)
            cdk_bin=$cdk_bin_arm64
            ;;
    esac

    name="CDK"
    which cdk > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/cdk && cd /tmp/cdk && rm -f ${cdk_bin} && $Proxy_OK wget ${GitProxy}https://github.com/cdk-team/CDK/releases/download/$cdk_Ver/$cdk_bin > /dev/null 2>&1 || Echo_ERROR2
        mv --force $cdk_bin /usr/local/bin/cdk && chmod +x /usr/local/bin/cdk
        rm -rf /tmp/cdk && cd /tmp
        which cdk > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $cdk_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install k8spider =====================
Pentest_k8spider_Install(){

    name="k8spider"
    which k8spider > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)  k8spider_arch="linux_amd64" ;;
            *"linux-arm64"*)   k8spider_arch="linux_arm64" ;;
            *)                 k8spider_arch="linux_amd64" ;;
        esac
        k8spider_file="k8spider_${k8spider_Ver}_${k8spider_arch}.tar.gz"
        mkdir -p /tmp/k8spider && cd /tmp/k8spider
        $Proxy_OK wget ${GitProxy}https://github.com/Esonhugh/k8spider/releases/download/${k8spider_Ver}/${k8spider_file} -O ${k8spider_file} ${wget_option} 2>/dev/null || Echo_ERROR2
        tar xzf ${k8spider_file} 2>/dev/null
        mv --force k8spider /usr/local/bin/k8spider && chmod +x /usr/local/bin/k8spider
        rm -rf /tmp/k8spider && cd /tmp
        which k8spider > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $k8spider_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install ingressnightmare =====================
Pentest_ingressnightmare_Install(){

    name="ingressnightmare"

    which ingressnightmare > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        local arch=$(uname -m)
        case "$arch" in
            x86_64)  local plat="linux_amd64" ;;
            aarch64) local plat="linux_arm64" ;;
            *)       Echo_ERROR "Unsupported arch: $arch"; return ;;
        esac
        local tarball="ingressnightmare_${ingressnightmare_Ver}_${plat}.tar.gz"
        $Proxy_OK wget ${GitProxy}https://github.com/Esonhugh/ingressNightmare-CVE-2025-1974-exps/releases/download/${ingressnightmare_Ver}/${tarball} -O /tmp/${tarball} ${wget_option} 2>/dev/null || Echo_ERROR2
        tar xzf /tmp/${tarball} -C /tmp/ ingressnightmare 2>/dev/null
        mv /tmp/ingressnightmare /usr/local/bin/ingressnightmare 2>/dev/null
        chmod +x /usr/local/bin/ingressnightmare 2>/dev/null
        rm -f /tmp/${tarball}
        which ingressnightmare > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${ingressnightmare_Ver} in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install kubectl =====================
Pentest_kubectl_Install(){

    name="kubectl"
    which kubectl > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)  kubectl_arch="amd64" ;;
            *"linux-arm64"*)   kubectl_arch="arm64" ;;
            *)                 kubectl_arch="amd64" ;;
        esac
        $Proxy_OK wget "https://dl.k8s.io/release/${kubectl_Ver}/bin/linux/${kubectl_arch}/kubectl" -O /usr/local/bin/kubectl ${wget_option} 2>/dev/null || Echo_ERROR2
        chmod +x /usr/local/bin/kubectl
        which kubectl > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $kubectl_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install kubeletctl =====================
Pentest_kubeletctl_Install(){

    name="kubeletctl"
    which kubeletctl > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)  kubeletctl_arch="linux_amd64" ;;
            *"linux-arm64"*)   kubeletctl_arch="linux_arm64" ;;
            *)                 kubeletctl_arch="linux_amd64" ;;
        esac
        kubeletctl_file="kubeletctl_${kubeletctl_arch}"
        $Proxy_OK wget ${GitProxy}https://github.com/cyberark/kubeletctl/releases/download/${kubeletctl_Ver}/${kubeletctl_file} -O /usr/local/bin/kubeletctl ${wget_option} 2>/dev/null || Echo_ERROR2
        chmod +x /usr/local/bin/kubeletctl
        which kubeletctl > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $kubeletctl_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install peirates =====================
Pentest_peirates_Install(){

    name="peirates"
    which peirates > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)  peirates_arch="linux-amd64" ;;
            *"linux-arm64"*)   peirates_arch="linux-arm64" ;;
            *)                 peirates_arch="linux-amd64" ;;
        esac
        peirates_file="peirates-${peirates_arch}.tar.xz"
        mkdir -p /tmp/peirates && cd /tmp/peirates
        $Proxy_OK wget ${GitProxy}https://github.com/inguardians/peirates/releases/download/${peirates_Ver}/${peirates_file} -O ${peirates_file} ${wget_option} 2>/dev/null || Echo_ERROR2
        tar xJf ${peirates_file} 2>/dev/null
        find . -name "peirates" -type f -exec mv --force {} /usr/local/bin/peirates \; 2>/dev/null
        chmod +x /usr/local/bin/peirates
        rm -rf /tmp/peirates && cd /tmp
        which peirates > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $peirates_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install etcdctl =====================
Pentest_etcdctl_Install(){

    name="etcdctl"
    which etcdctl > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)  etcdctl_arch="linux-amd64" ;;
            *"linux-arm64"*)   etcdctl_arch="linux-arm64" ;;
            *)                 etcdctl_arch="linux-amd64" ;;
        esac
        etcdctl_file="etcd-${etcdctl_Ver}-${etcdctl_arch}.tar.gz"
        mkdir -p /tmp/etcdctl && cd /tmp/etcdctl
        $Proxy_OK wget ${GitProxy}https://github.com/etcd-io/etcd/releases/download/${etcdctl_Ver}/${etcdctl_file} -O ${etcdctl_file} ${wget_option} 2>/dev/null || Echo_ERROR2
        tar xzf ${etcdctl_file} 2>/dev/null
        find . -name "etcdctl" -type f -exec mv --force {} /usr/local/bin/etcdctl \; 2>/dev/null
        chmod +x /usr/local/bin/etcdctl
        rm -rf /tmp/etcdctl && cd /tmp
        which etcdctl > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $etcdctl_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install tccli =====================
Pentest_tccli_Install(){

    name="tccli"
    which tccli > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "tccli"
        which tccli > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name via pip" || Echo_ERROR3
    fi

}

# ===================== Install cf =====================
Pentest_cf_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            cf_bin=$cf_Install_amd64
            ;;
        *"linux-arm64"*)
            cf_bin=$cf_Install_arm64
            ;;
    esac

    name="cf"
    which cf > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/cf && cd /tmp/cf && rm -f $cf_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/teamssix/cf/releases/download/$cf_Ver/$cf_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $cf_bin > /dev/null 2>&1 && rm -f $cf_bin > /dev/null 2>&1
        mv cf /usr/local/bin/cf && chmod +x /usr/local/bin/cf
        rm -rf /tmp/cf && cd /tmp
        which cf > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $cf_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# 原项目删除,已将 jar 包备份一份到 Archive
Pentest_JNDIExploit_0x727_Install(){

    name="JNDIExploit"
    dir="$P_Dir/JNDIExploit"

    if test -e $dir/JNDIExploit-1.3-SNAPSHOT.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_
        $Proxy_OK wget -O $JNDIExploit_bin ${GitProxy}https://github.com/0x727/JNDIExploit/releases/download/$JNDIExploit_Ver/$JNDIExploit_bin > /dev/null 2>&1 || rm $JNDIExploit_bin
        unzip $JNDIExploit_bin > /dev/null 2>&1 && rm -f $JNDIExploit_bin
        if test -e $dir/JNDIExploit-1.3-SNAPSHOT.jar
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# 原项目删除,已将 jar 包备份一份到 Archive
Pentest_JNDIExploit_Install(){

    name="JNDIExploit"
    dir="$P_Dir/JNDIExploit"

    if test -e $dir/JNDIExploit-1.2-SNAPSHOT.jar
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir && cd $_ && rm -rf $JNDIExploit_dir > /dev/null 2>&1
        $Proxy_OK wget -O $JNDIExploit_bin ${GitProxy}https://github.com/feihong-cs/JNDIExploit/releases/download/$JNDIExploit_Ver/$JNDIExploit_bin > /dev/null 2>&1 || rm $JNDIExploit_bin
        unzip $JNDIExploit_bin > /dev/null 2>&1 && rm -f $JNDIExploit_bin
        if test -e $dir/JNDIExploit-1.2-SNAPSHOT.jar
        then
            Echo_INFOR "Successfully installed $name in the $dir"
        else
            Echo_ERROR3
        fi
    fi

}

# ===================== Install Impacket =====================
Pentest_Impacket_Install(){

    name="Impacket"
    dir="$P_Dir/impacket"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/SecureAuthCorp/impacket.git $dir > /dev/null 2>&1 || Echo_ERROR2
        cd $dir && pip3 install . > /dev/null 2>&1
        python3 setup.py install > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install CobaltStrike 4.3 =====================
Pentest_CobaltStrike_Install(){

    JDK_Check

    name="CobaltStrike"

    if test -d $P_Dir/$CS_Version
    then
        Echo_ALERT "$CS_Version is already installed in $P_Dir/$CS_Version"
    else
        cd $P_Dir && rm -f $CS_File > /dev/null 2>&1 && $Proxy_OK wget -O $CS_File ${GitProxy2}https://raw.githubusercontent.com/No-Github/Archive/master/CS/$CS_File > /dev/null 2>&1 || Echo_ERROR "$CS_File download failed, please check if the network is reachable, proxychains4 configuration is correct"
        rm -rf $CS_Version > /dev/null 2>&1 && unzip $CS_File > /dev/null 2>&1 && rm -f $CS_File > /dev/null 2>&1
        cd $P_Dir/$CS_Version && chmod +x teamserver > /dev/null 2>&1
        rm -f cobaltstrike.store > /dev/null 2>&1
        Echo_INFOR "Successfully installed $CS_Version in the $P_Dir/$CS_Version" || Echo_ERROR3
    fi

    if test -e $P_Dir/$CS_Version/genCrossC2.Linux
    then
        Echo_ALERT "genCrossC2.Linux file already exists "
    else
        cd $P_Dir/$CS_Version && $Proxy_OK wget ${GitProxy}https://github.com/gloxec/CrossC2/releases/download/$CrossC2_Ver/genCrossC2.Linux > /dev/null 2>&1 && Echo_INFOR "Downloaded CrossC2 in the $P_Dir/$CS_Version/genCrossC2.Linux " || Echo_ERROR "CrossC2 installation failed"
        chmod +x genCrossC2.Linux > /dev/null 2>&1
    fi

    Echo_INFOR "CrossC2 command:\n\033[0m\033[1;32mcd $P_Dir/$CS_Version/ && ./genCrossC2.Linux <IP> <port> ./.cobaltstrike.beacon_keys null Linux x64 <filename> "

    if test -e $P_Dir/$CS_Version/cobaltstrike.store
    then
        Echo_ALERT "cobaltstrike.store file has been generated"
    else
        cd $P_Dir/$CS_Version
        keytool -keystore ./cobaltstrike.store -storepass sUp3r@dm1n -keypass sUp3r@dm1n -genkey -keyalg RSA -alias aliyun -dname "CN=aliyun, OU=aliyun, O=aliyun, L=aliyun, S=aliyun, C=aliyun" > /dev/null 2>&1

        if test -e $P_Dir/$CS_Version/cobaltstrike.store
        then
            Echo_ALERT "keytool 工具使用正常"
            rm -f cobaltstrike.store > /dev/null 2>&1
        else
            Echo_ERROR "keytool 工具使用出现问题,正在重新配置 jenv"
            jenv_config "/usr/local/java/$jdk8_Version"
            jenv local 1.8
            keytool -keystore ./cobaltstrike.store -storepass sUp3r@dm1n -keypass sUp3r@dm1n -genkey -keyalg RSA -alias aliyun -dname "CN=aliyun, OU=aliyun, O=aliyun, L=aliyun, S=aliyun, C=aliyun" > /dev/null 2>&1

            if test -e $P_Dir/$CS_Version/cobaltstrike.store
            then
                Echo_ALERT "keytool 工具使用正常"
                rm -f cobaltstrike.store > /dev/null 2>&1
            else
                Echo_ERROR "keytool 工具使用出现问题,请手动配置 jenv 环境"
            fi
        fi
    fi

}

# ===================== Install CobaltStrike 4.5 =====================
Pentest_CobaltStrike45_Install(){

    JDK_Check

    name="CobaltStrike4.5"

    if test -d $P_Dir/$CS45_Version
    then
        Echo_ALERT "$CS45_Version is already installed in $P_Dir/$CS45_Version"
    else
        cd $P_Dir && rm -f $CS45_File > /dev/null 2>&1 && $Proxy_OK wget -O $CS45_File ${GitProxy2}https://github.com/No-Github/Archive/releases/download/1.0.6/$CS45_File ${wget_option} || Echo_ERROR "$CS45_File download failed, please check if the network is reachable, proxychains4 configuration is correct"
        rm -rf $CS45_Version > /dev/null 2>&1 && unzip $CS45_File > /dev/null 2>&1 && rm -f $CS45_File > /dev/null 2>&1
        cd $P_Dir/$CS45_Version && chmod +x teamserver > /dev/null 2>&1
        rm -f cobaltstrike.store > /dev/null 2>&1
        Echo_INFOR "Successfully installed $CS45_Version in the $P_Dir/$CS45_Version" || Echo_ERROR3
    fi

    if test -e $P_Dir/$CS45_Version/genCrossC2.Linux
    then
        Echo_ALERT "genCrossC2.Linux file already exists "
    else
        cd $P_Dir/$CS45_Version && $Proxy_OK wget ${GitProxy}https://github.com/gloxec/CrossC2/releases/download/$CrossC2_Ver/genCrossC2.Linux ${wget_option} && Echo_INFOR "Downloaded CrossC2 in the $P_Dir/$CS45_Version/genCrossC2.Linux " || Echo_ERROR "CrossC2 installation failed"
        chmod +x genCrossC2.Linux > /dev/null 2>&1
    fi

    Echo_INFOR "CrossC2 command:\n\033[0m\033[1;32mcd $P_Dir/$CS45_Version/ && ./genCrossC2.Linux <IP> <port> ./.cobaltstrike.beacon_keys null Linux x64 <filename> "

    if test -e $P_Dir/$CS45_Version/cobaltstrike.store
    then
        Echo_ALERT "cobaltstrike.store file has been generated"
    else
        cd $P_Dir/$CS45_Version
        keytool -keystore ./cobaltstrike.store -storepass sUp3r@dm1n -keypass sUp3r@dm1n -genkey -keyalg RSA -alias aliyun -dname "CN=aliyun, OU=aliyun, O=aliyun, L=aliyun, S=aliyun, C=aliyun" > /dev/null 2>&1

        if test -e $P_Dir/$CS45_Version/cobaltstrike.store
        then
            Echo_ALERT "keytool 工具使用正常"
            rm -f cobaltstrike.store > /dev/null 2>&1
        else
            Echo_ERROR "keytool 工具使用出现问题,正在重新配置 jenv"
            jenv_config "/usr/local/java/$jdk8_Version"
            jenv local 1.8
            keytool -keystore ./cobaltstrike.store -storepass sUp3r@dm1n -keypass sUp3r@dm1n -genkey -keyalg RSA -alias aliyun -dname "CN=aliyun, OU=aliyun, O=aliyun, L=aliyun, S=aliyun, C=aliyun" > /dev/null 2>&1

            if test -e $P_Dir/$CS45_Version/cobaltstrike.store
            then
                Echo_ALERT "keytool 工具使用正常"
                rm -f cobaltstrike.store > /dev/null 2>&1
            else
                Echo_ERROR "keytool 工具使用出现问题,请手动配置 jenv 环境"
            fi
        fi
    fi

}

# ===================== Install Responder =====================
Pentest_Responder_Install(){

    name="Responder"
    dir="$P_Dir/Responder"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch5 "netifaces"
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/lgandx/Responder.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" && cd $dir || Echo_ERROR2
    fi

    # 创建软链接，确保 Responder 在 PATH 中可用
    if [ -f "$dir/Responder.py" ] && ! which responder > /dev/null 2>&1 && ! which Responder.py > /dev/null 2>&1; then
        ln -sf $dir/Responder.py /usr/local/bin/responder 2>/dev/null
    fi
}

# ===================== Install krbrelayx =====================
Pentest_krbrelayx_Install(){

    name="krbrelayx"
    dir="$P_Dir/krbrelayx"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone ${GitProxy}https://github.com/dirkjanm/krbrelayx.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install bettercap =====================
Pentest_bettercap_Install(){

    # case $Linux_architecture_Name in
    #     *"linux-x86_64"*)
    #         bettercap_bin=$bettercap_bin_amd64
    #         ;;
    #     *"linux-arm64"*)
    #         bettercap_bin=$bettercap_bin_arm64
    #         ;;
    # esac

    name="bettercap"
    which bettercap > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "libnetfilter-queue-dev"
                Install_Switch "libusb-1.0-0"
                Install_Switch "libusb-1.0-0-dev"
                Install_Switch "libusb-dev"
                Install_Switch "libudev-dev"
                Install_Switch "libpcap-dev"
                ldconfig > /dev/null 2>&1
                ;;
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Rm_Lock
                Install_Switch "libpcap"
                Install_Switch "libpcap-devel"
                ;;
            *) ;;
        esac

        mkdir -p /tmp/bettercap && cd /tmp/bettercap && go install github.com/bettercap/bettercap/v2@latest
        mv $GOPATH/bin/bettercap /usr/local/bin/bettercap && chmod +x /usr/local/bin/bettercap || { mv /root/go/bin/bettercap /usr/local/bin/bettercap; chmod +x /usr/local/bin/bettercap; }
        rm -rf /tmp/bettercap && cd /tmp
        which bettercap > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install mitmproxy =====================
Pentest_mitmproxy_Install(){

    name="mitmproxy"
    which mitmproxy > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/mitmproxy && cd /tmp/mitmproxy && rm -f $mitmproxy_bin && $Proxy_OK wget -O $mitmproxy_bin https://downloads.mitmproxy.org/$mitmproxy_Ver/$mitmproxy_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $mitmproxy_bin > /dev/null 2>&1
        mv --force mitmproxy /usr/local/bin/ && chmod +x /usr/local/bin/mitmproxy && rm -f /tmp/$mitmproxy_bin > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $mitmproxy_Ver in the /usr/local/bin/" || Echo_ERROR3
        mv --force mitmdump /usr/local/bin/ && chmod +x /usr/local/bin/mitmdump && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR "mitmdump installation failed"
        mv --force mitmweb /usr/local/bin/ && chmod +x /usr/local/bin/mitmweb && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR "mitmweb installation failed"
        rm -rf /tmp/mitmproxy && cd /tmp
    fi

}

# ===================== Install pypykatz =====================
Pentest_pypykatz_Install(){

    name="pypykatz"
    which pypykatz > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "pypykatz"
    fi

}

# ===================== Install CrackMapExec =====================
Pentest_CrackMapExec_Install(){

    # https://wiki.porchetta.industries/getting-started/installation/installation-on-unix
    name="CrackMapExec"
    # dir="$P_Dir/CrackMapExec"
    which crackmapexec > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "pipx"
        pipx ensurepath
        pipx install crackmapexec

        # 这个版本使用有些 bug,还是先安装旧版本
        #$Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/mpgn/CrackMapExec $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR2
        #cd CrackMapExec
        #$Proxy_OK pipx install .
    fi

}

# ===================== Install NetExec =====================
Pentest_NetExec_Install(){

    # https://www.netexec.wiki/getting-started/installation/installation-on-unix
    name="NetExec"
    which nxc > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "pipx"
        pipx ensurepath
        pipx install git+https://github.com/Pennyw0rth/NetExec
    fi

}

# ===================== Install Neo-reGeorg =====================
Pentest_Neo-reGeorg_Install(){

    name="Neo-reGeorg"
    dir="$P_Dir/Neo-reGeorg"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/L-codes/Neo-reGeorg.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR2
    fi

}

# ===================== Install suo5 =====================
Pentest_suo5_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            suo5_bin=$suo5_bin_amd64
            ;;
        *"linux-arm64"*)
            suo5_bin=$suo5_bin_arm64
            ;;
    esac

    name="suo5"
    which suo5 > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/suo5 && cd /tmp/suo5 && $Proxy_OK wget ${GitProxy}https://github.com/zema1/suo5/releases/download/${suo5_Ver}/${suo5_bin} > /dev/null 2>&1 || Echo_ERROR2
        mv ${suo5_bin} /usr/local/bin/suo5 && chmod +x /usr/local/bin/suo5
        which suo5 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${suo5_Ver} in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/suo5 && cd /tmp
    fi

}

# ===================== Install kerbrute =====================
Pentest_kerbrute_Install(){

    name="kerbrute"

    which kerbrute > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/kerbrute && cd /tmp/kerbrute && rm -f $kerbrute_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/ropnop/kerbrute/releases/download/$kerbrute_Ver/$kerbrute_bin > /dev/null 2>&1 || Echo_ERROR2
                mv --force $kerbrute_bin /usr/local/bin/kerbrute && chmod +x /usr/local/bin/kerbrute && rm -f /tmp/$kerbrute_bin > /dev/null 2>&1
                rm -rf /tmp/kerbrute && cd /tmp
                which kerbrute > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $kerbrute_Ver in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                mkdir -p /tmp/kerbrute && cd /tmp/kerbrute && go install github.com/ropnop/kerbrute@latest
                mv $GOPATH/bin/kerbrute /usr/local/bin/kerbrute && chmod +x /usr/local/bin/kerbrute || { mv /root/go/bin/kerbrute /usr/local/bin/kerbrute; chmod +x /usr/local/bin/kerbrute; }
                rm -rf /tmp/kerbrute && cd /tmp
                which kerbrute > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install Adinfo =====================
Pentest_Adinfo_Install(){

    name="Adinfo"

    which Adinfo > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/Adinfo && cd /tmp/Adinfo && rm -f $Adinfo_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/lzzbb/Adinfo/releases/download/$Adinfo_Ver/$Adinfo_bin > /dev/null 2>&1 || Echo_ERROR2
                mv --force $Adinfo_bin /usr/local/bin/Adinfo && chmod +x /usr/local/bin/Adinfo && rm -f /tmp/$Adinfo_bin > /dev/null 2>&1
                rm -rf /tmp/Adinfo && cd /tmp
                which Adinfo > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $Adinfo_Ver in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                # fork版更新了go.mod
                mkdir -p /tmp/Adinfo && cd /tmp/Adinfo && go install github.com/No-Github/Adinfo@latest
                mv $GOPATH/bin/Adinfo /usr/local/bin/Adinfo && chmod +x /usr/local/bin/Adinfo || { mv /root/go/bin/Adinfo /usr/local/bin/Adinfo; chmod +x /usr/local/bin/Adinfo; }
                rm -rf /tmp/Adinfo && cd /tmp
                which Adinfo > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install PetitPotam =====================
Pentest_PetitPotam_Install(){

    name="PetitPotam"
    dir="$P_Dir/PetitPotam"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch5 "impacket"
        rm -rf $dir > /dev/null 2>&1
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/topotam/PetitPotam.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download the $name dictionary from github"
    fi

}

# ===================== Install Certipy =====================
Pentest_Certipy_Install(){

    name="Certipy"
    which certipy > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "certipy-ad"
    fi

}

# ===================== Install PKINITtools =====================
Pentest_PKINITtools_Install(){

    name="PKINITtools"
    dir="$P_Dir/PKINITtools"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        Install_Switch5 "impacket"
        Install_Switch5 "minikerberos"
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/dirkjanm/PKINITtools.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download the $name dictionary from github"
        cd $dir && Install_Switch7 "requirements.txt"
    fi

}

# ===================== Install xfreerdp =====================
Pentest_xfreerdp_Install(){

    name="xfreerdp"

    which xfreerdp > /dev/null 2>&1 || which xfreerdp3 > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "freerdp2-x11"
                Install_Switch "freerdp3-x11"

                which xfreerdp > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" && return 0 || { which xfreerdp3 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" && return 0 || Echo_ERROR3; return 1; }
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install mitm6 =====================
Pentest_mitm6_Install(){

    name="mitm6"

    which mitm6 > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "mitm6"
        which mitm6 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install Coercer =====================
Pentest_Coercer_Install(){

    name="Coercer"

    which coercer > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "coercer"
    fi

}

# ===================== Install ldeep =====================
Pentest_ldeep_Install(){

    name="ldeep"

    which ldeep > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "libkrb5-dev"
                ;;
            *) ;;
        esac

        Install_Switch5 "ldeep"
        which ldeep > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install enum4linux-ng =====================
Pentest_enum4linux_ng_Install(){

    name="enum4linux-ng"
    dir="$P_Dir/enum4linux-ng"

    which enum4linux-ng > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/cddmp/enum4linux-ng $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
                cd $dir
                Install_Switch5 "wheel"
                Install_Switch7 "requirements.txt"
                python3 setup.py install

                python3 -m pip install cryptography --break-system-packages --ignore-installed
                python3 -m pip install impacket --break-system-packages

                Install_Switch "smbclient"
                which enum4linux-ng > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install bloodyAD =====================
Pentest_bloodyAD_Install(){

    name="bloodyAD"

    which bloodyAD > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "bloodyAD"
    fi

}

# ===================== Install bloodhound-python =====================
Pentest_bloodhound_python_Install(){

    name="bloodhound-python"

    which bloodhound-python > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "bloodhound"
    fi

}

# ===================== Install proxychains4 =====================
Pentest_proxychains4_Install(){

    name="proxychains4"

    which proxychains4 > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "proxychains4"
                which proxychains4 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install minikerberos =====================
Pentest_minikerberos_Install(){

    name="minikerberos"

    python3 -c "import minikerberos" > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "minikerberos"
        python3 -c "import minikerberos" > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install gMSADumper =====================
Pentest_gMSADumper_Install(){

    name="gMSADumper"
    dir="$P_Dir/gMSADumper"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/micahvandeusen/gMSADumper.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        cd $dir && Install_Switch7 "requirements.txt" 2>/dev/null
        chmod +x $dir/gMSADumper.py 2>/dev/null
        ln -sf $dir/gMSADumper.py /usr/local/bin/gMSADumper.py 2>/dev/null
    fi

}

# ===================== Install ligolo-ng (proxy) =====================
Pentest_ligolo_ng_Install(){

    name="ligolo-ng"
    which ligolo-proxy > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name proxy installed"
    else
        local ver_num=$(echo "$ligolo_ng_Ver" | sed 's/^v//')
        case $Linux_architecture_Name in
            *"linux-x86_64"*)  ligolo_arch="linux_amd64" ;;
            *"linux-arm64"*)   ligolo_arch="linux_arm64" ;;
            *)                 ligolo_arch="linux_amd64" ;;
        esac
        ligolo_file="ligolo-ng_proxy_${ver_num}_${ligolo_arch}.tar.gz"
        mkdir -p /tmp/ligolo-ng && cd /tmp/ligolo-ng
        $Proxy_OK wget ${GitProxy}https://github.com/nicocha30/ligolo-ng/releases/download/${ligolo_ng_Ver}/${ligolo_file} -O ${ligolo_file} ${wget_option} 2>/dev/null || Echo_ERROR2
        tar xzf ${ligolo_file} 2>/dev/null
        mv --force proxy /usr/local/bin/ligolo-proxy && chmod +x /usr/local/bin/ligolo-proxy
        rm -rf /tmp/ligolo-ng && cd /tmp
        which ligolo-proxy > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name proxy $ligolo_ng_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install linpeas =====================
Pentest_linpeas_Install(){

    name="linpeas"
    which linpeas > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        $Proxy_OK wget ${GitProxy}https://github.com/peass-ng/PEASS-ng/releases/download/${peass_ng_Ver}/linpeas.sh -O /usr/local/bin/linpeas ${wget_option} 2>/dev/null || Echo_ERROR2
        chmod +x /usr/local/bin/linpeas
        which linpeas > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install pyGPOAbuse =====================
Pentest_pyGPOAbuse_Install(){

    name="pyGPOAbuse"
    dir="$P_Dir/pyGPOAbuse"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/Hackndo/pyGPOAbuse.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        cd $dir && Install_Switch7 "requirements.txt" 2>/dev/null
        chmod +x $dir/pygpoabuse.py 2>/dev/null
        ln -sf $dir/pygpoabuse.py /usr/local/bin/pygpoabuse 2>/dev/null
    fi

}

# ===================== Install PassTheCert =====================
Pentest_PassTheCert_Install(){

    name="PassTheCert"
    dir="$P_Dir/PassTheCert"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/AlmondOffSec/PassTheCert.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        chmod +x $dir/Python/passthecert.py 2>/dev/null
        ln -sf $dir/Python/passthecert.py /usr/local/bin/passthecert 2>/dev/null
    fi

}

# ===================== Install targetedKerberoast =====================
Pentest_targetedKerberoast_Install(){

    name="targetedKerberoast"
    dir="$P_Dir/targetedKerberoast"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/ShutdownRepo/targetedKerberoast.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        cd $dir && Install_Switch7 "requirements.txt" 2>/dev/null
        chmod +x $dir/targetedKerberoast.py 2>/dev/null
        ln -sf $dir/targetedKerberoast.py /usr/local/bin/targetedKerberoast 2>/dev/null
    fi

}

# ===================== Install noPac =====================
Pentest_noPac_Install(){

    name="noPac"
    dir="$P_Dir/noPac"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/Ridter/noPac.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        cd $dir && Install_Switch7 "requirements.txt" 2>/dev/null
        chmod +x $dir/noPac.py 2>/dev/null
        ln -sf $dir/noPac.py /usr/local/bin/noPac 2>/dev/null
    fi

}

# ===================== Install zerologon =====================
Pentest_zerologon_Install(){

    name="zerologon"
    dir="$P_Dir/CVE-2020-1472"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/dirkjanm/CVE-2020-1472.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        chmod +x $dir/cve-2020-1472-exploit.py 2>/dev/null
        ln -sf $dir/cve-2020-1472-exploit.py /usr/local/bin/zerologon 2>/dev/null
    fi

}

# ===================== Install lsassy =====================
Pentest_lsassy_Install(){

    name="lsassy"

    which lsassy > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "lsassy"
        which lsassy > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install DonPAPI =====================
Pentest_DonPAPI_Install(){

    name="DonPAPI"

    which donpapi > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        # lxml 需要 C 编译依赖
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "libxml2-dev"
                Install_Switch "libxslt1-dev"
                ;;
            *) ;;
        esac

        Install_Switch8 "donpapi"
        which donpapi > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install pywhisker =====================
Pentest_pywhisker_Install(){

    name="pywhisker"
    dir="$P_Dir/pywhisker"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/ShutdownRepo/pywhisker.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        cd $dir && python3 -m pip install . ${pip_option} 2>/dev/null
        which pywhisker > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name to PATH" || {
            chmod +x $dir/pywhisker/pywhisker.py 2>/dev/null
            ln -sf $dir/pywhisker/pywhisker.py /usr/local/bin/pywhisker 2>/dev/null
        }
    fi

}

# ===================== Install DFSCoerce =====================
Pentest_DFSCoerce_Install(){

    name="DFSCoerce"
    dir="$P_Dir/DFSCoerce"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/Wh04m1001/DFSCoerce.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        chmod +x $dir/dfscoerce.py 2>/dev/null
        ln -sf $dir/dfscoerce.py /usr/local/bin/dfscoerce 2>/dev/null
    fi

}

# ===================== Install ShadowCoerce =====================
Pentest_ShadowCoerce_Install(){

    name="ShadowCoerce"
    dir="$P_Dir/ShadowCoerce"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/ShutdownRepo/ShadowCoerce.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        chmod +x $dir/shadowcoerce.py 2>/dev/null
        ln -sf $dir/shadowcoerce.py /usr/local/bin/shadowcoerce 2>/dev/null
    fi

}

# ===================== Install GPOwned =====================
Pentest_GPOwned_Install(){

    name="GPOwned"
    dir="$P_Dir/GPOwned"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/X-C3LL/GPOwned.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
        chmod +x $dir/GPOwned.py 2>/dev/null
        ln -sf $dir/GPOwned.py /usr/local/bin/gpowned 2>/dev/null
    fi

}

# ===================== Install gpp-decrypt =====================
Pentest_gpp_decrypt_Install(){

    name="gpp-decrypt"

    which gpp-decrypt > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch8 "gpp-decrypt"
        which gpp-decrypt > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install PowerSharpPack =====================
Pentest_PowerSharpPack_Install(){

    name="PowerSharpPack"
    dir="$P_Dir/PowerSharpPack"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/S3cur3Th1sSh1t/PowerSharpPack.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR "Failed to download $name from github"
    fi

}

# ===================== Install Exegol =====================
Pentest_Exegol_Install(){

    name="Exegol"

    which exegol > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        # Install_Switch5 "exegol"
        pipx ensurepath
        pipx install exegol && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install john =====================
Pentest_john_Install(){

    name="john"

    which john > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "john"

                which john > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install ldapsearch =====================
Pentest_ldapsearch_Install(){

    name="ldapsearch"

    which ldapsearch > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "ldap-utils"

                which ldapsearch > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install evil-winrm =====================
Pentest_evil_winrm_Install(){

    name="evil-winrm"

    which evil-winrm > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        gem install evil-winrm > /dev/null 2>&1 || Echo_ERROR3
        which evil-winrm > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install @playwright/mcp =====================
Pentest_playwright_mcp_Install(){

    name="@playwright/mcp"

    npm list -g @playwright/mcp > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        npm install -g @playwright/mcp
        npm list -g @playwright/mcp && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
        # 安装浏览器（@playwright/mcp 需要 chrome-for-testing）
        # npx -y playwright install --with-deps chrome
        npx playwright install chromium
    fi

}

# ===================== Install Claude Code =====================
Pentest_claude_code_Install(){

    name="Claude Code"

    which claude > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        npm install -g @anthropic-ai/claude-code
        which claude > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install hashcat、7z2hashcat =====================
Pentest_hashcat_Install(){

    name="hashcat"
    dir="$P_Dir/hashcat${hashcat_Version}"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        rm -rf /usr/sbin/hashcat
        mkdir -p $dir
        mkdir -p /tmp/hashcat && cd /tmp && rm -f $hashcat_File && $Proxy_OK wget ${GitProxy}https://github.com/hashcat/hashcat/releases/download/$hashcat_Version/$hashcat_File > /dev/null 2>&1 || Echo_ERROR2
        7za x $hashcat_File -o/tmp/hashcat > /dev/null 2>&1
        cp -a /tmp/hashcat/hashcat-*/* "$dir"/
        cd $dir && chmod +x hashcat.bin && cp hashcat.bin hashcat
        ln -s $dir/hashcat /usr/sbin/hashcat > /dev/null 2>&1
        which hashcat > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
        rm -rf /tmp/hashcat && cd /tmp
    fi

    if test -e $P_Dir/7z2hashcat.pl
    then
        Echo_ALERT "7z2hashcat is already installed in $P_Dir"
    else
        name="7z2hashcat"
        $Proxy_OK curl -o $P_Dir/7z2hashcat.pl ${GitProxy}https://raw.githubusercontent.com/philsmd/7z2hashcat/master/7z2hashcat.pl > /dev/null 2>&1 && Echo_INFOR "Downloaded 7z2hashcat.pl in the $P_Dir" || Echo_ERROR2

    fi

}

# ===================== Install ZoomEye-python =====================
Pentest_ZoomEye_Install(){

    name="ZoomEye-python"
    which zoomeye > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "zoomeye"
    fi

}

# ===================== Install jadx =====================
Pentest_jadx_Install(){

    name="jadx"
    which jadx > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /usr/local/jadx && cd /usr/local/jadx && rm -f $jadx_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/skylot/jadx/releases/download/$jadx_Ver/$jadx_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $jadx_bin > /dev/null 2>&1
        chmod +x /usr/local/jadx/bin/jadx && ln -s /usr/local/jadx/bin/jadx /usr/local/bin/jadx && rm -f /usr/local/$jadx_bin > /dev/null 2>&1
        which jadx > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $jadx_Ver in the /usr/local/jadx/" || Echo_ERROR3

    fi

}

# ===================== Install ncat =====================
Pentest_ncat_Install(){

    name="ncat"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Echo_INFOR "Installed when nmap was installed $name"
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            ncat --version > /dev/null 2>&1

            if [ $? == 0 ]
            then
                Echo_ALERT "$name installed"
            else
                Rm_Lock
                Install_Switch "ncat"
                Echo_INFOR "If there is no response for a long time, please press enter manually"
                update-alternatives --set nc /usr/bin/ncat >/dev/null 2>&1 && Echo_INFOR "The default nc is configured as /usr/bin/ncat" || Echo_ERROR "Set default nc to /usr/bin/ncat Failed"
            fi

            ;;
        *) ;;
    esac

}

# ===================== Install Platypus =====================
Pentest_Platypus_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            Platypus_bin=$Platypus_bin_amd64
            ;;
        *"linux-arm64"*)
            Platypus_bin=$Platypus_bin_arm64
            ;;
    esac

    name="Platypus"
    which Platypus > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/Platypus && cd /tmp/Platypus && $Proxy_OK wget ${GitProxy}https://github.com/WangYihang/Platypus/releases/download/${Platypus_Ver}/${Platypus_bin} > /dev/null 2>&1 || Echo_ERROR2
        mv ${Platypus_bin} /usr/local/bin/Platypus && chmod +x /usr/local/bin/Platypus
        which Platypus > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${Platypus_Ver} in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/Platypus && cd /tmp
    fi

}

# ===================== Install MoreFind =====================
Pentest_MoreFind_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            MoreFind_bin=$MoreFind_bin_amd64
            ;;
        *"linux-arm64"*)
            MoreFind_bin=$MoreFind_bin_arm64
            ;;
    esac

    name="MoreFind"
    which MoreFind > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/MoreFind && cd /tmp/MoreFind && $Proxy_OK wget ${GitProxy}https://github.com/mstxq17/MoreFind/releases/download/$MoreFind_Ver/$MoreFind_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $MoreFind_bin > /dev/null 2>&1
        mv --force MoreFind /usr/local/bin/MoreFind && chmod +x /usr/local/bin/MoreFind
        which MoreFind > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $MoreFind_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/MoreFind && cd /tmp
    fi

}

# ===================== Install alterx =====================
Pentest_alterx_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            alterx_bin=$alterx_bin_amd64
            ;;
        *"linux-arm64"*)
            alterx_bin=$alterx_bin_arm64
            ;;
    esac

    name="alterx"
    which alterx > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/alterx && cd /tmp/alterx && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/alterx/releases/download/$alterx_Ver/$alterx_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $alterx_bin > /dev/null 2>&1
        mv --force alterx /usr/local/bin/alterx && chmod +x /usr/local/bin/alterx
        alterx -version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $alterx_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/alterx && cd /tmp
    fi

}

# ===================== Install mapcidr =====================
Pentest_mapcidr_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            mapcidr_bin=$mapcidr_bin_amd64
            ;;
        *"linux-arm64"*)
            mapcidr_bin=$mapcidr_bin_arm64
            ;;
    esac

    name="mapcidr"
    which mapcidr > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/mapcidr && cd /tmp/mapcidr && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/mapcidr/releases/download/$mapcidr_Ver/$mapcidr_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $mapcidr_bin > /dev/null 2>&1
        mv --force mapcidr /usr/local/bin/mapcidr && chmod +x /usr/local/bin/mapcidr
        mapcidr -version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $mapcidr_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/mapcidr && cd /tmp
    fi

}

# ===================== Install dnsx =====================
Pentest_dnsx_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            dnsx_bin=$dnsx_bin_amd64
            ;;
        *"linux-arm64"*)
            dnsx_bin=$dnsx_bin_arm64
            ;;
    esac

    name="dnsx"
    which dnsx > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/dnsx && cd /tmp/dnsx && rm -f $dnsx_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/dnsx/releases/download/$dnsx_Ver/$dnsx_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $dnsx_bin > /dev/null 2>&1
        mv --force dnsx /usr/local/bin/dnsx && chmod +x /usr/local/bin/dnsx
        which dnsx > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $dnsx_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/dnsx && cd /tmp
    fi

}

# ===================== Install uncover =====================
Pentest_uncover_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            uncover_bin=$uncover_bin_amd64
            ;;
        *"linux-arm64"*)
            uncover_bin=$uncover_bin_arm64
            ;;
    esac

    name="uncover"
    which uncover > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/uncover && cd /tmp/uncover && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/uncover/releases/download/$uncover_Ver/$uncover_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $uncover_bin > /dev/null 2>&1
        mv --force uncover /usr/local/bin/uncover && chmod +x /usr/local/bin/uncover
        which uncover > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $uncover_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/uncover && cd /tmp
    fi

}

# ===================== Install nali =====================
Pentest_nali_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            nali_bin=$nali_bin_amd64
            ;;
        *"linux-arm64"*)
            nali_bin=$nali_bin_arm64
            ;;
    esac

    name="nali"
    which nali > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/nali && cd /tmp/nali && $Proxy_OK wget ${GitProxy}https://github.com/zu1k/nali/releases/download/$nali_Ver/$nali_bin > /dev/null 2>&1 || Echo_ERROR2
        gunzip $nali_bin > /dev/null 2>&1
        mv nali-linux-* /usr/local/bin/nali && chmod +x /usr/local/bin/nali
        which nali > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $nali_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/nali && cd /tmp
    fi

}

# ===================== Install anew =====================
Pentest_anew_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            anew_bin=$anew_bin_amd64
            ;;
        *"linux-arm64"*)
            anew_bin=$anew_bin_arm64
            ;;
    esac

    name="anew"
    which anew  > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/anew && cd /tmp/anew && $Proxy_OK wget ${GitProxy}https://github.com/No-Github/anew/releases/download/$anew_Ver/$anew_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -xzvf ${anew_bin} > /dev/null
        mv anew /usr/local/bin/anew && chmod +x /usr/local/bin/anew
        which anew > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $anew_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/anew && cd /tmp
    fi

}

# ===================== Install gron =====================
Pentest_gron_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            gron_bin=$gron_bin_amd64
            ;;
        *"linux-arm64"*)
            gron_bin=$gron_bin_arm64
            ;;
    esac

    name="gron"
    which gron > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/gron && cd /tmp/gron && rm -f ${gron_bin} > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/tomnomnom/gron/releases/download/${gron_Ver}/${gron_bin} > /dev/null 2>&1 || Echo_ERROR2
        tar -xzvf ${gron_bin} > /dev/null 2>&1
        mv /tmp/gron/gron /usr/local/bin/gron && chmod +x /usr/local/bin/gron
        which gron > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${gron_Ver} in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/gron && cd /tmp
    fi

}

# ===================== Install unfurl =====================
Pentest_unfurl_Install(){

    name="unfurl"
    which unfurl > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/unfurl && cd /tmp/unfurl && rm -f ${unfurl_Bin} > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/tomnomnom/unfurl/releases/download/${unfurl_Ver}/${unfurl_Bin} > /dev/null 2>&1 || Echo_ERROR2
                tar -xzvf ${unfurl_Bin} > /dev/null 2>&1
                mv /tmp/unfurl/unfurl /usr/local/bin/unfurl && chmod +x /usr/local/bin/unfurl
                rm -rf /tmp/unfurl && cd /tmp
                which unfurl > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${unfurl_Ver} in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                mkdir -p /tmp/unfurl && cd /tmp/unfurl && go install github.com/tomnomnom/unfurl@latest
                mv $GOPATH/bin/unfurl /usr/local/bin/unfurl && chmod +x /usr/local/bin/unfurl || { mv /root/go/bin/unfurl /usr/local/bin/unfurl; chmod +x /usr/local/bin/unfurl; }
                rm -rf /tmp/unfurl && cd /tmp
                which unfurl > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install qsreplace =====================
Pentest_qsreplace_Install(){

    name="qsreplace"
    which qsreplace > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/qsreplace && cd /tmp/qsreplace && rm -f ${qsreplace_bin} > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/tomnomnom/qsreplace/releases/download/${qsreplace_Ver}/${qsreplace_bin} > /dev/null 2>&1 || Echo_ERROR2
                tar -xzvf ${qsreplace_bin} > /dev/null 2>&1
                mv /tmp/qsreplace/qsreplace /usr/local/bin/qsreplace && chmod +x /usr/local/bin/qsreplace
                rm -rf /tmp/qsreplace && cd /tmp
                which qsreplace > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${qsreplace_Ver} in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                mkdir -p /tmp/qsreplace && cd /tmp/qsreplace && go install github.com/tomnomnom/qsreplace@latest
                mv $GOPATH/bin/qsreplace /usr/local/bin/qsreplace && chmod +x /usr/local/bin/qsreplace || { mv /root/go/bin/qsreplace /usr/local/bin/qsreplace; chmod +x /usr/local/bin/qsreplace; }
                rm -rf /tmp/qsreplace && cd /tmp
                which qsreplace > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install Interlace =====================
Pentest_Interlace_Install(){

    name="Interlace"
    which interlace > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/interlace && cd /tmp/interlace && rm -rf Interlace
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/codingo/Interlace.git > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
        cd Interlace && $Proxy_OK python3 setup.py install > /dev/null 2>&1
        rm -rf /tmp/interlace && cd /tmp
        which interlace > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install sttr =====================
Pentest_sttr_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            sttr_bin=$sttr_bin_amd64
            ;;
        *"linux-arm64"*)
            sttr_bin=$sttr_bin_arm64
            ;;
    esac

    name="sttr"
    which sttr > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/sttr && cd /tmp/sttr && rm -f $sttr_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/abhimanyu003/sttr/releases/download/$sttr_Ver/$sttr_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $sttr_bin > /dev/null 2>&1
        mv --force sttr /usr/local/bin/ && chmod +x /usr/local/bin/sttr
        rm -rf /tmp/sttr && cd /tmp
        which sttr > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $sttr_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# 体积太大,默认放 E 分类
# ===================== SecLists =====================
Pentest_SecLists_Install(){

    name="SecLists"

    if test -d $P_Dir/$name
    then
        Echo_ALERT "$name dictionary already exists"
    else
        rm -rf $P_Dir/$name > /dev/null 2>&1 && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/danielmiessler/SecLists.git $P_Dir/$name > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $P_Dir/$name" || Echo_ERROR "Failed to download the $name dictionary from github"
    fi

}

# ===================== Install See-SURF =====================
Pentest_See-SURF_Install(){

    name="See-SURF"
    dir="$P_Dir/See-SURF"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/In3tinct/See-SURF.git $dir > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
        cd $dir && python3 see-surf.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# ===================== Install subjs =====================
Pentest_subjs_Install(){

    name="subjs"
    which subjs > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/subjs && cd /tmp/subjs && rm -f $subjs_bin && $Proxy_OK wget ${GitProxy}https://github.com/lc/subjs/releases/download/$subjs_Ver/$subjs_bin > /dev/null 2>&1 || Echo_ERROR2
                tar -zxvf $subjs_bin > /dev/null 2>&1
                mv subjs /usr/local/bin/subjs && chmod +x /usr/local/bin/subjs
                rm -rf /tmp/subjs && cd /tmp
                which subjs > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $subjs_Ver in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                mkdir -p /tmp/subjs && cd /tmp/subjs && go install github.com/lc/subjs@latest
                mv $GOPATH/bin/subjs /usr/local/bin/subjs && chmod +x /usr/local/bin/subjs || { mv /root/go/bin/subjs /usr/local/bin/subjs; chmod +x /usr/local/bin/subjs; }
                rm -rf /tmp/subjs && cd /tmp
                which subjs > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install assetfinder =====================
Pentest_assetfinder_Install(){

    name="assetfinder"
    which assetfinder > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                mkdir -p /tmp/assetfinder && cd /tmp/assetfinder && rm -f $assetfinder_bin && $Proxy_OK wget ${GitProxy}https://github.com/tomnomnom/assetfinder/releases/download/$assetfinder_Ver/$assetfinder_bin > /dev/null 2>&1 || Echo_ERROR2
                tar -xzvf $assetfinder_bin > /dev/null 2>&1
                mv assetfinder /usr/local/bin/assetfinder && chmod +x /usr/local/bin/assetfinder
                rm -rf /tmp/assetfinder && cd /tmp
                which assetfinder > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $assetfinder_Ver in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                mkdir -p /tmp/assetfinder && cd /tmp/assetfinder && go install github.com/tomnomnom/assetfinder@latest
                mv $GOPATH/bin/assetfinder /usr/local/bin/assetfinder && chmod +x /usr/local/bin/assetfinder || { mv /root/go/bin/assetfinder /usr/local/bin/assetfinder; chmod +x /usr/local/bin/assetfinder; }
                rm -rf /tmp/assetfinder && cd /tmp
                which assetfinder > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# ===================== Install hakrawler =====================
Pentest_hakrawler_Install(){

    GO_Check

    name="hakrawler"
    which hakrawler > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Echo_INFOR "Local compilation and installation, if the compilation timeout, please deal with it yourself"
        mkdir -p /tmp/hakrawler && cd /tmp/hakrawler && rm -rf hakrawler
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/hakluke/hakrawler.git > /dev/null 2>&1 && cd hakrawler || Echo_ERROR2
        go build hakrawler.go
        mv hakrawler /usr/local/bin/hakrawler && chmod +x /usr/local/bin/hakrawler
        rm -rf /tmp/hakrawler && cd /tmp
        which hakrawler > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
    fi

}

Pentest_simplehttpservert_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            simplehttpserver_bin=$simplehttpserver_bin_amd64
            ;;
        *"linux-arm64"*)
            simplehttpserver_bin=$simplehttpserver_bin_arm64
            ;;
    esac

    name="simplehttpserver"
    which simplehttpserver > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/simplehttpserver && cd /tmp/simplehttpserver && rm -f $simplehttpserver_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/simplehttpserver/releases/download/$simplehttpserver_Ver/$simplehttpserver_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $simplehttpserver_bin > /dev/null 2>&1
        mv --force simplehttpserver /usr/local/bin/simplehttpserver && chmod +x /usr/local/bin/simplehttpserver
        rm -rf /tmp/simplehttpserver && cd /tmp
        which simplehttpserver > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $simplehttpserver_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# git clone 时间过长,默认不安装
# ===================== Install exploitdb 库 =====================
Pentest_exploitdb_Install(){

    name="exploitdb"
    dir="$P_Dir/exploitdb"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/offensive-security/exploitdb.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
    fi

}

# 不友好的 wiki 和使用帮助
# ===================== Install RustScan =====================
Pentest_RustScan_Install(){

    name="RustScan"
    which rustscan > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                rm -f /var/cache/dnf/metadata_lock.pid > /dev/null 2>&1
                $Proxy_OK dnf install -y 'dnf-command(copr)' > /dev/null 2>&1 && $Proxy_OK dnf copr enable atim/rustscan -y > /dev/null 2>&1 && $Proxy_OK dnf install -y rustscan > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
            RustScan_bin
                mkdir -p /tmp/rustscan && cd /tmp/rustscan
                rm -f $RustScan_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/RustScan/RustScan/releases/download/$RustScan_Version/$RustScan_bin > /dev/null 2>&1 || Echo_ERROR2
                unzip $RustScan_bin > /dev/null 2>&1
                dpkg -i $RustScan_Install > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
                rm -rf /tmp/rustscan && cd /tmp
                ;;
            *) ;;
        esac

    fi

}

# ===================== Install unyaffs =====================
unyaffs_Install(){

    name="unyaffs"

    cd $T_Dir && rm -f unyaffs > /dev/null 2>&1 && $Proxy_OK wget -O unyaffs ${GitProxy2}https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/unyaffs/unyaffs > /dev/null 2>&1 || Echo_ERROR2
    mv --force unyaffs /usr/local/bin/unyaffs && chmod +x /usr/local/bin/unyaffs && Echo_INFOR "Successfully installed $name 在 /usr/local/bin/" || Echo_ERROR3

}

# ===================== Install Fail2Ban =====================
Secure_Fail2Ban_Install(){

    name="Fail2Ban"
    fail2ban-client -V > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        Install_Switch "fail2ban"
        systemctl restart fail2ban > /dev/null 2>&1 && sleep 1.5
        fail2ban-client ping
    fi

}

# ===================== Install rkhunter =====================
Secure_rkhunter_Install(){

    name="rkhunter"
    which rkhunter > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        Install_Switch "rkhunter"
    fi

}

# ===================== Install shellpub =====================
Secure_shellpub_Install(){

    name="shellpub"

    if test -d $T_Dir/hm
    then
        Echo_ALERT "$name is already installed in $T_Dir/hm"
    else
        mkdir -p $T_Dir/hm && cd $_ && $Proxy_OK wget -O hm-linux.tgz http://dl.shellpub.com/hm/latest/hm-linux-amd64.tgz?version=1.8.2 > /dev/null 2>&1 && Echo_INFOR "Downloaded shellpub" || Echo_ERROR2
        tar -zxvf hm-linux.tgz > /dev/null 2>&1 && rm -f hm-linux.tgz > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $T_Dir/hm" || Echo_ERROR3
    fi

}

# ===================== Install anti-portscan =====================
Secure_anti_portscan_Install(){

    name="anti-portscan"

    if test -d $T_Dir/anti-portscan
    then
        Echo_ALERT "$name is already installed in $T_Dir/anti-portscan"
    else
        cd $T_Dir && rm -f anti-portscan > /dev/null 2>&1 && $Proxy_OK git clone ${GitProxy}https://github.com/EtherDream/anti-portscan.git > /dev/null 2>&1 && Echo_INFOR "Downloaded anti-portscan in the $T_Dir/anti-portscan" || Echo_ERROR2
    fi

}

# ===================== Install BruteShark =====================
Secure_BruteShark_Install(){

    name="BruteShark"
    dir="$T_Dir/BruteShark"

    if test -d $T_Dir/BruteShark
    then
        Echo_ALERT "$name is already installed in $T_Dir/ "
    else
        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "libpcap"
                Install_Switch "libpcap-devel"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "libpcap-dev"
                ;;
            *) ;;
        esac
        mkdir -p $T_Dir/BruteShark && cd $_ && $Proxy_OK wget ${GitProxy}https://github.com/odedshimon/BruteShark/releases/latest/download/BruteSharkCli > /dev/null 2>&1 && chmod +x BruteSharkCli && Echo_INFOR "Downloaded $name in the $dir " || Echo_ERROR2
        find /usr/lib/x86_64-linux-gnu -type f | grep libpcap | head -1 | xargs -i sudo ln -s {} /usr/lib/x86_64-linux-gnu/libpcap.so > /dev/null 2>&1
    fi

}

# ===================== Install vlmcsd =====================
vlmcsd_Install(){

    name="vlmcsd"

    if test -d $T_Dir/vlmcsd
    then
        Echo_ALERT "$name is already installed in $T_Dir/vlmcsd"
    else
        cd $T_Dir && rm -f binaries.tar.gz > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/Wind4/vlmcsd/releases/download/svn1113/binaries.tar.gz > /dev/null 2>&1 || Echo_ERROR2
        tar -xzvf binaries.tar.gz > /dev/null 2>&1
        mv --force binaries vlmcsd && rm -f binaries.tar.gz > /dev/null 2>&1 && Echo_INFOR "$name is already installed in $T_Dir/vlmcsd, the vlmcsd service can be run with the following command:\ncd $T_Dir/vlmcsd/Linux/intel/static && ./vlmcsd-x86-musl-static"
    fi

}

# ===================== Install AdGuardHome =====================
AdGuardHome_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            AdGuardHome_File=$AdGuardHome_File_amd64
            ;;
        *"linux-arm64"*)
            AdGuardHome_File=$AdGuardHome_File_arm64
            ;;
    esac

    name="AdGuardHome"

    if test -d $T_Dir/AdGuardHome
    then
        Echo_ALERT "AdGuardHome is already installed in $T_Dir/AdGuardHome"
    else
        cd $T_Dir && rm -f $AdGuardHome_File > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/AdguardTeam/AdGuardHome/releases/download/$AdGuardHome_Version/$AdGuardHome_File > /dev/null 2>&1 || Echo_ERROR2
        tar -xzvf $AdGuardHome_File > /dev/null 2>&1 && rm -f $AdGuardHome_File > /dev/null 2>&1
        cd AdGuardHome && Echo_INFOR "Successfully installed $name $AdGuardHome_Version , run the following command to enable the AdGuardHome service\n\033[0m\033[1;32mcd $T_Dir/AdGuardHome && ./AdGuardHome -s install" || Echo_ERROR3
    fi

}

# ===================== Install trash-cli =====================
trash-cli_Install(){

    name="trash-cli"
    trash-list --version > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        pip3 install trash-cli > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install thefuck =====================
thefuck_Install(){

    name="thefuck"
    which thefuck > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch4 "thefuck"
    fi

}

# ===================== Install fzf =====================
fzf_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            fzf_bin=$fzf_bin_amd64
            ;;
        *"linux-arm64"*)
            fzf_bin=$fzf_bin_arm64
            ;;
    esac

    name="fzf"
    which fzf > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/fzf && cd /tmp/fzf && rm -f $fzf_bin && $Proxy_OK wget ${GitProxy}https://github.com/junegunn/fzf/releases/download/$fzf_Ver/$fzf_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $fzf_bin > /dev/null 2>&1 && mv fzf /usr/local/bin/fzf && chmod +x /usr/local/bin/fzf
        rm -rf /tmp/fzf && cd /tmp
        fzf --version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# ===================== Install lux =====================
lux_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            lux_bin=$lux_bin_amd64
            ;;
        *"linux-arm64"*)
            lux_bin=$lux_bin_arm64
            ;;
    esac

    name="lux"
    which lux > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/lux && cd /tmp/lux && rm -f $lux_bin && $Proxy_OK wget ${GitProxy}https://github.com/iawia002/lux/releases/download/$lux_Ver/$lux_bin > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $lux_bin > /dev/null 2>&1
        mv --force lux /usr/local/bin/lux && chmod +x /usr/local/bin/lux
        rm -rf /tmp/lux && cd /tmp
        lux -v > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $lux_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install you-get =====================
you-get_Install(){

    name="you-get"
    which you-get > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch4 "you-get"
    fi

}

# ===================== Install ffmpeg =====================
ffmpeg_Install(){

    name="ffmpeg"
    which ffmpeg > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Echo_INFOR "The current script does not support RedHat system, this item Pass"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "ffmpeg"
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install aria2 =====================
aria2_Install(){

    name="aria2"
    which aria2c > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        Install_Switch "aria2"
    fi

    Echo_INFOR "Recommended Projects : https://github.com/P3TERX/aria2.sh"
    Echo_INFOR "wget -N git.io/aria2.sh && chmod +x aria2.sh && bash aria2.sh"

}

# ===================== Install filebrowser =====================
filebrowser_Install(){

    name="filebrowser"
    which filebrowser > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed, Run the following command to turn on the service:"
    else
        mkdir -p /tmp/filebrowser && cd /tmp/filebrowser && $Proxy_OK curl -o install.sh https://raw.githubusercontent.com/filebrowser/get/master/get.sh > /dev/null 2>&1 && $Proxy_OK bash install.sh > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name, Run the following command to turn on the service:" || Echo_ERROR2
    fi

    Echo_INFOR "filebrowser -a [Listening IP] -r [Folder path]" && Echo_INFOR "Default account password admin"

}

# ===================== Install starship =====================
starship_Install(){

    name="starship"
    starship --version > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/starship && cd /tmp/starship && rm -f install.sh && $Proxy_OK curl -o install.sh https://starship.rs/install.sh > /dev/null 2>&1 && $Proxy_OK bash install.sh && Echo_INFOR "Successfully installed $name" || Echo_ERROR2
        rm -rf /tmp/starship && cd /tmp
    fi

    Echo_INFOR "Bash :  echo \"eval \\\"\\\$(starship init bash)\\\"\" >> ~/.bashrc"
    Echo_INFOR "Fish :  echo \"starship init fish | source\" >> ~/.config/fish/config.fish"
    Echo_INFOR "Zsh  :  echo \"eval \\\"\\\$(starship init zsh)\\\"\" >> ~/.zshrc"

}

# ===================== Install ttyd =====================
ttyd_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            ttyd_bin=$ttyd_bin_amd64
            ;;
        *"linux-arm64"*)
            ttyd_bin=$ttyd_bin_arm64
            ;;
    esac

    name="ttyd"
    which ttyd > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        $Proxy_OK wget -O /usr/local/bin/ttyd ${GitProxy}https://github.com/tsl0922/ttyd/releases/download/$ttyd_Ver/$ttyd_bin > /dev/null 2>&1 || Echo_ERROR2
        chmod +x /usr/local/bin/ttyd
        which ttyd > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $ttyd_Ver in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# ===================== Install duf =====================
duf_Install(){

    name="duf"
    which duf > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)

                case $Linux_architecture_Name in
                    *"linux-x86_64"*)
                        duf_bin1=$duf_bin1_amd64
                        ;;
                    *"linux-arm64"*)
                        duf_bin1=$duf_bin1_arm64
                        ;;
                esac

                mkdir -p /tmp/dufinstall && cd $_ && $Proxy_OK wget ${GitProxy}https://github.com/muesli/duf/releases/download/$duf_Ver/$duf_bin1 > /dev/null 2>&1 || Echo_ERROR2
                rpm -i $duf_bin1 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $duf_Ver" || Echo_ERROR3
                rm -rf /tmp/dufinstall && cd /tmp
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)

                case $Linux_architecture_Name in
                    *"linux-x86_64"*)
                        duf_bin2=$duf_bin2_amd64
                        ;;
                    *"linux-arm64"*)
                        duf_bin2=$duf_bin2_arm64
                        ;;
                esac

                mkdir -p /tmp/dufinstall && cd $_ && $Proxy_OK wget ${GitProxy}https://github.com/muesli/duf/releases/download/$duf_Ver/$duf_bin2 > /dev/null 2>&1 || Echo_ERROR2
                dpkg -i $duf_bin2 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $duf_Ver" || Echo_ERROR3
                rm -rf /tmp/dufinstall && cd /tmp
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install yq =====================
yq_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            yq_File=$yq_File_amd64
            yq_bin=$yq_bin_amd64
            ;;
        *"linux-arm64"*)
            yq_File=$yq_File_arm64
            yq_bin=$yq_bin_arm64
            ;;
    esac

    name="yq"
    which yq > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/yqinstall && cd $_
        $Proxy_OK wget ${GitProxy}https://github.com/mikefarah/yq/releases/download/$yq_Ver/$yq_File > /dev/null 2>&1 || Echo_ERROR2
        tar -zxvf $yq_File > /dev/null 2>&1
        mv --force $yq_bin /usr/local/bin/yq && chmod +x /usr/local/bin/yq
        which yq > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $yq_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/yqinstall && cd /tmp
    fi

}

# ===================== Install procs =====================
procs_Install(){

    name="procs"
    which procs > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/procsinstall && cd $_
        $Proxy_OK wget ${GitProxy}https://github.com/dalance/procs/releases/download/$procs_Ver/$procs_bin > /dev/null 2>&1 || Echo_ERROR2
        unzip $procs_bin > /dev/null 2>&1
        mv --force procs /usr/local/bin/procs && chmod +x /usr/local/bin/procs
        which procs > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $procs_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/procsinstall && cd /tmp
    fi

}

# ===================== Install ncdu =====================
ncdu_Install(){

    name="ncdu"
    which ncdu > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "ncdu"
    fi

}

# ===================== Install exa =====================
exa_Install(){

    name="exa"
    which exa > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "exa"
    fi

}

# ===================== Install htop =====================
htop_Install(){

    name="htop"
    which htop > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch "htop"
    fi

}

# ===================== Install bat =====================
bat_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            bat_bin=$bat_bin_amd64
            ;;
        *"linux-arm64"*)
            bat_bin=$bat_bin_arm64
            ;;
    esac

    name="bat"
    which bat > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/batinstall && cd $_
        $Proxy_OK wget ${GitProxy}https://github.com/sharkdp/bat/releases/download/$bat_Ver/$bat_bin > /dev/null 2>&1 || Echo_ERROR2
        dpkg -i $bat_bin > /dev/null 2>&1
        which bat > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $bat_Ver" || Echo_ERROR3
        rm -rf /tmp/batinstall && cd /tmp
    fi

}

# ===================== Install fd =====================
fd_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            fd_bin=$fd_bin_amd64
            ;;
        *"linux-arm64"*)
            fd_bin=$fd_bin_arm64
            ;;
    esac

    name="fd"
    which fd > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/fdinstall && cd $_
        $Proxy_OK wget ${GitProxy}https://github.com/sharkdp/fd/releases/download/$fd_Ver/$fd_bin > /dev/null 2>&1 || Echo_ERROR2
        dpkg -i $fd_bin > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $fd_Ver" || Echo_ERROR3
        rm -rf /tmp/fdinstall && cd /tmp
    fi

}

# ===================== Install ctop =====================
ctop_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            ctop_bin=$ctop_bin_amd64
            ;;
        *"linux-arm64"*)
            ctop_bin=$ctop_bin_arm64
            ;;
    esac

    name="ctop"
    which ctop > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/ctop && cd $_
        $Proxy_OK wget ${GitProxy}https://github.com/bcicen/ctop/releases/download/$ctop_Ver/$ctop_bin > /dev/null 2>&1 || Echo_ERROR2
        mv /tmp/ctop/$ctop_bin /usr/local/bin/ctop && chmod +x /usr/local/bin/ctop && rm -rf /tmp/ctop
        which ctop > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $ctop_Ver" || Echo_ERROR3
        rm -rf /tmp/ctop && cd /tmp
    fi

}

# -code
# ===================== Install code-server =====================
code-server_Install(){

    name="code-server"
    which code-server > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                case $Linux_architecture_Name in
                    *"linux-x86_64"*)
                        code_server_bin1=$code_server_bin1_amd64
                        ;;
                    *"linux-arm64"*)
                        code_server_bin1=$code_server_bin1_arm64
                        ;;
                esac

                mkdir -p /tmp/code-serverinstall && cd $_ && $Proxy_OK wget ${GitProxy}https://github.com/cdr/code-server/releases/download/$code_server_Ver/$code_server_bin1 ${wget_option} || Echo_ERROR2
                rpm -i $code_server_bin1 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $code_server_Ver" || Echo_ERROR3
                rm -rf /tmp/code-serverinstall && cd /tmp
                # sudo systemctl enable --now code-server@$USER
                # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                case $Linux_architecture_Name in
                    *"linux-x86_64"*)
                        code_server_bin2=$code_server_bin2_amd64
                        ;;
                    *"linux-arm64"*)
                        code_server_bin2=$code_server_bin2_arm64
                        ;;
                esac

                mkdir -p /tmp/code-serverinstall && cd $_ && $Proxy_OK wget ${GitProxy}https://github.com/cdr/code-server/releases/download/$code_server_Ver/$code_server_bin2 ${wget_option} || Echo_ERROR2
                dpkg -i $code_server_bin2 > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $code_server_Ver" || Echo_ERROR3
                rm -rf /tmp/code-serverinstall && cd /tmp
                # sudo systemctl enable --now code-server@$USER
                # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
                ;;
            *) ;;
        esac
    fi

}

# ===================== Install wait-for =====================
wait-for_Install(){

    name="wait-for"
    if test -e $T_Dir/wait-for
    then
        Echo_ALERT "$name is already installed in $T_Dir"
    else
        $Proxy_OK curl -o $T_Dir/wait-for ${GitProxy}https://raw.githubusercontent.com/eficode/wait-for/master/wait-for > /dev/null 2>&1 && Echo_INFOR "Downloaded $name in the $T_Dir" || Echo_ERROR2
    fi

}

# -vol
Volatility_Install(){

    name="Volatility"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    case $Linux_Version in
        *"Ubuntu"*|*"Debian"*)

            which volatility > /dev/null 2>&1

            if [ $? == 0 ]
            then
                Echo_ALERT "$name installed"
            else
                Rm_Lock
                Install_Switch3 "distorm3==3.4.4"
                Install_Switch3 "yara-python"
                Install_Switch "xdot"
                ln -s /usr/local/lib/python2.7/dist-packages/usr/lib/libyara.so /usr/lib/libyara.so > /dev/null 2>&1
                Install_Switch "volatility"
            fi

            ;;
        *)
            if test -d $P_Dir/volatility
            then
                Echo_ALERT "$name is already installed in $P_Dir/volatility"
            else
                Rm_Lock
                case $Linux_Version in
                    *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                        Install_Switch "pcre-devel"
                        Install_Switch "libpcre++-devel"
                        Install_Switch "python-devel"
                        Install_Switch "pycrypto"
                        ;;
                    *) ;;
                esac

                Install_Switch3 "distorm3==3.4.4"
                Install_Switch3 "yara-python"
                ln -s /usr/local/lib/python2.7/dist-packages/usr/lib/libyara.so /usr/lib/libyara.so > /dev/null 2>&1

                $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/volatilityfoundation/volatility.git $P_Dir/volatility > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
                cd $P_Dir/volatility && python setup.py build > /dev/null 2>&1 || Echo_ERROR "Failed to install dependency module"
                python setup.py install > /dev/null 2>&1 || Echo_ERROR "Failed to install dependency module"
                python vol.py --info > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $P_Dir/volatility" || Echo_ERROR3
            fi
            ;;
    esac

}

# -vol3
volatility3_Install(){

    name="volatility3"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -d $P_Dir/volatility3
    then
        Echo_ALERT "$name is already installed in $P_Dir/volatility3"
    else

        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "xdot"
                ;;
            *) ;;
        esac

        $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/volatilityfoundation/volatility3.git $P_Dir/volatility3 > /dev/null 2>&1 && Echo_INFOR "Downloaded $name" || Echo_ERROR2
        cd $P_Dir/volatility3 && python3 setup.py build > /dev/null 2>&1 || Echo_ERROR "Failed to install dependency module"
        python3 setup.py install > /dev/null 2>&1 || Echo_ERROR "Failed to install dependency module"
        python3 vol.py -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $P_Dir/volatility3" || Echo_ERROR3
    fi

    if test -d $P_Dir/volatility3/symbols
    then
        Echo_ALERT "$P_Dir/volatility3/symbols folder already exists"
    else
        Echo_ALERT "Symbol Tables download command is as follows, we suggest you download it by yourself"
        Echo_INFOR "cd /tmp && wget https://downloads.volatilityfoundation.org/volatility3/symbols/windows.zip"
        Echo_INFOR "wget https://downloads.volatilityfoundation.org/volatility3/symbols/mac.zip"
        Echo_INFOR "wget https://downloads.volatilityfoundation.org/volatility3/symbols/linux.zip"
        Echo_INFOR "mkdir -p $P_Dir/volatility3/symbols"
        Echo_INFOR "mv --force /tmp/windows.zip $P_Dir/volatility3/symbols"
        Echo_INFOR "mv --force /tmp/mac.zip $P_Dir/volatility3/symbols"
        Echo_INFOR "mv --force /tmp/linux.zip $P_Dir/volatility3/symbols"
    fi

}

# -lt
lt_Install(){

    Docker_Check
    Docker_Compose_Check
    name="LogonTracer"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    docker pull jpcertcc/docker-logontracer && Echo_INFOR "Pulled the latest LogonTracer image, please run through the following command:\ndocker run --name logontracer --detach -p 7474:7474 -p 7687:7687 -p 8080:8080 -e LTHOSTNAME=[IP_Address] jpcertcc/docker-logontracer\n\n-browser access：http://[IP_Address]:8080/" || Echo_ERROR3

}

# -binwalk
binwalk_Install(){

    name="binwalk"
    which binwalk > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        echo -e "\033[1;33m\n>> Installing binwalk\n\033[0m"
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Echo_INFOR "RedHat system is not recommended to install, this item Pass\n"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Echo_ALERT "Installing binwalk"
                cd $T_Dir && rm -rf binwalk > /dev/null 2>&1 && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/ReFirmLabs/binwalk.git > /dev/null 2>&1 && cd binwalk  > /dev/null 2>&1 || Echo_ERROR2
                $Proxy_OK sudo ./deps.sh && python setup.py uninstall > /dev/null 2>&1 && python setup.py install > /dev/null 2>&1
                binwalk -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" && touch /tmp/f8x_binwalk.txt > /dev/null 2>&1 || Echo_ERROR "binwalk installation failed, recommended to use -binwalk-f for installation"
                echo -e "\033[1;33m\n>> Installing unyaffs\n\033[0m"
                unyaffs_Install
                ;;
            *) ;;
        esac
    fi

}

# -binwalk-f
binwalk_force_Install(){

    name="binwalk"
    which binwalk > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else

        echo -e "\033[1;33m\n>> Installing binwalk\n\033[0m"
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Echo_INFOR "RedHat system is not recommended to install, this item Pass\n"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Rm_Lock
                Install_Switch "python3-pip"
                Install_Switch "python-lzma"
                Install_Switch "python3-crypto"
                Install_Switch "libqt4-opengl"
                Install_Switch "python3-opengl"
                Install_Switch "python3-pyqt4"
                Install_Switch "python3-pyqt4.qtopengl"
                Install_Switch "python3-numpy"
                Install_Switch "python3-scipy"
                Install_Switch "mtd-utils"
                Install_Switch "gzip"
                Install_Switch "bzip2"
                Install_Switch "tar"
                Install_Switch "arj"
                Install_Switch "lhasa"
                Install_Switch "p7zip"
                Install_Switch "p7zip-full"
                Install_Switch "cabextract"
                Install_Switch "cramfsprogs"
                Install_Switch "cramfsswap"
                Install_Switch "squashfs-tools"
                Install_Switch "sleuthkit"
                Install_Switch "default-jdk"
                Install_Switch "lzop"
                Install_Switch "srecord"
                Install_Switch "zlib1g-dev"
                Install_Switch "liblzma-dev"
                Install_Switch "liblzo2-dev"
                Install_Switch "python-lzo"
                pip install cstruct > /dev/null 2>&1 && Echo_INFOR "Successfully installed cstruct" || Echo_ERROR "cstruct installation failed"

                Install_Switch5 "nose"
                Install_Switch5 "coverage"
                Install_Switch5 "pyqtgraph"
                Install_Switch5 "capstone"

                # sasquatch
                name="sasquatch"
                echo -e "\033[1;33m\n>> Installing sasquatch\n\033[0m"
                cd $T_Dir && rm -rf sasquatch > /dev/null 2>&1 && $Proxy_OK git clone ${GitProxy}https://github.com/devttys0/sasquatch > /dev/null 2>&1 && cd sasquatch || Echo_ERROR2
                $Proxy_OK ./build.sh > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3

                # jefferson
                name="jefferson"
                echo -e "\033[1;33m\n>> Installing jefferson\n\033[0m"
                cd $T_Dir && rm -rf jefferson > /dev/null 2>&1 && $Proxy_OK git clone ${GitProxy}https://github.com/sviehb/jefferson > /dev/null 2>&1 && cd jefferson || Echo_ERROR2
                $Proxy_OK python setup.py install > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3

                # ubi_reader
                name="ubi_reader"
                echo -e "\033[1;33m\n>> Installing ubi_reader\n\033[0m"
                cd $T_Dir && rm -rf ubi_reader > /dev/null 2>&1 && $Proxy_OK git clone ${GitProxy}https://github.com/jrspruitt/ubi_reader > /dev/null 2>&1 && cd ubi_reader || Echo_ERROR2
                $Proxy_OK python setup.py install > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3

                # yaffshiv
                name="yaffshiv"
                echo -e "\033[1;33m\n>> Installing yaffshiv\n\033[0m"
                cd $T_Dir && rm -rf yaffshiv > /dev/null 2>&1 && $Proxy_OK git clone ${GitProxy}https://github.com/devttys0/yaffshiv > /dev/null 2>&1 && cd yaffshiv || Echo_ERROR2
                $Proxy_OK python setup.py install > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3

                # unstuff
                name="unstuff"
                echo -e "\033[1;33m\n>> Installing unstuff\n\033[0m"
                cd $T_Dir && $Proxy_OK curl -o stuffit520.611linux-i386.tar.gz ${GitProxy2}https://github.com/No-Github/Archive/releases/download/1.0.7/stuffit520.611linux-i386.tar.gz > /dev/null 2>&1 && tar -zxvf stuffit520.611linux-i386.tar.gz > /dev/null 2>&1
                mv --force bin/unstuff /usr/local/bin/unstuff && chmod +x /usr/local/bin/unstuff && Echo_INFOR "Successfully installed $name" || Echo_ERROR3

                # unyaffs
                name="unyaffs"
                echo -e "\033[1;33m\n>> Installing unyaffs\n\033[0m"
                unyaffs_Install

                # binwalk
                name="binwalk"
                echo -e "\033[1;33m\n>> Installing binwalk\n\033[0m"
                cd $T_Dir && rm -rf binwalk > /dev/null 2>&1 && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/ReFirmLabs/binwalk > /dev/null 2>&1 && cd binwalk || Echo_ERROR2

                python3 setup.py install > /dev/null 2>&1

                binwalk -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" && touch /tmp/f8x_binwalk_force.txt > /dev/null 2>&1 || Echo_ERROR3
                ;;
            *) ;;
        esac

    fi

}

# -clamav
clamav_Install(){

    name="clamav"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    clamscan --version > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "clamav"
                Install_Switch "clamav-update"
                $Proxy_OK freshclam
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "clamav"
                systemctl stop clamav-freshclam.service
                $Proxy_OK freshclam -v
                ;;
            *) ;;
        esac
    fi

}

# -py2
Python2_Install(){

    name="python2"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    python2 -V > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)

                ( (python -h > /dev/null 2>&1 || python2 -h > /dev/null 2>&1) && Echo_INFOR "Successfully installed python2" ) || ( ( (yum install -y python > /dev/null 2>&1 || yum install -y python2 > /dev/null 2>&1) && Echo_INFOR "Successfully installed python2") || Echo_ERROR "python installation failed")

                ( yum install -y python-devel > /dev/null 2>&1 || yum install -y python2-devel > /dev/null 2>&1) && Echo_INFOR "Successfully installed python-devel" || Echo_ERROR "python-devel installation failed"
                yum install -y python2-pip > /dev/null 2>&1 && Echo_INFOR "Successfully installed python2-pip" || { Echo_ERROR "python2-pipinstallation failed, start autorun -pip2-force option"; pip2_Install; }
                ;;
            *"Fedora"*)
                yum install -y python > /dev/null 2>&1
                yum install -y python2 > /dev/null 2>&1 && Echo_INFOR "Successfully installed python2" || Echo_ERROR "python2 installation failed"
                yum install -y python-devel > /dev/null 2>&1
                yum install -y python2-devel > /dev/null 2>&1
                yum install -y python2-pip > /dev/null 2>&1 && Echo_INFOR "Successfully installed python2-pip" || { Echo_ERROR "python2-pip installation failed, start autorun -pip2-force option"; pip2_Install; }
                ;;
            *"Kali"*|*"Debian"*)
                case $Linux_Version_Num in
                    "12")
                        Echo_INFOR "Debian12"
                        mkdir -p /usr/local/py2713 && cd /usr/local/py2713 && $Proxy_OK wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz ${wget_option}
                        tar -xf Python-2.7.13.tgz > /dev/null 2>&1
                        cd Python-2.7.13 && ./configure --with-pydebug
                        # make -s -j16
                        make install
                        ln -s /usr/local/py2713/Python-2.7.13/python /usr/bin/python2
                        python2 -V
                        cd /tmp
                        ;;
                    *)
                        Install_Switch "python"
                        Install_Switch "python-dev"
                        apt-get install -y python-pip > /dev/null 2>&1 && Echo_INFOR "Successfully installed python2-pip" || { Echo_ERROR "python2-pip installation failed, start autorun -pip2-force option"; pip2_Install; }
                        Install_Switch3 "setuptools"
                        ;;
                esac
                ;;
            *"Ubuntu"*)
                Install_Switch "python"
                Install_Switch "python-dev"
                apt-get install -y python-pip > /dev/null 2>&1 && Echo_INFOR "Successfully installed python2-pip" || { Echo_ERROR "python2-pip installation failed, start autorun -pip2-force option"; pip2_Install; }
                Install_Switch3 "setuptools"
                case $Linux_Version_Num in
                    "16.04")
                        mkdir -p /tmp/get-pip && cd /tmp/get-pip && rm -rf get-pip.py && $Proxy_OK wget https://bootstrap.pypa.io/pip/2.7/get-pip.py > /dev/null 2>&1
                        $Proxy_OK python2 get-pip.py > /dev/null 2>&1 && rm -rf /tmp/get-pip && cd /tmp
                        ;;
                esac
                ;;
            *) ;;
        esac
    fi

}

# -py2-f
Python2_force_Install(){

    name="python2"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    python2 -V > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        mkdir -p /usr/local/py2713 && cd /usr/local/py2713 && $Proxy_OK wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz ${wget_option}
        tar -xf Python-2.7.13.tgz > /dev/null 2>&1
        cd Python-2.7.13 && ./configure --with-pydebug
        # make -s -j16
        make install
        ln -s /usr/local/py2713/Python-2.7.13/python /usr/bin/python2
        python2 -V
    fi

}

# -pip2-f
pip2_Install(){

    echo -e "\033[1;33m\n>> Installing pip2\n\033[0m"

    case $Linux_Version in
        *"Debian"*)
            case $Linux_Version_Num in
                "12")
                    python2 -m ensurepip --upgrade
                    python2 -m pip install --upgrade pip
                    ;;
                *)
                    cd $T_Dir && $Proxy_OK curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py > /dev/null 2>&1 || Echo_ERROR "https://bootstrap.pypa.io/get-pip.py download failed, please check if the network is reachable, proxychains4 configuration is correct"
                    $Proxy_OK python2 get-pip.py > /dev/null 2>&1 && Echo_INFOR "Successfully installed python-pip" || Echo_ERROR "python-pip installation failed"
                    rm -f get-pip.py > /dev/null 2>&1
                    ;;
            esac
            ;;
        *)
            cd $T_Dir && $Proxy_OK curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py > /dev/null 2>&1 || Echo_ERROR "https://bootstrap.pypa.io/get-pip.py download failed, please check if the network is reachable, proxychains4 configuration is correct"
            $Proxy_OK python2 get-pip.py > /dev/null 2>&1 && Echo_INFOR "Successfully installed python-pip" || Echo_ERROR "python-pip installation failed"
            rm -f get-pip.py > /dev/null 2>&1
        ;;
    esac

    Install_Switch3 "setuptools"

}

# -ruby
Ruby_Install(){

    name="ruby"

    echo -e "\033[1;33m\n>> Installing Ruby\n\033[0m"
    Rm_Lock
    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Install_Switch "ruby"
            Install_Switch "rubygems"
            Install_Switch "ruby-devel"
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Install_Switch "ruby"
            Install_Switch "rubygems"
            Install_Switch "ruby-dev"
            ;;
        *) ;;
    esac

}

# -ruby-f
Ruby_Install_f(){

    name="ruby"

    echo -e "\033[1;33m\n>> Installing Ruby\n\033[0m"
    cd $T_Dir && rm -f $Ruby_bin > /dev/null 2>&1 && $Proxy_OK wget https://cache.ruby-lang.org/pub/ruby/$Ruby_Ver/$Ruby_bin ${wget_option} || Echo_ERROR2
    tar xvfvz $Ruby_bin > /dev/null 2>&1
    cd $Ruby_Dir && ./configure && make && make install && Echo_INFOR "Successfully installed $(ruby -v) in the /usr/local/bin/" || Echo_ERROR3
    rm -f $T_Dir/$Ruby_bin

}

# -rust
Rust_Install(){

    name="rust"

    echo -e "\033[1;33m\n>> Installing rust\n\033[0m"
    $Proxy_OK curl https://sh.rustup.rs -sSf | $Proxy_OK sh

}

# -chromium
chromium_Install(){

    echo -e "\033[1;33m\n>> Installing dependency libraries\n\033[0m"

    name="chromium"

    Rm_Lock
    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Install_Switch "pango.x86_64"
            Install_Switch "libXcomposite.x86_64"
            Install_Switch "libXcursor.x86_64"
            Install_Switch "libXdamage.x86_64"
            Install_Switch "libXext.x86_64"
            Install_Switch "libXi.x86_64"
            Install_Switch "libXtst.x86_64"
            Install_Switch "cups-libs.x86_64"
            Install_Switch "libXScrnSaver.x86_64"
            Install_Switch "libXrandr.x86_64"
            Install_Switch "libX11-xcb.x86_64"
            Install_Switch "GConf2.x86_64"
            Install_Switch "alsa-lib.x86_64"
            Install_Switch "atk.x86_64"
            Install_Switch "gtk3.x86_64"
            Install_Switch "ipa-gothic-fonts"
            Install_Switch "xorg-x11-fonts-100dpi"
            Install_Switch "xorg-x11-fonts-75dpi"
            Install_Switch "xorg-x11-utils"
            Install_Switch "xorg-x11-fonts-cyrillic"
            Install_Switch "xorg-x11-fonts-Type1"
            Install_Switch "xorg-x11-fonts-misc"
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Install_Switch2 "libasound2"
            Install_Switch2 "libatk1.0-0"
            Install_Switch2 "libc6"
            Install_Switch2 "libcairo2"
            Install_Switch2 "libcups2"
            Install_Switch2 "libdbus-1-3"
            Install_Switch2 "libexpat1"
            Install_Switch2 "libfontconfig1"
            Install_Switch2 "libgcc1"
            Install_Switch2 "libgconf-2-4"
            Install_Switch2 "libgdk-pixbuf2.0-0"
            Install_Switch2 "libglib2.0-0"
            Install_Switch2 "libgtk-3-0"
            Install_Switch2 "libnspr4"
            Install_Switch2 "libpango-1.0-0"
            Install_Switch2 "libpangocairo-1.0-0"
            Install_Switch2 "libstdc++6"
            Install_Switch2 "libx11-6"
            Install_Switch2 "libx11-xcb1"
            Install_Switch2 "libxcb1"
            Install_Switch2 "libxcursor1"
            Install_Switch2 "libxdamage1"
            Install_Switch2 "libxext6"
            Install_Switch2 "libxfixes3"
            Install_Switch2 "libxi6"
            Install_Switch2 "libxrandr2"
            Install_Switch2 "libxrender1"
            Install_Switch2 "libxss1"
            Install_Switch2 "libxtst6"
            Install_Switch2 "libnss3"
            Install_Switch2 "libgbm-dev"
            ;;
        *) ;;
    esac

    linux_arm64_Check || exit 1

    echo -e "\033[1;33m\n>> Installing chromium (~120M)\n\033[0m"

    cd $T_Dir && rm -rf chrome-linux* > /dev/null 2>&1 && $Proxy_OK wget https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/$chromium_Ver/chrome-linux.zip ${wget_option} || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"

    unzip chrome-linux.zip > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $T_Dir/chrome-linux" || Echo_ERROR3
    rm -f chrome-linux.zip > /dev/null 2>&1

}

# -crawl
crawl_Install(){

    Rm_Lock
    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Install_Switch "pango.x86_64"
            Install_Switch "libXcomposite.x86_64"
            Install_Switch "libXcursor.x86_64"
            Install_Switch "libXdamage.x86_64"
            Install_Switch "libXext.x86_64"
            Install_Switch "libXi.x86_64"
            Install_Switch "libXtst.x86_64"
            Install_Switch "cups-libs.x86_64"
            Install_Switch "libXScrnSaver.x86_64"
            Install_Switch "libXrandr.x86_64"
            Install_Switch "libX11-xcb.x86_64"
            Install_Switch "GConf2.x86_64"
            Install_Switch "alsa-lib.x86_64"
            Install_Switch "atk.x86_64"
            Install_Switch "gtk3.x86_64"
            Install_Switch "ipa-gothic-fonts"
            Install_Switch "xorg-x11-fonts-100dpi"
            Install_Switch "xorg-x11-fonts-75dpi"
            Install_Switch "xorg-x11-utils"
            Install_Switch "xorg-x11-fonts-cyrillic"
            Install_Switch "xorg-x11-fonts-Type1"
            Install_Switch "xorg-x11-fonts-misc"
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Install_Switch2 "libasound2"
            Install_Switch2 "libatk1.0-0"
            Install_Switch2 "libc6"
            Install_Switch2 "libcairo2"
            Install_Switch2 "libcups2"
            Install_Switch2 "libdbus-1-3"
            Install_Switch2 "libexpat1"
            Install_Switch2 "libfontconfig1"
            Install_Switch2 "libgcc1"
            Install_Switch2 "libgconf-2-4"
            Install_Switch2 "libgdk-pixbuf2.0-0"
            Install_Switch2 "libglib2.0-0"
            Install_Switch2 "libgtk-3-0"
            Install_Switch2 "libnspr4"
            Install_Switch2 "libpango-1.0-0"
            Install_Switch2 "libpangocairo-1.0-0"
            Install_Switch2 "libstdc++6"
            Install_Switch2 "libx11-6"
            Install_Switch2 "libx11-xcb1"
            Install_Switch2 "libxcb1"
            Install_Switch2 "libxcursor1"
            Install_Switch2 "libxdamage1"
            Install_Switch2 "libxext6"
            Install_Switch2 "libxfixes3"
            Install_Switch2 "libxi6"
            Install_Switch2 "libxrandr2"
            Install_Switch2 "libxrender1"
            Install_Switch2 "libxss1"
            Install_Switch2 "libxtst6"
            Install_Switch2 "libnss3"
            Install_Switch2 "libgbm-dev"
            ;;
        *) ;;
    esac

    linux_arm64_Check || exit 1

    Pentest_crawlergo_Install
    Pentest_katana_Install
    Echo_ALERT "安装 chromium ,出现报错是正常的,可以忽略"
    katana -headless -u http://127.0.0.1

}

# -phantomjs
phantomjs_Install(){

    name="PhantomJS"
    phantomjs -v > /dev/null 2>&1

    if [ $? == 0 ]
    then
        echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        echo -e "\033[1;33m\n>> Installing dependency libraries\n\033[0m"
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "gcc"
                Install_Switch "gcc-c++"
                Install_Switch "make"
                Install_Switch "openssl-devel"
                Install_Switch "freetype-devel"
                Install_Switch "fontconfig-devel"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "build-essential"
                Install_Switch "chrpath"
                Install_Switch "git-core"
                Install_Switch "libssl-dev"
                Install_Switch "libfontconfig1-dev"
                Install_Switch "libxft-dev"
                ;;
            *) ;;
        esac

        echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
        mkdir -p /tmp/phantomjs && cd $_ && rm -rf $phantomjs_bin > /dev/null 2>&1 && $Proxy_OK wget https://bitbucket.org/ariya/phantomjs/downloads/$phantomjs_bin ${wget_option} || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
        tar -xvf $phantomjs_bin > /dev/null 2>&1
        mv $phantomjs_dir/bin/phantomjs /usr/local/bin/phantomjs && chmod +x /usr/local/bin/phantomjs
        rm -rf /tmp/phantomjs && cd /tmp
        which phantomjs > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi
}

# -k8s
k8s_Install(){

    kubectl_Install

}

kubectl_Install(){

    name="kubectl"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    which kubectl > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "$name installed"
    else
        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                kubectl_version=$($Proxy_OK curl -L -s https://dl.k8s.io/release/stable.txt)
                mkdir -p /tmp/kubectl && cd $_ && rm -rf kubectl > /dev/null 2>&1 && $Proxy_OK wget https://dl.k8s.io/release/$kubectl_version/bin/linux/amd64/kubectl ${wget_option} || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
                mv /tmp/kubectl/kubectl /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl
                rm -rf /tmp/kubectl && cd /tmp
                which kubectl > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $kubectl_version in the /usr/local/bin/" || Echo_ERROR3
                ;;
            *"linux-arm64"*)
                kubectl_version=$($Proxy_OK curl -L -s https://dl.k8s.io/release/stable.txt)
                mkdir -p /tmp/kubectl && cd $_ && rm -rf kubectl > /dev/null 2>&1 && $Proxy_OK wget https://dl.k8s.io/release/$kubectl_version/bin/linux/arm64/kubectl ${wget_option} || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"
                mv /tmp/kubectl/kubectl /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl
                rm -rf /tmp/kubectl && cd /tmp
                which kubectl > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $kubectl_version in the /usr/local/bin/" || Echo_ERROR3
                ;;
        esac
    fi

}

# -openjdk
Openjdk_Install(){

    name="openjdk"

    java -version > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "java installed"
    else
        echo -e "\033[1;33m\n>> Installing Java environment(openjdk)\n\033[0m"
        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "java-1.8.0-openjdk"
                Install_Switch "java-1.8.0-openjdk-devel"
                java -version && Echo_INFOR "Successfully installed Java environment(openjdk)" || Echo_ERROR3
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "openjdk-11-jdk"
                java -version && Echo_INFOR "Successfully installed Java environment(openjdk)" || Echo_ERROR3
                ;;
            *) ;;
        esac
    fi

}

Oraclejdk_Install(){

    name="Oraclejdk"

    jenv_Install || jenv_Install

    case "$1" in
        oraclejdk8)
            Oraclejdk8_Install
            ;;
        oraclejdk11)
            Oraclejdk11_Install
            ;;
        oraclejdk17)
            Oraclejdk17_Install
            ;;
        *)
            Oraclejdk8_Install
            ;;
    esac

}

# -oraclejdk8
Oraclejdk8_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            orclejdk8_bin=$orclejdk8_bin_amd64
            ;;
        *"linux-arm64"*)
            orclejdk8_bin=$orclejdk8_bin_arm64
            ;;
    esac

    name="oraclejdk8"
    dir="/usr/local/java/$jdk8_Version"

    if test -d $dir
    then
        Echo_INFOR "java8 installed"
    else
        echo -e "\033[1;33m\n>> Installing Java environment(oraclejdk8)\n\033[0m"

        cd $T_Dir && rm -f $orclejdk8_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy2}https://github.com/No-Github/Archive/releases/download/$orclejdk_tmp_ver/$orclejdk8_bin ${wget_option} || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"

        tar -xzvf $orclejdk8_bin > /dev/null 2>&1
        rm -rf /usr/local/java/ > /dev/null 2>&1 && mkdir -p /usr/local/java/
        mv --force $jdk8_Version/ /usr/local/java

        ln -s /usr/local/java/$jdk8_Version/bin/java /usr/bin/java > /dev/null 2>&1
        ln -s /usr/local/java/$jdk8_Version/bin/keytool /usr/bin/keytool > /dev/null 2>&1

        #case $Linux_Version in
            #*"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                #echo "JAVA_HOME=/usr/local/java/$jdk8_Version" >> /etc/bashrc
                #echo "JRE_HOME=\$JAVA_HOME/jre" >> /etc/bashrc
                #echo "CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib" >> /etc/bashrc
                #echo "PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/bashrc
                #/usr/bin/java -version && Echo_INFOR "Successfully installed java environment, environment variables may need to be re-entered in bash to take effect" || Echo_ERROR "java installation failed (Maybe a false positive, execute the following command and re-enter bash\nexport JAVA_HOME=/usr/local/java/$jdk8_Version\nexport JRE_HOME=\$JAVA_HOME/jre\nexport CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib\nexport PATH=\$JAVA_HOME/bin:\$PATH)"
                #;;
            #*"Kali"*|*"Ubuntu"*|*"Debian"*)
                #echo "JAVA_HOME=/usr/local/java/$jdk8_Version" >> /etc/bash.bashrc
                #echo "JRE_HOME=\$JAVA_HOME/jre" >> /etc/bash.bashrc
                #echo "CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib" >> /etc/bash.bashrc
                #echo "PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/bash.bashrc
                #/usr/bin/java -version && Echo_INFOR "Successfully installed java environment, environment variables may need to be re-entered in bash to take effect\nexport JAVA_HOME=/usr/local/java/$jdk8_Version\nexport JRE_HOME=\$JAVA_HOME/jre\nexport CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib\nexport PATH=\$JAVA_HOME/bin:\$PATH" || Echo_ERROR3
                #;;
            #*) ;;
        #esac

        rm -f $orclejdk8_bin > /dev/null 2>&1
    fi

    jenv_config "/usr/local/java/$jdk8_Version"
    jenv global 1.8 && jenv local 1.8 && echo -e "" && Echo_INFOR "Successfully installed java, Please run the following command:\njenv global 1.8 && jenv local 1.8"

}

# -oraclejdk11
Oraclejdk11_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            orclejdk11_bin=$orclejdk11_bin_amd64
            ;;
        *"linux-arm64"*)
            orclejdk11_bin=$orclejdk11_bin_arm64
            ;;
    esac

    name="oraclejdk11"
    dir="/usr/local/java/$jdk11_Version"

    if test -d $dir
    then
        Echo_INFOR "java11 installed"
    else
        echo -e "\033[1;33m\n>> Installing Java environment(oraclejdk11)\n\033[0m"

        cd $T_Dir && rm -f $orclejdk11_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy2}https://github.com/No-Github/Archive/releases/download/$orclejdk_tmp_ver/$orclejdk11_bin ${wget_option} || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"

        tar -xzvf $orclejdk11_bin > /dev/null 2>&1
        # rm -rf /usr/local/java/ > /dev/null 2>&1
        mkdir -p /usr/local/java/
        mv --force $jdk11_Version/ /usr/local/java

        ln -s /usr/local/java/$jdk11_Version/bin/java /usr/bin/java > /dev/null 2>&1
        ln -s /usr/local/java/$jdk11_Version/bin/keytool /usr/bin/keytool > /dev/null 2>&1

        #case $Linux_Version in
            #*"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                #echo "JAVA_HOME=/usr/local/java/$jdk11_Version" >> /etc/bashrc
                #echo "JRE_HOME=\$JAVA_HOME/jre" >> /etc/bashrc
                #echo "CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib" >> /etc/bashrc
                #echo "PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/bashrc
                #/usr/bin/java -version && Echo_INFOR "Successfully installed java environment, environment variables may need to be re-entered in bash to take effect" || Echo_ERROR "java installation failed (Maybe a false positive, execute the following command and re-enter bash\nexport JAVA_HOME=/usr/local/java/$jdk11_Version\nexport JRE_HOME=\$JAVA_HOME/jre\nexport CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib\nexport PATH=\$JAVA_HOME/bin:\$PATH)"
                #;;
            #*"Kali"*|*"Ubuntu"*|*"Debian"*)
                #echo "JAVA_HOME=/usr/local/java/$jdk11_Version" >> /etc/bash.bashrc
                #echo "JRE_HOME=\$JAVA_HOME/jre" >> /etc/bash.bashrc
                #echo "CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib" >> /etc/bash.bashrc
                #echo "PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/bash.bashrc
                #/usr/bin/java -version && Echo_INFOR "Successfully installed java environment, environment variables may need to be re-entered in bash to take effect\nexport JAVA_HOME=/usr/local/java/$jdk11_Version\nexport JRE_HOME=\$JAVA_HOME/jre\nexport CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib\nexport PATH=\$JAVA_HOME/bin:\$PATH" || Echo_ERROR3
                #;;
            #*) ;;
        #esac

        rm -f $orclejdk11_bin > /dev/null 2>&1
    fi

    jenv_config "/usr/local/java/$jdk11_Version"
    jenv global 11 && jenv local 11 && echo -e "" && Echo_INFOR "Successfully installed java, Please run the following command:\njenv global 11 && jenv local 11"

}

# -oraclejdk17
Oraclejdk17_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            orclejdk17_bin=$orclejdk17_bin_amd64
            ;;
        *"linux-arm64"*)
            orclejdk17_bin=$orclejdk17_bin_arm64
            ;;
    esac

    name="oraclejdk17"
    dir="/usr/local/java/$jdk17_Version"

    if test -d $dir
    then
        Echo_INFOR "java17 installed"
    else
        echo -e "\033[1;33m\n>> Installing Java environment(oraclejdk17)\n\033[0m"

        cd $T_Dir && rm -f $orclejdk17_bin > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy2}https://github.com/No-Github/Archive/releases/download/$orclejdk_tmp_ver/$orclejdk17_bin ${wget_option} || Echo_ERROR "download failed, please check if the network is reachable, proxychains4 configuration is correct"

        tar -xzvf $orclejdk17_bin > /dev/null 2>&1
        # rm -rf /usr/local/java/ > /dev/null 2>&1
        mkdir -p /usr/local/java/
        mv --force $jdk17_Version/ /usr/local/java

        ln -s /usr/local/java/$jdk17_Version/bin/java /usr/bin/java > /dev/null 2>&1
        ln -s /usr/local/java/$jdk17_Version/bin/keytool /usr/bin/keytool > /dev/null 2>&1

        #case $Linux_Version in
            #*"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                #echo "JAVA_HOME=/usr/local/java/$jdk17_Version" >> /etc/bashrc
                #echo "JRE_HOME=\$JAVA_HOME/jre" >> /etc/bashrc
                #echo "CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib" >> /etc/bashrc
                #echo "PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/bashrc
                #/usr/bin/java -version && Echo_INFOR "Successfully installed java environment, environment variables may need to be re-entered in bash to take effect" || Echo_ERROR "java installation failed (Maybe a false positive, execute the following command and re-enter bash\nexport JAVA_HOME=/usr/local/java/$jdk11_Version\nexport JRE_HOME=\$JAVA_HOME/jre\nexport CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib\nexport PATH=\$JAVA_HOME/bin:\$PATH)"
                #;;
            #*"Kali"*|*"Ubuntu"*|*"Debian"*)
                #echo "JAVA_HOME=/usr/local/java/$jdk17_Version" >> /etc/bash.bashrc
                #echo "JRE_HOME=\$JAVA_HOME/jre" >> /etc/bash.bashrc
                #echo "CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib" >> /etc/bash.bashrc
                #echo "PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/bash.bashrc
                #/usr/bin/java -version && Echo_INFOR "Successfully installed java environment, environment variables may need to be re-entered in bash to take effect\nexport JAVA_HOME=/usr/local/java/$jdk11_Version\nexport JRE_HOME=\$JAVA_HOME/jre\nexport CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib\nexport PATH=\$JAVA_HOME/bin:\$PATH" || Echo_ERROR3
                #;;
            #*) ;;
        #esac

        rm -f $orclejdk17_bin > /dev/null 2>&1
    fi

    jenv_config "/usr/local/java/$jdk17_Version"
    jenv global 17 && jenv local 17 && echo -e "" && Echo_INFOR "Successfully installed java, Please run the following command:\njenv global 17 && jenv local 17"

}

jenv_Install(){

    name="jenv"
    dir="$T_Dir/.jenv"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    which jenv > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_INFOR "$name installed"
    else
        if test -d $dir
        then
            Echo_ALERT "$name is already installed in $dir"
        else
            $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/jenv/jenv.git $dir > /dev/null 2>&1 && Echo_INFOR "Successfully installed jenv, environment variables may need to be re-entered in bash to take effect\nexport PATH=\"$T_Dir/.jenv/bin:\$PATH\"\neval \"\$(jenv init -)\"" || { Echo_ERROR2; return 1; }

            case $Linux_Version in
                *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                    echo "export PATH=\"$T_Dir/.jenv/bin:\$PATH\"" >> /etc/bashrc
                    echo 'eval "$(jenv init -)"' >> /etc/bashrc
                    ;;
                *"Kali"*|*"Ubuntu"*|*"Debian"*)
                    echo "export PATH=\"$T_Dir/.jenv/bin:\$PATH\"" >> /etc/bash.bashrc
                    echo 'eval "$(jenv init -)"' >> /etc/bash.bashrc
                    ;;
                *) ;;
            esac
        fi
    fi

}

jenv_config(){

    name="jenv"
    dir="$T_Dir/.jenv"

    which jenv > /dev/null 2>&1

    if [ $? == 0 ]
    then
        jenv add $1
        jenv doctor
    else
        if test -d $dir
        then
            export PATH="$T_Dir/.jenv/bin:$PATH"
            eval "$(jenv init -)"
            jenv add $1
            jenv doctor
        else
            Echo_ERROR "不存在 jenv 环境"
        fi
    fi

}

# -lua
lua_Install(){

    name="lua"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    which lua > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/lua && cd /tmp/lua && rm -rf ${lua_bin} && $Proxy_OK curl -R -O http://www.lua.org/ftp/$lua_bin > /dev/null 2>&1 && Echo_INFOR "Downloaded $lua_bin" || Echo_ERROR "$lua_bin download failed"
        tar -zxvf ${lua_bin} > /dev/null 2>&1 && cd ${lua_dir}
        make linux test && make install && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
        rm -rf /tmp/lua && cd /tmp
    fi

    name="luajit"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    which luajit > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/luajit && cd /tmp/luajit && rm -rf luajit && $Proxy_OK git clone --depth 1 ${GitProxy}https://luajit.org/git/luajit.git
        cd luajit && make && make install
        Echo_INFOR "Please link by output information"
        rm -rf /tmp/luajit && cd /tmp
    fi

    echo -e "\033[1;33m\n>> Installing common libraries\n\033[0m"
    Rm_Lock
    Install_Switch "luarocks"
    cd /tmp && luarocks install luafilesystem

}

# -perl
Perl_Install(){

    name="perl"

    echo -e "\033[1;33m\n>> Installing $name(Pay attention to the installation options, if the installation does not respond for a long time, please press enter a few times, and after the installation is complete, you need to exit manually.)\n\033[0m" && cd $T_Dir && $Proxy_OK sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) --activate-default ActiveState/ActivePerl-5.28

}


# -nn
nn_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            node_bin=$node_bin_amd64
            node_Dir=$node_Dir_amd64
            ;;
        *"linux-arm64"*)
            node_bin=$node_bin_arm64
            node_Dir=$node_Dir_arm64
            ;;
    esac

    name="nodejs && npm"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -e /usr/local/bin/node
    then
        Echo_ALERT "nodejs && npm installed"
    else
        mkdir -p /tmp/nodejs && cd /tmp/nodejs && $Proxy_OK wget https://nodejs.org/dist/$node_Ver/$node_bin ${wget_option} && Echo_INFOR "Downloaded $node_bin " || Echo_ERROR "$node_bin download failed, please check if the network is reachable, proxychains4 configuration is correct"
        mkdir -p /usr/local/nodejs/ && tar -C /usr/local/nodejs -xvJf $node_bin > /dev/null 2>&1
        rm -rf /tmp/nodejs && cd /tmp
        ln -s /usr/local/nodejs/$node_Dir/bin/node /usr/local/bin/node && Echo_INFOR "Successfully installed nodejs" || Echo_ERROR "nodejs installation failed"
        ln -s /usr/local/nodejs/$node_Dir/bin/npm /usr/local/bin/npm && Echo_INFOR "Successfully installed npm" || Echo_ERROR "npm installation failed"

        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                echo "PATH=\$PATH:/usr/local/nodejs/$node_Dir/bin/" >> /etc/bashrc
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                echo "PATH=\$PATH:/usr/local/nodejs/$node_Dir/bin/" >> /etc/bash.bashrc
                echo "PATH=\$PATH:/usr/local/nodejs/$node_Dir/bin/" >> ~/.zshrc
                ;;
            *) ;;
        esac
    fi

    npx_Install

}

npx_Install(){

    npm install npx -g

}

# -metarget
metarget_Install(){

    Pentest_Base_Install
    Docker_Check
    Docker_Compose_Check
    name="metarget"
    dir="$P_Dir/metarget"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

        cd $P_Dir && rm -rf metarget > /dev/null 2>&1 && Echo_ALERT "Downloading $name" && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/brant-ruan/metarget || Echo_ERROR2
        cd metarget && Install_Switch7 "requirements.txt" && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR3
    fi

}

# -vulhub
vulhub_Install(){

    Pentest_Base_Install
    Docker_Check
    Docker_Compose_Check
    name="vulhub"
    dir="$P_Dir/vulhub"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

        cd $P_Dir && rm -rf vulhub > /dev/null 2>&1 && Echo_ALERT "Downloading $name" && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/vulhub/vulhub || Echo_ERROR2
        cd vulhub && Echo_INFOR "Downloaded $name in the $dir" || Echo_ERROR3
    fi

}

# -vulfocus
vulfocus_Install(){

    Docker_Check
    Docker_Compose_Check
    name="vulfocus"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    docker pull vulfocus/vulfocus:latest && Echo_INFOR "Pulled the latest vulfocus image, For more information, please refer to https://fofapro.github.io/vulfocus/#/INSTALL" || Echo_ERROR3

}

# -TerraformGoat
TerraformGoat_Install(){

    Pentest_Base_Install
    Docker_Check
    Docker_Compose_Check
    name="TerraformGoat"
    dir="$P_Dir/TerraformGoat"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
        Echo_INFOR "Please run through the following command:\ndocker run -itd --name terraformgoat terraformgoat:v0.0.3\ndocker exec -it terraformgoat /bin/bash\n"
    else
        echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
        cd $P_Dir && rm -rf TerraformGoat > /dev/null 2>&1 && Echo_ALERT "Downloading $name" && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/HXSecurity/TerraformGoat.git > /dev/null 2>&1 || Echo_ERROR2
        cd TerraformGoat && Echo_INFOR "Downloaded $name in the $P_Dir/TerraformGoat" || Echo_ERROR3
        docker build . -t terraformgoat:v0.0.3 && Echo_INFOR "Please run through the following command:\ndocker run -itd --name terraformgoat terraformgoat:v0.0.3\ndocker exec -it terraformgoat /bin/bash\n" || Echo_ERROR3
    fi

}

awvs15_Install_secfa(){

    Docker_Check
    Docker_Compose_Check
    name="awvs"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    docker pull secfa/docker-awvs:beta && Echo_INFOR "Pulled the latest awvs image, Please run through the following command:\ndocker run -it -d -p 13443:3443 secfa/docker-awvs:beta\n\n- awvs username: admin@admin.com\n- awvs password: Admin123\n- browser access：https://127.0.0.1:13443/\n" || Echo_ERROR3

    # Echo_INFOR "Recommended Projects : https://github.com/test502git/awvs13_batch_py3"

}

# https://www.fahai.org/index.php/archives/31/
awvs15_Install_fahai(){

    Docker_Check
    Docker_Compose_Check
    name="awvs15"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    bash <(curl -sLk https://www.fahai.org/aDisk/Awvs/check.sh) xrsec/awvs:v15
    # docker pull xrsec/awvs:v15 && Echo_INFOR "Pulled the latest awvs15 image, Please run through the following command:\ndocker run -it -d -p 13443:3443 xrsec/awvs:v15\n\n-awvs username: awvs@awvs.lan\n-awvs password: Awvs@awvs.lan\n-browser access：https://127.0.0.1:13443/\n" || Echo_ERROR3

}


# -mobsf
mobsf_Install(){

    Docker_Check
    Docker_Compose_Check
    name="MobSF"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    docker pull opensecurity/mobile-security-framework-mobsf && Echo_INFOR "Pulled the latest MobSF image, Please run through the following command:\n$Proxy_OK docker run -it --rm -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest\n\n-browser access：http://127.0.0.1:8000/" || Echo_ERROR3

}

# -mythic
# 建议使用国外地区的vps,不然部署速度太慢了
mythic_Install(){

    Docker_Check
    Docker_Compose_Check
    name="Mythic"
    dir="$P_Dir/Mythic"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
        Echo_INFOR "browser access：https://127.0.0.1:7443"
        cd $dir/Mythic && cat .env | grep 'MYTHIC_ADMIN' && ./mythic-cli status
    else
        echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
        mkdir -p $dir && cd $dir && git clone https://github.com/its-a-feature/Mythic
        cd Mythic
        ./mythic-cli install github https://github.com/MythicAgents/Apollo
        ./mythic-cli install github https://github.com/MythicC2Profiles/http
        ./mythic-cli install github https://github.com/MythicAgents/poseidon
        ./mythic-cli install github https://github.com/MythicC2Profiles/websocket
        ./mythic-cli install github https://github.com/MythicAgents/apfell
        ./mythic-cli start

        ./mythic-cli status
        Echo_INFOR "$name is already installed in $dir"
        Echo_INFOR "browser access：https://127.0.0.1:7443"
        cat .env | grep 'MYTHIC_ADMIN'
    fi

}

# -nodejsscan
nodejsscan_Install(){

    Docker_Check
    Docker_Compose_Check
    name="nodejsscan"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    docker pull opensecurity/nodejsscan:latest && Echo_INFOR "Pulled the latest nodejsscan image, Please run through the following command:\ndocker run -it -p 9090:9090 opensecurity/nodejsscan:latest\n\n-browser access：http://127.0.0.1:9090/" || Echo_ERROR3

}

# -pupy
pupy_Install(){

    Docker_Check
    Docker_Compose_Check
    name="pupy"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    docker pull alxchk/pupy:unstable && echo -e "" && Echo_INFOR "Pulled the latest pupy image" || Echo_ERROR3

    echo -e "\033[5;33m\n输入 pupy 容器 ssh 端口 (默认 2022)\033[0m" && read -r input
    pupy_ssh_port=$input

    if [ $pupy_ssh_port ==  ] 2>> /tmp/f8x_error.log
    then
        echo -e "输入为空,默认监听端口为 2022"
        pupy_ssh_port="2022"
    fi

    echo -e "\033[5;33m\n输入 pupy 容器 http 端口 (默认 80)\033[0m" && read -r input
    pupy_http_port=$input

    if [ $pupy_http_port ==  ] 2>> /tmp/f8x_error.log
    then
        echo -e "输入为空,默认监听端口为 80"
        pupy_http_port="80"
    fi

    echo -e "\033[5;33m\n输入 pupy 容器 https 端口 (默认 443)\033[0m" && read -r input
    pupy_https_port=$input

    if [ $pupy_https_port ==  ] 2>> /tmp/f8x_error.log
    then
        echo -e "输入为空,默认监听端口为 443"
        pupy_https_port="443"
    fi

    # echo -e "\033[5;33m\n输入 pupy 容器 WebServer 端口 (默认 9000)\033[0m" && read -r input
    # pupy_WebServer_port=$input

    # if [ $pupy_WebServer_port ==  ] 2>> /tmp/f8x_error.log
    # then
    #     echo -e "输入为空,默认监听端口为 9000"
    #     pupy_WebServer_port="9000"
    # fi

    echo -e "\033[5;33m\n输入 pupy 容器 自定义映射端口范围 (默认 8000-8100)(端口映射范围过多会导致资源占用率提升,建议 100 以内)\033[0m" && read -r input
    pupy_custom_port=$input

    if [ $pupy_custom_port ==  ] 2>> /tmp/f8x_error.log
    then
        echo -e "输入为空,默认映射端口范围为 8000-8100"
        pupy_custom_port="-p 8000-8100:8000-8100"
    else
        pupy_custom_port="-p $pupy_custom_port:$pupy_custom_port"
    fi

    echo -e "\033[5;33m\npupy 容器是否监听 53 端口 [y/N,Default N] (注意: 如果监听 53 会关闭系统自带 systemd-resolved,请知晓这个选项的用意)\033[0m" && read -r input
    case $input in
        [yY][eE][sS]|[Yy])
            systemctl stop systemd-resolved
            pupy_dns="-p 53:53 "
        ;;
        *)
            echo -e "pass~"
        ;;
    esac

    echo -e "" && Echo_INFOR "docker run -d --name pupy-server -p $pupy_ssh_port:22 $pupy_dns-p $pupy_http_port:80 -p $pupy_https_port:443 $pupy_custom_port -v /tmp/projects:/projects alxchk/pupy:unstable"
    docker run -d --name pupy-server -p $pupy_ssh_port:22 $pupy_dns-p $pupy_http_port:80 -p $pupy_https_port:443 $pupy_custom_port -v /tmp/projects:/projects alxchk/pupy:unstable

    # ssh-keygen 免交互
    yes | ssh-keygen -t rsa -N "" -C "test@email.com" -f ~/.ssh/id_rsa_pupy
    cp ~/.ssh/id_rsa_pupy.pub /tmp/projects/keys/authorized_keys

    # ssh首次交互免输入yes
    # ssh -i ~/.ssh/id_rsa_pupy -p 2022 -o stricthostkeychecking=no pupy@127.0.0.1
    Echo_INFOR "pupy 交互命令:\nssh -i ~/.ssh/id_rsa_pupy -p $pupy_ssh_port -o stricthostkeychecking=no pupy@127.0.0.1"
    Echo_INFOR "如果提示 ssh: connect to host 127.0.0.1 port 2022: Connection timed out 的报错,重启机器,删除创建的pupy docker容器,重新 f8x -pupy 即可"

}

# -sps
SharPyShell_Install(){

    name="SharPyShell"
    dir="$P_Dir/SharPyShell"

    if test -e $dir/SharPyShell.py
    then
        Echo_ALERT "$name installed"
    else
        rm -rf $P_Dir/SharPyShell
        cd $P_Dir && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/antonioCoco/SharPyShell.git > /dev/null 2>&1
        cd $dir

        python2 -m pip install --upgrade --force pip > /dev/null 2>&1
        python2 -m pip install install setuptools==33.1.1 > /dev/null 2>&1
        python2 -m pip install pefile==2019.4.18 > /dev/null 2>&1

        case $Linux_Version in
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                case $Linux_architecture_Name in
                    *"linux-arm64"*)
                        Rm_Lock
                        Install_Switch "libffi-dev"
                        Install_Switch "libssl-dev"
                        Install_Switch "libssh-dev"

                        Install_Switch3 "cffi==1.12.3"
                        Install_Switch3 "pyOpenSSL==19.0.0"
                        python2 -m pip install -r requirements.txt > /dev/null 2>&1
                        ;;
                esac
                ;;
        esac

        python2 -m pip install -r requirements.txt > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the $dir"
    fi

}

# -viper
viper_Install(){

    Docker_Check
    Docker_Compose_Check
    name="viper"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    mkdir -p /root/VIPER && cd /root/VIPER && rm -f docker-compose.* > /dev/null 2>&1

    viper_conf > /dev/null 2>&1

    echo -e "\033[5;33m\nPlease enter your Viper password(Password needs to be greater than 8 digits)\033[0m" && read -r input
    Viper_Pass=$input
    cat docker-compose.yml.bak | sed "s/diypassword/$Viper_Pass/" >> docker-compose.yml
    cd /root/VIPER && docker compose up -d || docker-compose up -d
    rm /root/VIPER/docker-compose.yml.bak
    Echo_INFOR "Waiting for the system to start(15s), access https://vpsip:60000 Login to the server. Username : root Password : $Viper_Pass"

}

viper_conf(){

tee docker-compose.yml.bak <<-'EOF'
version: "3"
services:
  viper:
    image: registry.cn-shenzhen.aliyuncs.com/toys/viper:latest
    container_name: viper-c
    network_mode: "host"
    restart: always
    volumes:
      - ${PWD}/loot:/root/.msf4/loot
      - ${PWD}/db:/root/viper/Docker/db
      - ${PWD}/module:/root/viper/Docker/module
      - ${PWD}/log:/root/viper/Docker/log
      - ${PWD}/nginxconfig:/root/viper/Docker/nginxconfig
    command: ["diypassword"]
EOF

}

# -arl
arl_Install(){

    Docker_Check
    Docker_Compose_Check
    name="ARL"

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
    cd $P_Dir && rm -rf ARL > /dev/null 2>&1 && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/TophantTechnology/ARL > /dev/null 2>&1 || Echo_ERROR4 "TophantTechnology/ARL"
    # docker pull tophant/arl && Echo_INFOR "Pulled the latest ARL image" || Echo_ERROR3
    Echo_INFOR "Please run through the following command:\ncd $P_Dir/ARL/docker/ && docker volume create arl_db && docker compose up -d\nDefault port: 5003\nDefault username: admin\n/Default password: arlpass"

}

# -music
music_Install(){

    nn_Check
    name="UnblockNeteaseMusic"

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    Echo_ALERT "Installing npx module" && $Proxy_OK npm install npx -g > /dev/null 2>&1 && Echo_INFOR "npx module installed successfully" || Echo_ERROR "npx module installation failed"
    cd $T_Dir && rm -rf UnblockNeteaseMusic > /dev/null 2>&1 && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/nondanee/UnblockNeteaseMusic > /dev/null 2>&1 || Echo_ERROR4 "nondanee/UnblockNeteaseMusic"
    cd UnblockNeteaseMusic && $Proxy_OK npm install && Echo_INFOR "After installation, run the following command to start the service:\n\033[0m\033[1;32mcd $T_Dir/UnblockNeteaseMusic && npx @nondanee/unblockneteasemusic\n" || Echo_ERROR3

}

# -nginx
nginx_Install(){

    name="nginx"

    echo -e "\033[1;33m\n>> Installing $name $nginx_Ver\n\033[0m"

    nginx -h > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else

        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "pcre-devel"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "libpcre3-dev"
                Install_Switch "zlib1g"
                Install_Switch "zlib1g.dev"
                ;;
            *) ;;
        esac

        mkdir -p /tmp/nginx && cd /tmp/nginx && rm -f $nginx_bin > /dev/null 2>&1 && $Proxy_OK wget -O $nginx_bin https://nginx.org/download/$nginx_bin > /dev/null 2>&1 || Echo_ERROR "$nginx_bin download failed"
        tar -zxvf $nginx_bin > /dev/null 2>&1 && rm -f $nginx_bin && cd nginx-*
        ./configure && make && make install && Echo_INFOR "Compile successfully" || Echo_ERROR "Compile failure"
        rm -rf /tmp/nginx && cd /tmp
        mv --force /usr/local/nginx/sbin/nginx /usr/local/bin/nginx && chmod +x /usr/local/bin/nginx && nginx -h > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name, the configuration file is located in /usr/local/nginx/conf/" || Echo_ERROR3
    fi

}

# -aircrack
aircrack_Install(){

    name="aircrack-ng"
    dir="$P_Dir/aircrack-ng"

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        cd $P_Dir && rm -rf aircrack-ng > /dev/null 2>&1 && $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/aircrack-ng/aircrack-ng.git > /dev/null 2>&1 && cd $dir || Echo_ERROR4 "aircrack-ng/aircrack-ng"

        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Update_EPEL_Mirror
                case $Linux_Version_Num in
                    8)
                        yum config-manager --set-enabled powertools
                        Install_Switch "libtool"
                        Install_Switch "pkgconfig sqlite-devel"
                        Install_Switch "autoconf"
                        Install_Switch "automake"
                        Install_Switch "openssl-devel"
                        Install_Switch "libpcap-devel"
                        Install_Switch "pcre-devel"
                        Install_Switch "rfkill"
                        Install_Switch "libnl3-devel"
                        Install_Switch "gcc"
                        Install_Switch "gcc-c++"
                        Install_Switch "ethtool"
                        Install_Switch "hwloc-devel"
                        Install_Switch "libcmocka-devl"
                        Install_Switch "make"
                        Install_Switch "file"
                        Install_Switch "expect"
                        Install_Switch "hostapd"
                        Install_Switch "wpa_supplicant"
                        Install_Switch "iw"
                        Install_Switch "usbutils"
                        Install_Switch "tcpdump"
                        Install_Switch "screen"
                        Install_Switch "zlib-devel"
                        ;;
                    7)
                        ./centos_autotools.sh
                        yum remove -y autoconf automake
                        Install_Switch "sqlite-devel"
                        Install_Switch "openssl-devel"
                        Install_Switch "libpcap-devel"
                        Install_Switch "pcre-devel"
                        Install_Switch "rfkill"
                        Install_Switch "libnl3-devel"
                        Install_Switch "ethtool"
                        Install_Switch "hwloc-devel"
                        Install_Switch "libcmocka-devel"
                        Install_Switch "make"
                        Install_Switch "file"
                        Install_Switch "expect"
                        Install_Switch "hostapd"
                        Install_Switch "wpa_supplicant"
                        Install_Switch "iw"
                        Install_Switch "usbutils"
                        Install_Switch "tcpdump"
                        Install_Switch "screen"
                        Install_Switch "zlib-devel"
                        ;;
                    *)
                        Echo_ERROR "版本不支持,pass"
                        ;;
                esac
                ;;
            *"Fedora"*)
                Install_Switch "libtool"
                Install_Switch "pkgconfig"
                Install_Switch "sqlite-devel"
                Install_Switch "autoconf"
                Install_Switch "automake"
                Install_Switch "openssl-devel"
                Install_Switch "libpcap-devel"
                Install_Switch "pcre-devel"
                Install_Switch "rfkill"
                Install_Switch "libnl3-devel"
                Install_Switch "gcc"
                Install_Switch "gcc-c++"
                Install_Switch "ethtool"
                Install_Switch "hwloc-devel"
                Install_Switch "libcmocka-devel"
                Install_Switch "make"
                Install_Switch "file"
                Install_Switch "expect"
                Install_Switch "hostapd"
                Install_Switch "wpa_supplicant"
                Install_Switch "iw"
                Install_Switch "usbutils"
                Install_Switch "tcpdump"
                Install_Switch "screen"
                Install_Switch "zlib-devel"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "build-essential"
                Install_Switch "autoconf"
                Install_Switch "automake"
                Install_Switch "libtool"
                Install_Switch "pkg-config"
                Install_Switch "libnl-3-dev"
                Install_Switch "libnl-genl-3-dev"
                Install_Switch "libssl-dev"
                Install_Switch "ethtool"
                Install_Switch "shtool"
                Install_Switch "rfkill"
                Install_Switch "zlib1g-dev"
                Install_Switch "libpcap-dev"
                Install_Switch "libsqlite3-dev"
                Install_Switch "libpcre3-dev"
                Install_Switch "libhwloc-dev"
                Install_Switch "libcmocka-dev"
                Install_Switch "hostapd"
                Install_Switch "wpasupplicant"
                Install_Switch "tcpdump"
                Install_Switch "screen"
                Install_Switch "iw"
                Install_Switch "usbutils"
                ;;
            *) ;;
        esac

        ./autogen.sh && ./configure && make && make install && ldconfig && Echo_INFOR "Successfully installed $name" || Echo_ERROR3

    fi

}

# -bypass
bypass_Install(){

    GO_Check
    Pentest_Base_Install

    echo -e "\033[1;33m\n>> Installing garble\n\033[0m"
    go env -w GO111MODULE=on
    go get mvdan.cc/garble > /dev/null 2>&1 && Echo_INFOR "Successfully installed garble in the $P_Dir/garble " || Echo_ERROR "garble installation failed"

    echo -e "\033[1;33m\n>> Installing intensio-obfuscator\n\033[0m"
    Install_Switch5 "intensio-obfuscator"

}

# -cs
cs_Install(){

    Pentest_Base_Install

    echo -e "\033[1;33m\n>> Installing $CS_Version\n\033[0m"
    Pentest_CobaltStrike_Install
    echo -e "\033[5;33m\nPlease enter your teamserver server IP\033[0m" && read -r input
    CS_IP=$input
    echo -e "\033[5;33m\nPlease enter your teamserver server password(Special characters should be preceded by a backslash \"\\\" to escape them)\033[0m" && read -r input
    CS_Pass=$input
    Echo_INFOR "Please create a new bash session and run the following command:(Default Port 41337)\n\033[0m\033[1;32mcd $P_Dir/$CS_Version/ && nohup ./teamserver $CS_IP $CS_Pass & "

}

# -cs45
cs45_Install(){

    Pentest_Base_Install

    echo -e "\033[1;33m\n>> Installing $CS45_Version\n\033[0m"
    Pentest_CobaltStrike45_Install
    echo -e "\033[5;33m\nPlease enter your teamserver server IP\033[0m" && read -r input
    CS_IP=$input
    echo -e "\033[5;33m\nPlease enter your teamserver server password(Special characters should be preceded by a backslash \"\\\" to escape them)\033[0m" && read -r input
    CS_Pass=$input
    Echo_INFOR "Please create a new bash session and run the following command:(Default Port 50050)\n\033[0m\033[1;32mcd $P_Dir/$CS45_Version/ && nohup ./teamserver $CS_IP $CS_Pass & "

}

# -interactsh
interactsh_Install(){

    name="interactsh-server"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            interactsh_server_bin=$interactsh_server_bin_amd64
            ;;
        *"linux-arm64"*)
            interactsh_server_bin=$interactsh_server_bin_arm64
            ;;
    esac

    which interactsh-server > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/interactsh && cd /tmp/interactsh && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/interactsh/releases/download/${interactsh_Ver}/${interactsh_server_bin} ${wget_option} || Echo_ERROR2
        unzip ${interactsh_server_bin} > /dev/null 2>&1
        mv /tmp/interactsh/interactsh-server /usr/local/bin/interactsh-server && chmod +x /usr/local/bin/interactsh-server
        which interactsh-server > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${interactsh_Ver} in the /usr/local/bin/interactsh-server" || Echo_ERROR3
        rm -rf /tmp/interactsh && cd /tmp
    fi

    interactsh_client_Install

}

interactsh_client_Install(){

    name="interactsh-client"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            interactsh_client_bin=$interactsh_client_bin_amd64
            ;;
        *"linux-arm64"*)
            interactsh_client_bin=$interactsh_client_bin_arm64
            ;;
    esac

    which interactsh-client > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/interactsh && cd /tmp/interactsh && $Proxy_OK wget ${GitProxy}https://github.com/projectdiscovery/interactsh/releases/download/${interactsh_Ver}/${interactsh_client_bin} ${wget_option} || Echo_ERROR2
        unzip ${interactsh_client_bin} > /dev/null 2>&1
        mv /tmp/interactsh/interactsh-client /usr/local/bin/interactsh-client && chmod +x /usr/local/bin/interactsh-client
        which interactsh-client > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name ${interactsh_Ver} in the /usr/local/bin/interactsh-client" || Echo_ERROR3
        rm -rf /tmp/interactsh && cd /tmp
    fi

}

# -merlin
merlin_Install(){

    name="merlin"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    dir="$P_Dir/merlin"

    if test -d $dir
    then
        Echo_INFOR "Merlin Agent Folder     : $dir"
    else
        mkdir $dir
    fi

    which merlinServer > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
        Echo_INFOR "Merlin Server Command   : merlinServer"
    else
        mkdir -p /tmp/merlin && cd /tmp/merlin && rm -f ${merlin_Install_amd64} > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/Ne0nd0g/merlin/releases/download/$merlin_Ver/$merlin_Install_amd64 > /dev/null 2>&1 || Echo_ERROR2
        7za x -pmerlin ${merlin_Install_amd64} > /dev/null 2>&1
        mv --force merlinServer-Linux-x64 /usr/local/bin/merlinServer && chmod +x /usr/local/bin/merlinServer
        which merlinServer > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $merlin_Ver in the /usr/local/bin/" && Echo_INFOR "Merlin Server Command   : merlinServer" || Echo_ERROR3
        mv --force data $dir && Echo_INFOR "Merlin Agent Folder     : $dir/agents" || Echo_ERROR3
        rm -rf /tmp/merlin && cd /tmp
    fi

}

# -frp
frp_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            frp_File=$frp_File_amd64
            frp_Dir=$frp_Dir_amd64
            ;;
        *"linux-arm64"*)
            frp_File=$frp_File_arm64
            frp_Dir=$frp_Dir_arm64
            ;;
    esac

    name="frp"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -d $T_Dir/frp
    then
        Echo_INFOR "$name is already installed in $T_Dir/frp"
    else
        mkdir -p $T_Dir/frp && cd $T_Dir/frp && rm -rf frp* > /dev/null 2>&1 && $Proxy_OK wget ${GitProxy}https://github.com/fatedier/frp/releases/download/$frp_Ver/$frp_File ${wget_option} || Echo_ERROR "$frp_File download failed"
        tar -zxvf $frp_File > /dev/null 2>&1
        cd $frp_Dir && Echo_INFOR "frp is already installed in $T_Dir/frp/$frp_Dir" || Echo_ERROR3
        rm -rf $T_Dir/frp/$frp_File > /dev/null 2>&1
    fi

}

# -nps
nps_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            nps_File=$nps_File_amd64
            ;;
        *"linux-arm64"*)
            nps_File=$nps_File_arm64
            ;;
    esac

    name="nps"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -d $T_Dir/nps
    then
        Echo_INFOR "$name is already installed in $T_Dir/nps"
    else
        mkdir -p $T_Dir/nps && cd $T_Dir/nps && $Proxy_OK wget ${GitProxy}https://github.com/ehang-io/nps/releases/download/$nps_Ver/$nps_File ${wget_option} || Echo_ERROR "$nps_File download failed"
        tar -zxvf $nps_File > /dev/null 2>&1
        chmod +x $T_Dir/nps/nps && $T_Dir/nps/nps install > /dev/null 2>&1
        $T_Dir/nps/nps -version > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $nps_Ver in the $T_Dir/nps" || Echo_ERROR3
        rm -f $T_Dir/nps/$nps_File > /dev/null 2>&1
    fi

}

# -rg
RedGuard_Install(){

    name="RedGuard"
    which RedGuard > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/rg && cd /tmp/rg && $Proxy_OK wget ${GitProxy}https://github.com/wikiZ/RedGuard/releases/download/$RedGuard_Ver/$RedGuard_File_amd64 ${wget_option} || Echo_ERROR2
        mv --force $RedGuard_File_amd64 /usr/local/bin/RedGuard && chmod +x /usr/local/bin/RedGuard
        which RedGuard > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
        rm -f /tmp/rg > /dev/null 2>&1
    fi

}

# -sliver
sliver-server_Install(){

    name="sliver-server"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -e /root/sliver-server
    then
        Echo_ALERT "$name installed"
    else
        Rm_Lock
        case $Linux_Version in
            *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
                Install_Switch "git"
                Install_Switch "gcc"
                Install_Switch "gcc-c++"
                Install_Switch "make"
                Install_Switch "mingw64-gcc"
                ;;
            *"Kali"*|*"Ubuntu"*|*"Debian"*)
                Install_Switch "git"
                Install_Switch "build-essential"
                Install_Switch "mingw-w64"
                Install_Switch "binutils-mingw-w64"
                Install_Switch "g++-mingw-w64"
                ;;
            *) ;;
        esac

        case $Linux_architecture_Name in
            *"linux-x86_64"*)
                sliver_bin_Server=$sliver_Server_bin_amd64
                sliver_bin_Client=$sliver_Client_bin_amd64
                ;;
            *"linux-arm64"*)
                sliver_bin_Server=$sliver_Server_bin_arm64
                sliver_bin_Client=$sliver_Client_bin_arm64
                ;;
        esac

        mkdir -p /tmp/sliver-server && cd /tmp/sliver-server && $Proxy_OK wget ${GitProxy}https://github.com/BishopFox/sliver/releases/download/$sliver_Ver/$sliver_bin_Server ${wget_option} || Echo_ERROR2
        mv --force $sliver_bin_Server /root/sliver-server && chmod 755 /root/sliver-server
        /root/sliver-server unpack --force && Echo_INFOR "Successfully installed $name in the /root/sliver-server" || Echo_ERROR3
        rm -f /tmp/sliver-server > /dev/null 2>&1

        # systemd
        Echo_INFOR "Configuring systemd service ..."
cat > /etc/systemd/system/sliver.service <<-EOF
[Unit]
Description=Sliver
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=on-failure
RestartSec=3
User=root
ExecStart=/root/sliver-server daemon

[Install]
WantedBy=multi-user.target
EOF
        chown root:root /etc/systemd/system/sliver.service
        chmod 600 /etc/systemd/system/sliver.service

        Echo_INFOR "systemctl start sliver"
        systemctl start sliver

        # Generate local configs
        Echo_INFOR "Generating operator configs ..."
        mkdir -p /root/.sliver-client/configs
        /root/sliver-server operator --name root --lhost localhost --save /root/.sliver-client/configs
        chown -R root:root /root/.sliver-client/

        USER_DIRS=(/home/*)
        for USER_DIR in "${USER_DIRS[@]}"; do
            USER=$(basename "$USER_DIR")
            if id -u "$USER" >/dev/null 2>&1; then
                Echo_INFOR "Generating operator configs for user $USER..."
                mkdir -p $USER_DIR/.sliver-client/configs
                /root/sliver-server operator --name "$USER" --lhost localhost --save "$USER_DIR/.sliver-client/configs"
                chown -R "$USER":"$(id -gn "$USER")" "$USER_DIR/.sliver-client/"
            fi
        done

    fi

    sliver-client_Install

}

sliver-client_Install(){

    name="sliver-client"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    which sliver > /dev/null 2>&1
    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/sliver-client && cd /tmp/sliver-client && $Proxy_OK wget ${GitProxy}https://github.com/BishopFox/sliver/releases/download/$sliver_Ver/$sliver_bin_Client ${wget_option} || Echo_ERROR2
        mv --force $sliver_bin_Client /usr/local/bin/sliver && chmod 755 /usr/local/bin/sliver
        which sliver > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/sliver" || Echo_ERROR3
    fi

}

# -sliver-script
# ===================== Install sliver =====================
Pentest_sliver_Install_Script(){

    name="sliver"

    which sliver > /dev/null 2>&1 || which sliver-server > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Echo_INFOR "Installing sliver via official installer..."
        $Proxy_OK curl --silent ${GitProxy}https://sliver.sh/install -o /tmp/sliver_install.sh > /dev/null 2>&1
        chmod +x /tmp/sliver_install.sh && $Proxy_OK bash /tmp/sliver_install.sh > /dev/null 2>&1
        rm -f /tmp/sliver_install.sh
        which sliver > /dev/null 2>&1 || which sliver-server > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name" || Echo_ERROR3
    fi

}

# -yakit
yakit_Install(){

    name="yakit"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
    which yak > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/yakit && cd /tmp/yakit && rm -f yak_linux_amd64 && $Proxy_OK wget ${GitProxy2}https://yaklang.oss-cn-beijing.aliyuncs.com/yak/latest/yak_linux_amd64 ${wget_option} || Echo_ERROR2
        mv --force yak_linux_amd64 /usr/local/bin/yak && chmod +x /usr/local/bin/yak
        rm -rf /tmp/yakit && cd /tmp
        which yak > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name in the /usr/local/bin/" || Echo_ERROR3
    fi

}

# -wpscan
wpscan_Install(){

    name="wpscan"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
    which wpscan > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        gem update --system
        gem install wpscan
    fi

}

# -wx
wx_Install(){

    name="wxappUnpacker"
    dir="$P_Dir/wxappUnpacker"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -d $dir
    then
        Echo_ALERT "$name is already installed in $dir"
    else
        mkdir -p $dir
        mkdir -p /tmp/wxappUnpacker && cd $dir && $Proxy_OK wget ${GitProxy}https://github.com/No-Github/Archive/releases/download/wx/wxappUnpacker.zip ${wget_option} || Echo_ERROR2
        unzip wxappUnpacker.zip > /dev/null 2>&1
        mv wxappUnpacker/* $dir && Echo_INFOR "Successfully installed $name in the $dir" || Echo_ERROR3
        rm -rf /tmp/wxappUnpacker && cd /tmp
    fi

    echo -e "\033[1;33m\n>> Installing npm package\n\033[0m"
    cd $dir
    npm install
    npm install esprima
    npm install css-tree
    npm install cssbeautify
    npm install vm2
    npm install uglify-es
    npm install js-beautify

}

# -suricata
suricata_Install(){

    name="suricata"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            Echo_ERROR "The script currently supports only Debian installations of suricata,bye bye~\n"
            exit 1
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            Rm_Lock
            add-apt-repository ppa:oisf/suricata-stable
            Install_Switch "jq"
            Install_Switch "suricata"
            Install_Switch "suricata-update"
            suricata-update && Echo_INFOR "Updated suricata rules" || Echo_ERROR "Failure to update suricata rules"
            ;;
        *) ;;
    esac

}

# -ssr
ssr_Install(){

    name="ssr"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    if test -d $T_Dir/shadowsocksr
    then
        Echo_ALERT "$name is already installed in $T_Dir/shadowsocksr"
    else
        cd $T_Dir && rm -f ssr.zip > /dev/null 2>&1 && wget https://cdn.jsdelivr.net/gh/No-Github/Archive@1.0.3/ssr/ssr.zip > /dev/null 2>&1
        unzip -P 123456 ssr.zip > /dev/null 2>&1 && rm -f ssr.zip > /dev/null 2>&1
        cd shadowsocksr && bash initcfg.sh && Echo_INFOR "Successfully installed ssr" || Echo_ERROR "ssr installation failed"
        Echo_INFOR "Run the following command to modify the ssr configuration:\n\033[0m\033[1;32mvim $T_Dir/shadowsocksr/user-config.json\n"
        Echo_INFOR "Run the following command to enable the ssr service:\n\033[0m\033[1;32mcd $T_Dir/shadowsocksr/shadowsocks/ && python local.py"
    fi

}

# -zsh
zsh_Install(){

    name="zsh"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    Echo_INFOR "The current system shell presence is as follows:"
    cat /etc/shells
    echo -e ""

    Echo_INFOR "The current default shell is:"
    echo -e $SHELL
    echo -e ""

    zsh --version > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "zsh installed"
    else
        Rm_Lock
        Echo_INFOR "Installing zsh"
        Install_Switch "zsh"
    fi

    Echo_INFOR "Configuring Oh My Zsh"

    if [ $Proxy_OK == proxychains4 ] 2>> /tmp/f8x_error.log
    then
        $Proxy_OK wget https://raw.githubusercontent.com/No-Github/Archive/master/zsh/install.sh > /dev/null 2>&1
        $Proxy_OK bash install.sh
        $Proxy_OK exec zsh -l
    else
        wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh > /dev/null 2>&1
        Echo_INFOR "Please exit the subshell environment manually when you see ➜ ~ to continue the installation"
        sleep 1
        bash install.sh
    fi

    cat ~/.zshrc | sed "s/robbyrussell/agnoster/" >> ~/.zshrc

    $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    cat ~/.zshrc | sed "s/git/git zsh-syntax-highlighting/" >> ~/.zshrc

    $Proxy_OK git clone --depth 1 ${GitProxy}https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
    echo 'source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh' >>~/.zshrc

    echo -e "\033[1;33m\n>> Do you need to configure powerlevel10k theme [Y/n,Default Y] \033[0m" && read -r input
    case $input in
        [nN][oO]|[nN])
            Echo_INFOR "Pass~"
            ;;
        *)
            $Proxy_OK git clone --depth 1 ${GitProxy}--depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
            echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
            Echo_ALERT "If you don't need it, you can delete the last few lines of powerlevel10k in ~/.zshrc file"
            ;;
    esac

    Echo_INFOR "Over,Please reopen a shell to see the effect~"

}

# -optimize
optimize_setting(){

    echo -e "\033[1;33m\n>> In sync\n\033[0m"
    sync && Echo_INFOR "sync"
    echo -e "\033[1;33m\n>> Cache being released\n\033[0m"
    echo 1 > /proc/sys/vm/drop_caches && Echo_INFOR "Cleared pagecache"
    echo 2 > /proc/sys/vm/drop_caches && Echo_INFOR "Cleared dentries and inodes"
    echo 3 > /proc/sys/vm/drop_caches && Echo_INFOR "Cleared pagecache、dentries and inodes"
    sync
    echo -e "\033[1;33m\n>> The limit on the number of open files is being removed\n\033[0m"
    ulimit -n 65535 && Echo_INFOR "ulimit -n 65535"
    ulimit -u 65535 && Echo_INFOR "ulimit -u 65535"
    echo -e "\033[1;33m\n>> Memory settings are being optimized\n\033[0m"
    echo 128 > /proc/sys/vm/nr_hugepages > /dev/null 2>&1
    sysctl -w vm.nr_hugepages=128 > /dev/null 2>&1 && Echo_INFOR "vm.nr_hugepages=128"

}

# -info
System_info(){

    rm -f /tmp/f8x_info.log > /dev/null 2>&1

    date +"%Y-%m-%d" > /tmp/f8x_info.log

    echo -e "\033[1;33m\n>> System Info\n\033[0m"

    Echo_INFOR "Current User:"
    w

    echo -e "" && Echo_INFOR "Current system administrator:"
    awk -F: '($3 == "0") {print}' /etc/passwd

    echo -e "" && Echo_INFOR "Last logins:"
    last

    echo -e "\033[1;33m\n>> Hardware Info\n\033[0m"

    Echo_INFOR "Current Kernel Version:"
    uname -r

    echo -e "" && Echo_INFOR "Current CPU info:"
    case $Running_Mode in
        *"Darwin"*)
            sysctl -n machdep.cpu.brand_string
            ;;
        *"Linux"*)
            cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq
            ;;
    esac

    echo -e "" && Echo_INFOR "Current CPU Usage:"
    uptime

    awk '$0 ~/cpu[0-9]/' /proc/stat 2>/dev/null | while read line; do
	echo "$line" | awk '{total=$2+$3+$4+$5+$6+$7+$8;free=$5;\
        print$1" Free "free/total*100"%",\
        "Used " (total-free)/total*100"%"}'
    done

    echo -e "" && Echo_INFOR "Current CPU cores:"
    case $Running_Mode in
        *"Darwin"*)
            sysctl -n machdep.cpu.core_count
            ;;
        *"Linux"*)
            cat /proc/cpuinfo | grep 'processor' | sort | uniq | wc -l
            ;;
    esac

    echo -e "\033[1;33m\n>> Resource Usage\n\033[0m"

    Echo_INFOR "Current Memory Usage:"
    case $Running_Mode in
        *"Darwin"*)
            top -l 1 | head -n 10 | grep PhysMem
            ;;
        *"Linux"*)
            free -h
            ;;
    esac

    echo -e "" && Echo_INFOR "The 10 processes that use the most CPU resources:"
    case $Running_Mode in
        *"Darwin"*)
            ps aux | sort -nr -k 3 | head -10
            ;;
        *"Linux"*)
            ps auxf |sort -nr -k 3 |head -10
            ;;
    esac

    echo -e "" && Echo_INFOR "The 10 processes that use the most memory resources:"
    case $Running_Mode in
        *"Darwin"*)
            ps aux | sort -nr -k 4 | head -10
            ;;
        *"Linux"*)
            ps auxf |sort -nr -k 4 |head -10
            ;;
    esac

    echo -e "" && Echo_INFOR "Disk space utilization:"
    df -h

    df_a1=$(df -h|sed '1d'|awk '{print $5}'|sed 's/%//g'|sed -n 1p)
    df_a2=$(df -h|sed '1d'|awk '{print $5}'|sed 's/%//g'|sed -n 2p)
    df_a3=$(df -h|sed '1d'|awk '{print $5}'|sed 's/%//g'|sed -n 3p)
    df_a4=$(df -h|sed '1d'|awk '{print $5}'|sed 's/%//g'|sed -n 4p)

    df_b1=$(df -h|sed 1d|awk '{print $1}'|sed -n 1p)
    df_b2=$(df -h|sed 1d|awk '{print $1}'|sed -n 2p)
    df_b3=$(df -h|sed 1d|awk '{print $1}'|sed -n 3p)
    df_b4=$(df -h|sed 1d|awk '{print $1}'|sed -n 4p)

    if [ $df_a1 -gt 69 ];then Echo_ERROR "$DAY $df_b1 over 70% usage !!!!!"; fi
    if [ $df_a2 -gt 69 ];then Echo_ERROR "$DAY $df_b2 over 70% usage !!!!!"; fi
    if [ $df_a3 -gt 69 ];then Echo_ERROR "$DAY $df_b3 over 70% usage !!!!!"; fi
    if [ $df_a4 -gt 69 ];then Echo_ERROR "$DAY $df_b4 over 70% usage !!!!!"; fi

    echo -e "" && Echo_INFOR "Available Device Info:"
    case $Running_Mode in
        *"Darwin"*)
            diskutil list
            ;;
        *"Linux"*)
            lsblk
            ;;
    esac

    case $Running_Mode in
        *"Linux"*)
            echo -e "" && Echo_INFOR "Current swap partition usage: (empty means no swap partition is configured)"
            swapon -s 2>> /tmp/f8x_error.log
            echo -e "" && Echo_INFOR "Mount Status:"
            more /etc/fstab  | grep -v "^#" | grep -v "^$"
            ;;
    esac

    echo -e "\033[1;33m\n>> Network Status\n\033[0m"

    Echo_INFOR "Current IP address:"
    case $Running_Mode in
        *"Darwin"*)
            ifconfig | grep inet | grep -v "inet6" | grep -v "127.0.0.1" | awk '{ print $2; }' | tr '\n' '\t'
            ;;
        *"Linux"*)
            ip addr | grep inet | grep -v "inet6" | grep -v "127.0.0.1" | awk '{ print $2; }' | tr '\n' '\t'
            ;;
    esac

    case $Running_Mode in
        *"Linux"*)
            echo -e "" && Echo_INFOR "Current TCP connection:"
            cat  /proc/net/tcp | wc -l
            echo -e "" && Echo_INFOR "Routing forward status:"
            ip_forward=$(more /proc/sys/net/ipv4/ip_forward | awk -F: '{if ($1==1) print "1"}')
            if [ -n "$ip_forward" ]; then
                echo "Route forward is enabled"
            else
                echo "Route forward is not enabled"
            fi
            ;;
    esac

    echo -e "\n" && Echo_INFOR "Current routing table:"
    case $Running_Mode in
        *"Darwin"*)
            netstat -nr
            ;;
        *"Linux"*)
            ip route 2>> /tmp/f8x_error.log || route -n 2>> /tmp/f8x_error.log
            ;;
    esac

    echo -e "" && Echo_INFOR "Listening port:"
    case $Running_Mode in
        *"Darwin"*)
            netstat -anvp tcp
            netstat -anvp udp
            ;;
        *"Linux"*)
            netstat -tunlp 2>> /tmp/f8x_error.log || ss -tnlp 2>> /tmp/f8x_error.log
            ;;
    esac

    echo -e "\033[1;33m\n>> Identity Information\n\033[0m"

    Echo_INFOR "All system users:"
    echo -e "\n\n\n>> All system users: " >> /tmp/f8x_info.log
    cut -d: -f1 /etc/passwd >> /tmp/f8x_info.log && echo -e "Due to more echoes, it has been output to /tmp/f8x_info.log"

    echo -e "" && Echo_INFOR "System Super User:"
    grep -v -E "^#" /etc/passwd | awk -F: '$3 == 0 { print $1}'

    case $Running_Mode in
        *"Linux"*)
            echo -e "" && Echo_INFOR "Account information for remote login:"
            awk '/\$1|\$6/{print $1}' /etc/shadow
            echo -e "" && Echo_INFOR "Startup service:"
            echo -e "\n\n\n>> Startup service: " >> /tmp/f8x_info.log
            systemctl list-unit-files | grep enabled >> /tmp/f8x_info.log && echo -e "Due to more echoes, it has been output to /tmp/f8x_info.log"
            ;;
    esac

    echo -e "" && Echo_INFOR "All groups in the system:"
    echo -e "\n\n\n>> All groups in the system: " >> /tmp/f8x_info.log
    cut -d: -f1,2,3 /etc/group >> /tmp/f8x_info.log && echo -e "Due to more echoes, it has been output to /tmp/f8x_info.log"

    echo -e "" && Echo_INFOR "Scheduled tasks for the current user:"
    crontab -l

    echo -e "" && Echo_INFOR "Resource limits for currently logged-in users:"
    ulimit -a

    echo -e "\033[1;33m\n>> Security Information\033[0m"

    echo -e "" && Echo_INFOR "Environment Variables:"
    echo -e "\n\n\n>> Environment Variables: " >> /tmp/f8x_info.log
    env >> /tmp/f8x_info.log && echo -e "Output to /tmp/f8x_info.log"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            echo -e "" && Echo_INFOR "Check all rpm packages to see which commands have been replaced:"
            rpm -Va
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            echo -e "" && Echo_INFOR "View repository key:"
            echo -e "\n\n\n>> View repository key: " >> /tmp/f8x_info.log
            apt-key list 1>> /tmp/f8x_info.log 2>> /tmp/f8x_error.log && echo -e "Output to /tmp/f8x_info.log"
            ;;
    esac

}

# -clear
clear_log(){

    echo -e "\033[1;33m\n>> System usage traces are being cleaned\n\033[0m"

    cat /dev/null > /var/log/auth.log && Echo_INFOR "cat /dev/null > /var/log/auth.log"
    cat /dev/null > /var/log/kern.log && Echo_INFOR "cat /dev/null > /var/log/kern.log"
    cat /dev/null > /var/log/cron.log && Echo_INFOR "cat /dev/null > /var/log/cron.log"
    cat /dev/null > /var/log/mysqld.log && Echo_INFOR "cat /dev/null > /var/log/mysqld.log"
    cat /dev/null > /var/log/system.log && Echo_INFOR "cat /dev/null > /var/log/system.log"

    cat /dev/null > /var/log/boot.log && Echo_INFOR "cat /dev/null > /var/log/boot.log"
    cat /dev/null > /var/log/yum.log && Echo_INFOR "cat /dev/null > /var/log/yum.log"
    cat /dev/null > /var/log/mail.info && Echo_INFOR "cat /dev/null > /var/log/mail.info"
    cat /dev/null > /var/log/wpa_supplicant.log && Echo_INFOR "cat /dev/null > /var/log/wpa_supplicant.log"

    cat /dev/null > /var/log/btmp && Echo_INFOR "cat /dev/null > /var/log/btmp"
    cat /dev/null > /var/log/cron && Echo_INFOR "cat /dev/null > /var/log/cron"
    cat /dev/null > /var/log/dmesg && Echo_INFOR "cat /dev/null > /var/log/dmesg"
    cat /dev/null > /var/log/firewalld && Echo_INFOR "cat /dev/null > /var/log/firewalld"
    cat /dev/null > /var/log/grubby && Echo_INFOR "cat /dev/null > /var/log/grubby"
    cat /dev/null > /var/log/lastlog && Echo_INFOR "cat /dev/null > /var/log/lastlog"
    cat /dev/null > /var/log/maillog && Echo_INFOR "cat /dev/null > /var/log/maillog"
    cat /dev/null > /var/log/messages && Echo_INFOR "cat /dev/null > /var/log/messages"
    cat /dev/null > /var/log/secure && Echo_INFOR "cat /dev/null > /var/log/secure"
    cat /dev/null > /var/log/spooler && Echo_INFOR "cat /dev/null > /var/log/spooler"
    cat /dev/null > /var/log/syslog && Echo_INFOR "cat /dev/null > /var/log/syslog"
    cat /dev/null > /var/log/tallylog && Echo_INFOR "cat /dev/null > /var/log/tallylog"
    cat /dev/null > /var/log/wtmp && Echo_INFOR "cat /dev/null > /var/log/wtmp"
    cat /dev/null > /var/log/utmp && Echo_INFOR "cat /dev/null > /var/log/utmp"

    cat /dev/null > ~/.bash_history && Echo_INFOR "cat /dev/null > ~/.bash_history"
    cat /dev/null > ~/.zsh_history && Echo_INFOR "cat /dev/null > ~/.zsh_history"

    Echo_INFOR "Cleaned up"

}

# -remove
remove_watcher(){

    echo -e "\033[1;33m\n>> Uninstall some vps cloud monitoring\n\033[0m"

    if ps aux | grep -i '[a]liyun'
    then
        # 卸载阿里云盾和监控服务
        /etc/init.d/aegis uninstall
        wget "http://update2.aegis.aliyun.com/download/uninstall.sh" && chmod +x uninstall.sh && ./uninstall.sh
        wget http://update.aegis.aliyun.com/download/uninstall.sh && chmod +x uninstall.sh && ./uninstall.sh
        wget http://update.aegis.aliyun.com/download/quartz_uninstall.sh && chmod +x quartz_uninstall.sh && ./quartz_uninstall.sh

        sudo pkill aliyun-service
        killall -9 aliyun-service
        sudo pkill AliYunDun
        killall -9 AliYunDun
        sudo rm -fr /etc/init.d/agentwatch /usr/sbin/aliyun-service
        sudo rm -rf /usr/local/aegis*
        systemctl stop aliyun.service
        systemctl disable aliyun.service

        # 屏蔽云盾 IP，用包过滤屏蔽如下 IP
        iptables -I INPUT -s 100.100.30.1/28 -j DROP
        iptables -I INPUT -s 140.205.201.0/28 -j DROP
        iptables -I INPUT -s 140.205.201.16/29 -j DROP
        iptables -I INPUT -s 140.205.201.32/28 -j DROP
        iptables -I INPUT -s 140.205.225.192/29 -j DROP
        iptables -I INPUT -s 140.205.225.200/30 -j DROP
        iptables -I INPUT -s 140.205.225.184/29 -j DROP
        iptables -I INPUT -s 140.205.225.183/32 -j DROP
        iptables -I INPUT -s 140.205.225.206/32 -j DROP
        iptables -I INPUT -s 140.205.225.205/32 -j DROP
        iptables -I INPUT -s 140.205.225.195/32 -j DROP
        iptables -I INPUT -s 140.205.225.204/32 -j DROP
        service iptables save
        service iptables restart

        rm -rf /etc/init.d/agentwatch /usr/sbin/aliyun-service
        rm -rf /usr/local/aegis*
        systemctl stop aliyun.service
        systemctl disable aliyun.service
        service bcm-agent stop
        yum remove bcm-agent -y
        apt-get remove bcm-agent -y

        # 卸载云监控 Java 版本插件
        sudo /usr/local/cloudmonitor/wrapper/bin/cloudmonitor.sh stop
        sudo /usr/local/cloudmonitor/wrapper/bin/cloudmonitor.sh remove
        sudo rm -rf /usr/local/cloudmonitor
    elif ps aux | grep -i '[y]unjing'
    then
        # 卸载腾讯云镜
        process=(sap100 secu-tcs-agent sgagent64 barad_agent agent agentPlugInD pvdriver )
        for i in ${process[@]}
        do
            for A in $(ps aux | grep $i | grep -v grep | awk '{print $2}')
            do
                kill -9 $A
            done
        done
        chkconfig --level 35 postfix off
        service postfix stop
        /usr/local/qcloud/stargate/admin/stop.sh
        /usr/local/qcloud/stargate/admin/uninstall.sh
        /usr/local/qcloud/YunJing/uninst.sh
        /usr/local/qcloud/monitor/barad/admin/stop.sh
        /usr/local/qcloud/monitor/barad/admin/uninstall.sh

        rm -rf /usr/local/qcloud/
        rm -rf /usr/local/sa/
        rm -rf /usr/local/agenttools
        rm -f /etc/cron.d/sgagenttask
    fi

    Echo_INFOR "Uninstallation completed"

}

# -swap
swap_setting(){

    echo -e "\033[1;33m\n>> Swap partition configuration in progress\n\033[0m"
    Echo_INFOR "The current swap partition usage is as follows: (Empty means no swap partition is configured)"
    swapon -s 2>> /tmp/f8x_error.log

    if test -e /home/f8xswap
    then
        Echo_ALERT "/home/f8xswap file already exists"
        exit 1
    fi

    echo -e "\033[5;33m\nPlease enter the size of the swap partition(Unit is G) [Default 4G]\033[0m" && read -r input

    VALID_CHECK=$(echo "$input"|awk -F. '$1>0&&$1<=254{print "yes"}')
    if [ "${VALID_CHECK:-no}" == "yes" ]; then
        echo -e "\033[1;32m\n>> ${input}G\033[0m"
        swap_bin=`expr ${input} \* 1024`
    else
        echo -e "\033[1;32m\n>> The default size will be used\033[0m"
        swap_bin="4096"
    fi

    echo -e "\033[1;33m\n>> Swap file being created, time varies with size\n\033[0m"
    dd if=/dev/zero of=/home/f8xswap bs=1M count=$swap_bin && Echo_INFOR "Created swap in the /home/f8xswap"
    mkswap /home/f8xswap 1> /dev/null
    swapon /home/f8xswap 1> /dev/null && Echo_INFOR "Mounted file partition /home/f8xswap"
    echo -e "\n/home/f8xswap swap swap default 0 0" >> /etc/fstab
    Echo_INFOR "The current swap partition usage is as follows: (Empty means no swap partition is configured)"
    swapon -s 2>> /tmp/f8x_error.log

}

# -asciinema
asciinema_Install(){

    name="asciinema"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    asciinema --version > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        Install_Switch5 "asciinema"
        asciinema --version > /dev/null 2>&1

        if [ $? == 0 ]
        then
            Echo_INFOR "pip is very useful, isn't it :)"
        else
            Echo_ERROR "pip3 failed to install $name, about to switch to package manager to install"
            Rm_Lock
            Install_Switch "asciinema"
        fi

    fi
    Echo_INFOR "Run the following command to enable screenshots:"
    Echo_INFOR "asciinema rec"

}

# -bt
bt_Install(){

    echo -e "\033[1;33m\n>> Installing 宝塔 Linux 面板\n\033[0m"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            mkdir -p /tmp/bt && cd /tmp/bt && curl -o install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            mkdir -p /tmp/bt && cd /tmp/bt && curl -o install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
            ;;
        *) ;;
    esac

}

# -aa
aaPanel_Install(){

    echo -e "\033[1;33m\n>> Installing aaPanel\n\033[0m"

    case $Linux_Version in
        *"CentOS"*|*"RedHat"*|*"Fedora"*|*"AlmaLinux"*|*"VzLinux"*|*"Rocky"*)
            mkdir -p /tmp/aaPanel && cd /tmp/aaPanel && curl -o install.sh https://www.aapanel.com/script/install_panel_en.sh && bash install.sh aapanel
            ;;
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            mkdir -p /tmp/aaPanel && cd /tmp/aaPanel && curl -o install.sh https://www.aapanel.com/script/install_panel_en.sh && sudo bash install.sh aapanel
            ;;
        *) ;;
    esac

}

# -1panel
1Panel_Install(){

    echo -e "\033[1;33m\n>> Installing 1Panel\n\033[0m"

    mkdir -p /tmp/1panel && cd /tmp/1panel && curl -sSL https://resource.fit2cloud.com/1panel/package/v2/quick_start.sh -o quick_start.sh && bash quick_start.sh

}

# -clash
clash_Install(){

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            clash_File=$clash_File_amd64
            clash_bin=$clash_bin_amd64
            ;;
        *"linux-arm64"*)
            clash_File=$clash_File_arm64
            clash_bin=$clash_bin_arm64
            ;;
    esac

    name="clash"
    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"
    clash -v > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
        Echo_INFOR "Config Flie: ~/.config/clash/config.yaml"
    else
        mkdir -p /tmp/installclash && cd $_
        $Proxy_OK wget ${GitProxy}https://github.com/Dreamacro/clash/releases/download/$clash_Ver/$clash_bin > /dev/null 2>&1 || Echo_ERROR2
        gunzip $clash_bin > /dev/null 2>&1
        mv --force $clash_File /usr/local/bin/clash && chmod +x /usr/local/bin/clash
        clash -v > /dev/null 2>&1 && Echo_INFOR "Successfully installed $name $clash_Ver in the /usr/local/bin/" || Echo_ERROR3
        rm -rf /tmp/installclash && cd /tmp
    fi

}

# -clash-old
clash_Install_old(){

    name="clash"

    echo -e "\033[1;33m\n>> Installing $name\n\033[0m"

    clash -v > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
        Echo_INFOR "如果提示找不到 clash 命令,请尝试输入 source /etc/profile &> /dev/null && clash"
    else
        mkdir -p /tmp/clash_install && cd /tmp/clash_install
        # https://github.com/juewuy/ShellClash
        export tmp_url='https://cdn.jsdelivr.net/gh/juewuy/ShellClash@master' && curl -o install.sh $tmp_url/install.sh
        bash install.sh
        source /etc/profile &> /dev/null
        Echo_INFOR "如果提示找不到 clash 命令,请输入 source /etc/profile &> /dev/null && clash"
    fi

}

# Compile and install jq does not run by default
jq_Install(){

    name="jq"
    which jq > /dev/null 2>&1

    if [ $? == 0 ]
    then
        Echo_ALERT "$name installed"
    else
        mkdir -p /tmp/jq && cd /tmp/jq && rm -rf ${jq_bin} && $Proxy_OK wget -O ${jq_bin} ${GitProxy}https://github.com/stedolan/jq/releases/download/${jq_ver}/${jq_bin} > /dev/null 2>&1 || Echo_ERROR "${jq_bin} download failed"
        unzip ${jq_bin} > /dev/null 2>&1
        cd ${jq_dir} && ./configure --prefix=/usr/local && make && make install
        ls -s /opt/jq/${jq_dir}/jq /usr/local/bin/jq
        rm -rf /tmp/jq && cd /tmp
        jq -h > /dev/null 2>&1 && Echo_INFOR "${name} installed" || Echo_ERROR3
    fi

}

# -upgrade
# 更新已经安装的软件
pentest_tool_upgrade(){

    ffuf -V 1> /dev/null 2>> /dev/null
    if [ $? == 0 ]
    then
        Echo_ALERT "ffuf 已安装,是否需要覆盖更新 ffuf $ffuf_Ver ? [y/N,默认No]" && read -r input
        case $input in
            [yY][eE][sS]|[Yy])
                rm -rf /usr/local/bin/ffuf > /dev/null 2>&1
                rm -rf /usr/bin/ffuf > /dev/null 2>&1
                Pentest_ffuf_Install
                ;;
            *)
                sleep 0.001
                ;;
        esac
    else
        Echo_ERROR "ffuf 未安装"
        Pentest_ffuf_Install
    fi

    nuclei -version > /dev/null 2>&1
    if [ $? == 0 ]
    then
        if test -e /tmp/IS_CI
        then
            input="y"
        else
            nuclei -version
            Echo_ALERT "Nuclei 已安装,是否需要覆盖更新 nuclei $Nuclei_Ver ? [y/N,默认No]" && read -r input
        fi
        case $input in
            [yY][eE][sS]|[Yy])
                rm -rf /usr/local/bin/nuclei
                Pentest_Nuclei_Install
                ;;
            *)
                sleep 0.001
                ;;
        esac
    else
        Echo_ERROR "Nuclei 未安装"
        Pentest_Nuclei_Install
    fi

    which httpx > /dev/null 2>&1
    if [ $? == 0 ]
    then
        if test -e /tmp/IS_CI
        then
            input="y"
        else
            httpx -version
            Echo_ALERT "httpx 已安装,是否需要覆盖更新 httpx $httpx_Ver ? [y/N,默认No]" && read -r input
        fi
        case $input in
            [yY][eE][sS]|[Yy])
                rm -rf /usr/local/bin/httpx
                Pentest_httpx_Install
                ;;
            *)
                sleep 0.001
                ;;
        esac
    else
        Echo_ERROR "httpx 未安装"
        Pentest_httpx_Install
    fi

    naabu -version > /dev/null 2>&1
    if [ $? == 0 ]
    then
        if test -e /tmp/IS_CI
        then
            input="y"
        else
            naabu -version
            Echo_ALERT "naabu 已安装,是否需要覆盖更新 naabu $naabu_Ver ? [y/N,默认No]" && read -r input
        fi
        case $input in
            [yY][eE][sS]|[Yy])
                rm -rf /usr/local/bin/naabu
                Pentest_naabu_Install
                ;;
            *)
                sleep 0.001
                ;;
        esac
    else
        Echo_ERROR "naabu 未安装"
        Pentest_naabu_Install
    fi

    which katana > /dev/null 2>&1
    if [ $? == 0 ]
    then
        if test -e /tmp/IS_CI
        then
            input="y"
        else
            katana -version
            Echo_ALERT "katana 已安装,是否需要覆盖更新 katana $katana_Ver ? [y/N,默认No]" && read -r input
        fi
        case $input in
            [yY][eE][sS]|[Yy])
                rm -rf /usr/local/bin/katana
                Pentest_katana_Install
                ;;
            *)
                sleep 0.001
                ;;
        esac
    else
        Echo_ERROR "katana 未安装"
        Pentest_katana_Install
    fi

    which subfinder > /dev/null 2>&1
    if [ $? == 0 ]
    then
        if test -e /tmp/IS_CI
        then
            input="y"
        else
            subfinder -version
            Echo_ALERT "subfinder 已安装,是否需要覆盖更新 subfinder $subfinder_Ver ? [y/N,默认No]" && read -r input
        fi
        case $input in
            [yY][eE][sS]|[Yy])
                rm -rf /usr/local/bin/subfinder
                Pentest_subfinder_Install
                ;;
            *)
                sleep 0.001
                ;;
        esac
    else
        Echo_ERROR "subfinder 未安装"
        Pentest_subfinder_Install
    fi

}

# -all
all_Install(){

    Base_Install

    optimize_setting

    Dev_Tools

    Oraclejdk_Install

    nn_Install

    kali_Tools

}

# -d
Dev_Tools(){

    Dev_Base_Install
    echo -e "\033[1;33m\n>> Installing python3 and pip3\n\033[0m"
    Python3_def_Install
    Python2_Install
    echo -e "\033[1;33m\n>> Installing Go\n\033[0m"
    Go_Install
    echo -e "\033[1;33m\n>> Installing Docker and Docker-compose\n\033[0m"
    Docker_Install
    echo -e "\033[1;33m\n>> Installing SDKMAN!\n\033[0m"
    SDKMAN_Install

}

# -f
Fun_Tools(){

    echo -e "\033[1;33m\n>> Installing AdGuardHome DNS\n\033[0m"
    AdGuardHome_Install
    echo -e "\033[1;33m\n>> Installing trash-cli\n\033[0m"
    trash-cli_Install
    # echo -e "\033[1;33m\n>> Installing thefuck\n\033[0m"
    # thefuck_Install
    echo -e "\033[1;33m\n>> Installing fzf\n\033[0m"
    fzf_Install
    echo -e "\033[1;33m\n>> Installing lux\n\033[0m"
    lux_Install
    # echo -e "\033[1;33m\n>> Installing you-get\n\033[0m"
    # you-get_Install
    echo -e "\033[1;33m\n>> Installing ffmpeg\n\033[0m"
    ffmpeg_Install
    echo -e "\033[1;33m\n>> Installing aria2\n\033[0m"
    aria2_Install
    # echo -e "\033[1;33m\n>> Installing filebrowser\n\033[0m"
    # filebrowser_Install
    echo -e "\033[1;33m\n>> Installing ttyd\n\033[0m"
    ttyd_Install
    echo -e "\033[1;33m\n>> Installing duf\n\033[0m"
    duf_Install
    echo -e "\033[1;33m\n>> Installing yq\n\033[0m"
    yq_Install

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            echo -e "\033[1;33m\n>> Installing starship\n\033[0m"
            starship_Install
            echo -e "\033[1;33m\n>> Installing procs\n\033[0m"
            procs_Install
            ;;
    esac

    case $Linux_Version in
        *"Kali"*|*"Ubuntu"*|*"Debian"*)
            echo -e "\033[1;33m\n>> Installing ncdu\n\033[0m"
            ncdu_Install
            echo -e "\033[1;33m\n>> Installing exa\n\033[0m"
            exa_Install
            echo -e "\033[1;33m\n>> Installing htop\n\033[0m"
            htop_Install
            echo -e "\033[1;33m\n>> Installing bat\n\033[0m"
            bat_Install
            echo -e "\033[1;33m\n>> Installing fd\n\033[0m"
            fd_Install
            ;;
        *) ;;
    esac

    echo -e "\033[1;33m\n>> Installing ctop\n\033[0m"
    ctop_Install

    # vlmcsd_Install

}

# -k
kali_Tools(){

    echo -e "\033[1;33m\n>> Configuring pentest environment\n\033[0m"
    Pentest_Base_Install
    echo -e "\033[1;33m\n>> Downloading AboutSecurity dictionary\n\033[0m"
    Pentest_Dic_Install
    echo -e "\033[1;33m\n>> Installing python modules\n\033[0m"
    Pentest_pip_Install

    case "$1" in
        a)
            kali_Tools_TypeA
            ;;
        b)
            kali_Tools_TypeB
            ;;
        c)
            kali_Tools_TypeC
            ;;
        d)
            kali_Tools_TypeD
            ;;
        e)
            kali_Tools_TypeE
            ;;
        *)
            echo -e "\033[1;33m\n>> Install misc tools\n\033[0m"
            Pentest_Misc_Install
            kali_Tools_TypeA
            kali_Tools_TypeB
            kali_Tools_TypeC
            kali_Tools_TypeD
            ;;
    esac

}

kali_Tools_TypeA(){

    echo -e "\033[1;33m\n>> Installing nmap\n\033[0m"
    Pentest_nmap_Install
    echo -e "\033[1;33m\n>> Installing ffuf\n\033[0m"
    Pentest_ffuf_Install
    echo -e "\033[1;33m\n>> Installing JSFinder\n\033[0m"
    Pentest_JSFinder_Install
    echo -e "\033[1;33m\n>> Installing SecretFinder\n\033[0m"
    Pentest_SecretFinder_Install
    echo -e "\033[1;33m\n>> Installing OneForAll\n\033[0m"
    Pentest_OneForAll_Install
    echo -e "\033[1;33m\n>> Installing masscan\n\033[0m"
    Pentest_masscan_Install
    echo -e "\033[1;33m\n>> Installing rad\n\033[0m"
    Pentest_rad_Install
    echo -e "\033[1;33m\n>> Installing crawlergo\n\033[0m"
    Pentest_crawlergo_Install
    echo -e "\033[1;33m\n>> Installing katana\n\033[0m"
    Pentest_katana_Install
    echo -e "\033[1;33m\n>> Installing Arjun\n\033[0m"
    Pentest_Arjun_Install
    echo -e "\033[1;33m\n>> Installing httpx\n\033[0m"
    Pentest_httpx_Install
    echo -e "\033[1;33m\n>> Installing subfinder\n\033[0m"
    Pentest_subfinder_Install
    echo -e "\033[1;33m\n>> Installing afrog\n\033[0m"
    Pentest_afrog_Install
    echo -e "\033[1;33m\n>> Installing dddd\n\033[0m"
    Pentest_dddd_Install
    echo -e "\033[1;33m\n>> Installing apktool\n\033[0m"
    Pentest_apktool_Install
    echo -e "\033[1;33m\n>> Installing ApkAnalyser\n\033[0m"
    Pentest_ApkAnalyser_Install
    echo -e "\033[1;33m\n>> Installing apkleaks\n\033[0m"
    Pentest_apkleaks_Install
    #echo -e "\033[1;33m\n>> Installing Diggy\n\033[0m"
    #Pentest_Diggy_Install
    # echo -e "\033[1;33m\n>> Installing AppInfoScanner\n\033[0m"
    # Pentest_AppInfoScanner_Install
    echo -e "\033[1;33m\n>> Installing Amass\n\033[0m"
    Pentest_Amass_Install
    echo -e "\033[1;33m\n>> Installing dirsearch\n\033[0m"
    Pentest_dirsearch_Install
    echo -e "\033[1;33m\n>> Installing netspy\n\033[0m"
    Pentest_netspy_Install
    echo -e "\033[1;33m\n>> Installing naabu\n\033[0m"
    Pentest_naabu_Install
    echo -e "\033[1;33m\n>> Installing ksubdomain\n\033[0m"
    Pentest_ksubdomain_Install
    echo -e "\033[1;33m\n>> Installing gau\n\033[0m"
    Pentest_gau_Install
    echo -e "\033[1;33m\n>> Installing gobuster\n\033[0m"
    Pentest_gobuster_Install
    echo -e "\033[1;33m\n>> Installing fscan\n\033[0m"
    Pentest_fscan_Install
    echo -e "\033[1;33m\n>> Installing fingerprintx\n\033[0m"
    Pentest_fingerprintx_Install
    echo -e "\033[1;33m\n>> Installing HostCollision\n\033[0m"
    Pentest_HostCollision_Install
    echo -e "\033[1;33m\n>> Installing asnmap\n\033[0m"
    Pentest_asnmap_Install
    echo -e "\033[1;33m\n>> Installing tlsx\n\033[0m"
    Pentest_tlsx_Install
    echo -e "\033[1;33m\n>> Installing gogo\n\033[0m"
    Pentest_gogo_Install
    echo -e "\033[1;33m\n>> Installing spray\n\033[0m"
    Pentest_spray_Install
    echo -e "\033[1;33m\n>> Installing zombie\n\033[0m"
    Pentest_zombie_Install
    echo -e "\033[1;33m\n>> Installing ccupp\n\033[0m"
    Pentest_ccupp_Install
    echo -e "\033[1;33m\n>> Installing GitHacker\n\033[0m"
    Pentest_GitHacker_Install

    # Pentest_gospider_Install
    # Pentest_dismap_Install
    # Pentest_htpwdScan_Install
    # Pentest_WebCrack_Install
    # Pentest_csprecon_Install
    # Pentest_zscan_Install

}

kali_Tools_TypeB(){

    echo -e "\033[1;33m\n>> Installing/Update Metasploit\n\033[0m"
    Pentest_Metasploit_Install
    echo -e "\033[1;33m\n>> Installing Sqlmap\n\033[0m"
    Pentest_Sqlmap_Install
    echo -e "\033[1;33m\n>> Installing xray\n\033[0m"
    Pentest_xray_Install
    echo -e "\033[1;33m\n>> Installing Nuclei\n\033[0m"
    Pentest_Nuclei_Install
    Pentest_nuclei-templates_Install
    # echo -e "\033[1;33m\n>> Installing w13scan\n\033[0m"
    # Pentest_w13scan_Install
    echo -e "\033[1;33m\n>> Installing swagger-exp\n\033[0m"
    Pentest_swagger-exp_Install
    echo -e "\033[1;33m\n>> Installing swagger-hack\n\033[0m"
    Pentest_swagger-hack_Install
    echo -e "\033[1;33m\n>> Installing ysoserial\n\033[0m"
    Pentest_ysoserial_Install
    # echo -e "\033[1;33m\n>> Installing ysuserial\n\033[0m"
    # Pentest_ysuserial_Install
    echo -e "\033[1;33m\n>> Installing JNDI-Injection-Exploit\n\033[0m"
    Pentest_JNDI-Injection-Exploit_Install
    echo -e "\033[1;33m\n>> Installing marshalsec\n\033[0m"
    Pentest_marshalsec_Install
    echo -e "\033[1;33m\n>> Installing ysomap\n\033[0m"
    Pentest_ysomap_Install
    # echo -e "\033[1;33m\n>> Installing SSRFmap\n\033[0m"
    # Pentest_SSRFmap_Install
    echo -e "\033[1;33m\n>> Installing Gopherus\n\033[0m"
    Pentest_Gopherus_Install
    echo -e "\033[1;33m\n>> Installing CDK\n\033[0m"
    Pentest_CDK_Install
    echo -e "\033[1;33m\n>> Installing rogue_mysql_server\n\033[0m"
    Pentest_rogue_mysql_server_Install
    # echo -e "\033[1;33m\n>> Installing cf\n\033[0m"
    # Pentest_cf_Install

    # echo -e "\033[1;33m\n>> Installing testssl.sh\n\033[0m"
    # Pentest_testssl_Install
    # echo -e "\033[1;33m\n>> Installing dalfox\n\033[0m"
    # Pentest_dalfox_Install
    # Pentest_pocsuite3_Install
    # Pentest_commix_Install
    # Pentest_tplmap_Install
    # Pentest_OpenRedireX_Install
    # Pentest_CORScanner_Install
    # Pentest_remote-method-guesser_Install
    # Pentest_redis-rogue-server_Install
    # Pentest_redis-rogue-server-win_Install
    # Pentest_redis-rce_Install
    # Pentest_redis_lua_exploit_Install
    # Pentest_shiro_rce_tool_Install
    # Pentest_shiro-exploit_Install
    # Pentest_JNDIExploit_Install
    # Pentest_JNDIExploit_0x727_Install

}

kali_Tools_TypeC(){

    echo -e "\033[1;33m\n>> Installing impacket\n\033[0m"
    Pentest_Impacket_Install
    echo -e "\033[1;33m\n>> Installing Responder\n\033[0m"
    Pentest_Responder_Install
    echo -e "\033[1;33m\n>> Installing krbrelayx\n\033[0m"
    Pentest_krbrelayx_Install
    echo -e "\033[1;33m\n>> Installing bettercap\n\033[0m"
    Pentest_bettercap_Install
    echo -e "\033[1;33m\n>> Installing mitmproxy\n\033[0m"
    Pentest_mitmproxy_Install
    echo -e "\033[1;33m\n>> Installing pypykatz\n\033[0m"
    Pentest_pypykatz_Install
    echo -e "\033[1;33m\n>> Installing CrackMapExec\n\033[0m"
    Pentest_CrackMapExec_Install
    echo -e "\033[1;33m\n>> Installing NetExec\n\033[0m"
    Pentest_NetExec_Install
    echo -e "\033[1;33m\n>> Installing Neo-reGeorg\n\033[0m"
    Pentest_Neo-reGeorg_Install
    echo -e "\033[1;33m\n>> Installing suo5\n\033[0m"
    Pentest_suo5_Install
    echo -e "\033[1;33m\n>> Installing kerbrute\n\033[0m"
    Pentest_kerbrute_Install
    echo -e "\033[1;33m\n>> Installing Adinfo\n\033[0m"
    Pentest_Adinfo_Install
    echo -e "\033[1;33m\n>> Installing PetitPotam\n\033[0m"
    Pentest_PetitPotam_Install
    echo -e "\033[1;33m\n>> Installing iox\n\033[0m"
    Pentest_iox_Install
    echo -e "\033[1;33m\n>> Installing chisel\n\033[0m"
    Pentest_chisel_Install

}

kali_Tools_TypeD(){

    echo -e "\033[1;33m\n>> Installing hashcat、7z2hashcat\n\033[0m"
    Pentest_hashcat_Install
    echo -e "\033[1;33m\n>> Installing ZoomEye-python\n\033[0m"
    Pentest_ZoomEye_Install
    echo -e "\033[1;33m\n>> Installing jadx\n\033[0m"
    Pentest_jadx_Install
    echo -e "\033[1;33m\n>> Installing ncat\n\033[0m"
    Pentest_ncat_Install
    echo -e "\033[1;33m\n>> Installing mapcidr\n\033[0m"
    Pentest_mapcidr_Install
    echo -e "\033[1;33m\n>> Installing dnsx\n\033[0m"
    Pentest_dnsx_Install
    echo -e "\033[1;33m\n>> Installing uncover\n\033[0m"
    Pentest_uncover_Install
    echo -e "\033[1;33m\n>> Installing nali\n\033[0m"
    Pentest_nali_Install
    echo -e "\033[1;33m\n>> Installing anew\n\033[0m"
    Pentest_anew_Install
    echo -e "\033[1;33m\n>> Installing gron\n\033[0m"
    Pentest_gron_Install
    # echo -e "\033[1;33m\n>> Installing Interlace\n\033[0m"
    # Pentest_Interlace_Install
    echo -e "\033[1;33m\n>> Installing sttr\n\033[0m"
    Pentest_sttr_Install
    echo -e "\033[1;33m\n>> Installing unfurl\n\033[0m"
    Pentest_unfurl_Install
    echo -e "\033[1;33m\n>> Installing qsreplace\n\033[0m"
    Pentest_qsreplace_Install
    echo -e "\033[1;33m\n>> Installing Platypus\n\033[0m"
    Pentest_Platypus_Install
    echo -e "\033[1;33m\n>> Installing MoreFind\n\033[0m"
    Pentest_MoreFind_Install
    echo -e "\033[1;33m\n>> Installing alterx\n\033[0m"
    Pentest_alterx_Install

}

kali_Tools_TypeE(){

    echo -e "\033[1;33m\n>> Installing SecLists(~500M),longer time, wait patiently\n\033[0m"
    Pentest_SecLists_Install
    echo -e "\033[1;33m\n>> Installing See-SURF\n\033[0m"
    Pentest_See-SURF_Install
    echo -e "\033[1;33m\n>> Installing hakrawler\n\033[0m"
    Pentest_hakrawler_Install
    echo -e "\033[1;33m\n>> Installing subjs\n\033[0m"
    Pentest_subjs_Install
    echo -e "\033[1;33m\n>> Installing assetfinder\n\033[0m"
    Pentest_assetfinder_Install

    # Pentest_exploitdb_Install
    # Pentest_RustScan_Install

}

# -ad
Ad_Tools(){

    echo -e "\033[1;33m\n>> Installing impacket\n\033[0m"
    Pentest_Impacket_Install
    echo -e "\033[1;33m\n>> Installing Responder\n\033[0m"
    Pentest_Responder_Install
    echo -e "\033[1;33m\n>> Installing krbrelayx\n\033[0m"
    Pentest_krbrelayx_Install
    echo -e "\033[1;33m\n>> Installing bettercap\n\033[0m"
    Pentest_bettercap_Install
    echo -e "\033[1;33m\n>> Installing mitmproxy\n\033[0m"
    Pentest_mitmproxy_Install
    echo -e "\033[1;33m\n>> Installing pypykatz\n\033[0m"
    Pentest_pypykatz_Install
    echo -e "\033[1;33m\n>> Installing CrackMapExec\n\033[0m"
    Pentest_CrackMapExec_Install
    echo -e "\033[1;33m\n>> Installing NetExec\n\033[0m"
    Pentest_NetExec_Install
    echo -e "\033[1;33m\n>> Installing Neo-reGeorg\n\033[0m"
    Pentest_Neo-reGeorg_Install
    echo -e "\033[1;33m\n>> Installing suo5\n\033[0m"
    Pentest_suo5_Install
    echo -e "\033[1;33m\n>> Installing kerbrute\n\033[0m"
    Pentest_kerbrute_Install
    echo -e "\033[1;33m\n>> Installing Adinfo\n\033[0m"
    Pentest_Adinfo_Install
    echo -e "\033[1;33m\n>> Installing PetitPotam\n\033[0m"
    Pentest_PetitPotam_Install
    echo -e "\033[1;33m\n>> Installing Certipy\n\033[0m"
    Pentest_Certipy_Install
    echo -e "\033[1;33m\n>> Installing PKINITtools\n\033[0m"
    Pentest_PKINITtools_Install
    echo -e "\033[1;33m\n>> Installing xfreerdp\n\033[0m"
    Pentest_xfreerdp_Install
    echo -e "\033[1;33m\n>> Installing mitm6\n\033[0m"
    Pentest_mitm6_Install
    echo -e "\033[1;33m\n>> Installing Coercer\n\033[0m"
    Pentest_Coercer_Install
    echo -e "\033[1;33m\n>> Installing ldeep\n\033[0m"
    Pentest_ldeep_Install
    echo -e "\033[1;33m\n>> Installing enum4linux-ng\n\033[0m"
    Pentest_enum4linux_ng_Install
    echo -e "\033[1;33m\n>> Installing bloodyAD\n\033[0m"
    Pentest_bloodyAD_Install
    echo -e "\033[1;33m\n>> Installing bloodhound-python\n\033[0m"
    Pentest_bloodhound_python_Install
    echo -e "\033[1;33m\n>> Installing proxychains4\n\033[0m"
    Pentest_proxychains4_Install
    echo -e "\033[1;33m\n>> Installing minikerberos\n\033[0m"
    Pentest_minikerberos_Install
    echo -e "\033[1;33m\n>> Installing gMSADumper\n\033[0m"
    Pentest_gMSADumper_Install
    echo -e "\033[1;33m\n>> Installing Exegol\n\033[0m"
    Pentest_Exegol_Install
    echo -e "\033[1;33m\n>> Installing john\n\033[0m"
    Pentest_john_Install
    echo -e "\033[1;33m\n>> Installing ldapsearch\n\033[0m"
    Pentest_ldapsearch_Install
    echo -e "\033[1;33m\n>> Installing evil-winrm\n\033[0m"
    Pentest_evil_winrm_Install
    echo -e "\033[1;33m\n>> Installing ligolo-ng (proxy)\n\033[0m"
    Pentest_ligolo_ng_Install
    echo -e "\033[1;33m\n>> Installing linpeas\n\033[0m"
    Pentest_linpeas_Install
    echo -e "\033[1;33m\n>> Installing pyGPOAbuse\n\033[0m"
    Pentest_pyGPOAbuse_Install
    echo -e "\033[1;33m\n>> Installing PassTheCert\n\033[0m"
    Pentest_PassTheCert_Install
    echo -e "\033[1;33m\n>> Installing targetedKerberoast\n\033[0m"
    Pentest_targetedKerberoast_Install
    echo -e "\033[1;33m\n>> Installing noPac\n\033[0m"
    Pentest_noPac_Install
    echo -e "\033[1;33m\n>> Installing zerologon\n\033[0m"
    Pentest_zerologon_Install
    echo -e "\033[1;33m\n>> Installing lsassy\n\033[0m"
    Pentest_lsassy_Install
    echo -e "\033[1;33m\n>> Installing DonPAPI\n\033[0m"
    Pentest_DonPAPI_Install
    echo -e "\033[1;33m\n>> Installing pywhisker\n\033[0m"
    Pentest_pywhisker_Install
    echo -e "\033[1;33m\n>> Installing DFSCoerce\n\033[0m"
    Pentest_DFSCoerce_Install
    echo -e "\033[1;33m\n>> Installing ShadowCoerce\n\033[0m"
    Pentest_ShadowCoerce_Install
    echo -e "\033[1;33m\n>> Installing GPOwned\n\033[0m"
    Pentest_GPOwned_Install
    echo -e "\033[1;33m\n>> Installing gpp-decrypt\n\033[0m"
    Pentest_gpp_decrypt_Install
    echo -e "\033[1;33m\n>> Installing PowerSharpPack\n\033[0m"
    Pentest_PowerSharpPack_Install

}

# -b
Base_Install(){

    echo -e "\033[1;33m\n>> Installing basic tools\n\033[0m"
    Base_Tools

}

# -s
Secure(){
    Install_Switch "unhide"

    echo -e "\033[1;33m\n>> Installing Fail2Ban\n\033[0m"
    Secure_Fail2Ban_Install
    echo -e "\033[1;33m\n>> Installing rkhunter\n\033[0m"
    Secure_rkhunter_Install
    echo -e "\033[1;33m\n>> Installing anti-portscan\n\033[0m"
    Secure_anti_portscan_Install

    case $Linux_architecture_Name in
        *"linux-x86_64"*)
            echo -e "\033[1;33m\n>> Installing shellpub\n\033[0m"
            Secure_shellpub_Install
            echo -e "\033[1;33m\n>> Installing BruteShark\n\033[0m"
            Secure_BruteShark_Install
            ;;
    esac

}

# -cloud
cloud(){

    echo -e "\033[1;33m\n>> Installing Terraform\n\033[0m"
    Terraform_Install

    # echo -e "\033[1;33m\n>> Installing aliyun-cli\n\033[0m"
    # aliyun-cli_Install

    # echo -e "\033[1;33m\n>> Installing aws-cli\n\033[0m"
    # aws-cli_Install

    echo -e "\033[1;33m\n>> Installing redc\n\033[0m"
    redc_Install

    echo -e "\033[1;33m\n>> Installing k8spider\n\033[0m"
    Pentest_k8spider_Install

    echo -e "\033[1;33m\n>> Installing ingressnightmare\n\033[0m"
    Pentest_ingressnightmare_Install

    echo -e "\033[1;33m\n>> Installing kubectl\n\033[0m"
    Pentest_kubectl_Install

    echo -e "\033[1;33m\n>> Installing kubeletctl\n\033[0m"
    Pentest_kubeletctl_Install

    echo -e "\033[1;33m\n>> Installing peirates\n\033[0m"
    Pentest_peirates_Install

    echo -e "\033[1;33m\n>> Installing etcdctl\n\033[0m"
    Pentest_etcdctl_Install

    echo -e "\033[1;33m\n>> Installing tccli\n\033[0m"
    Pentest_tccli_Install

    # echo -e "\033[1;33m\n>> Continue installation Serverless Framework? [y/N,Default N] \033[0m" && read -r input
    # case $input in
    #     [yY][eE][sS]|[Yy])
    #         nn_Check
    #         echo -e "\033[1;33m\n>> Installing Serverless Framework\n\033[0m"
    #         Serverless_Framework_Install
    #         ;;
    #     *)
    #         Echo_INFOR "Pass~"
    #         ;;
    # esac

}

# -ssh
SSH(){

    echo -e "\033[1;33m\n>> Configuring SSH\n\033[0m"
    SSH_Tools

}

# ===================== Tool Map for -install / --list-tools / --search =====================
# Each line: tool_name|Install_Function|dep_level
# dep_level: 0=basic only, 1=needs python, 2=needs go, 3=needs python+go
F8X_TOOL_LIST="
nmap|Pentest_nmap_Install|0
masscan|Pentest_masscan_Install|0
httpx|Pentest_httpx_Install|0
subfinder|Pentest_subfinder_Install|0
ffuf|Pentest_ffuf_Install|0
dirsearch|Pentest_dirsearch_Install|0
fscan|Pentest_fscan_Install|0
katana|Pentest_katana_Install|0
amass|Pentest_Amass_Install|0
naabu|Pentest_naabu_Install|2
ksubdomain|Pentest_ksubdomain_Install|2
rad|Pentest_rad_Install|0
crawlergo|Pentest_crawlergo_Install|0
gobuster|Pentest_gobuster_Install|0
gau|Pentest_gau_Install|2
arjun|Pentest_Arjun_Install|0
jsfinder|Pentest_JSFinder_Install|1
secretfinder|Pentest_SecretFinder_Install|1
oneforall|Pentest_OneForAll_Install|1
netspy|Pentest_netspy_Install|0
fingerprintx|Pentest_fingerprintx_Install|0
asnmap|Pentest_asnmap_Install|0
tlsx|Pentest_tlsx_Install|0
gogo|Pentest_gogo_Install|0
spray|Pentest_spray_Install|0
zombie|Pentest_zombie_Install|0
ccupp|Pentest_ccupp_Install|0
githacker|Pentest_GitHacker_Install|0
hostcollision|Pentest_HostCollision_Install|0
appinfoscanner|Pentest_AppInfoScanner_Install|0
apkanalyser|Pentest_ApkAnalyser_Install|0
apkleaks|Pentest_apkleaks_Install|0
apktool|Pentest_apktool_Install|0
diggy|Pentest_Diggy_Install|0
dddd|Pentest_dddd_Install|0
afrog|Pentest_afrog_Install|0
gospider|Pentest_gospider_Install|0
dismap|Pentest_dismap_Install|0
nuclei|Pentest_Nuclei_Install|0
nuclei-templates|Pentest_nuclei-templates_Install|0
sqlmap|Pentest_Sqlmap_Install|1
xray|Pentest_xray_Install|0
metasploit|Pentest_Metasploit_Install|0
w13scan|Pentest_w13scan_Install|1
swagger-exp|Pentest_swagger-exp_Install|0
swagger-hack|Pentest_swagger-hack_Install|1
ysoserial|Pentest_ysoserial_Install|0
ysuserial|Pentest_ysuserial_Install|0
jndi-injection-exploit|Pentest_JNDI-Injection-Exploit_Install|0
jndiexploit|Pentest_JNDIExploit_Install|0
marshalsec|Pentest_marshalsec_Install|0
ysomap|Pentest_ysomap_Install|0
ssrfmap|Pentest_SSRFmap_Install|1
gopherus|Pentest_Gopherus_Install|0
rogue_mysql_server|Pentest_rogue_mysql_server_Install|0
cdk|Pentest_CDK_Install|0
k8spider|Pentest_k8spider_Install|0
ingressnightmare|Pentest_ingressnightmare_Install|0
kubectl|Pentest_kubectl_Install|0
kubeletctl|Pentest_kubeletctl_Install|0
peirates|Pentest_peirates_Install|0
etcdctl|Pentest_etcdctl_Install|0
tccli|Pentest_tccli_Install|0
dalfox|Pentest_dalfox_Install|0
commix|Pentest_commix_Install|1
pocsuite3|Pentest_pocsuite3_Install|0
impacket|Pentest_Impacket_Install|1
responder|Pentest_Responder_Install|1
krbrelayx|Pentest_krbrelayx_Install|0
bettercap|Pentest_bettercap_Install|2
mitmproxy|Pentest_mitmproxy_Install|0
pypykatz|Pentest_pypykatz_Install|0
crackmapexec|Pentest_CrackMapExec_Install|0
netexec|Pentest_NetExec_Install|0
neo-regeorg|Pentest_Neo-reGeorg_Install|0
suo5|Pentest_suo5_Install|0
kerbrute|Pentest_kerbrute_Install|2
adinfo|Pentest_Adinfo_Install|2
petitpotam|Pentest_PetitPotam_Install|0
hashcat|Pentest_hashcat_Install|0
zoomeye|Pentest_ZoomEye_Install|0
jadx|Pentest_jadx_Install|0
ncat|Pentest_ncat_Install|0
mapcidr|Pentest_mapcidr_Install|0
dnsx|Pentest_dnsx_Install|0
uncover|Pentest_uncover_Install|0
nali|Pentest_nali_Install|0
anew|Pentest_anew_Install|0
gron|Pentest_gron_Install|0
interlace|Pentest_Interlace_Install|1
sttr|Pentest_sttr_Install|0
unfurl|Pentest_unfurl_Install|2
qsreplace|Pentest_qsreplace_Install|2
platypus|Pentest_Platypus_Install|0
morefind|Pentest_MoreFind_Install|0
alterx|Pentest_alterx_Install|0
seclists|Pentest_SecLists_Install|0
see-surf|Pentest_See-SURF_Install|1
hakrawler|Pentest_hakrawler_Install|2
subjs|Pentest_subjs_Install|2
assetfinder|Pentest_assetfinder_Install|2
frp|frp_Install|0
iox|Pentest_iox_Install|0
chisel|Pentest_chisel_Install|0
xfreerdp|Pentest_xfreerdp_Install|0
mitm6|Pentest_mitm6_Install|1
coercer|Pentest_Coercer_Install|1
ldeep|Pentest_ldeep_Install|1
enum4linux-ng|Pentest_enum4linux_ng_Install|1
bloodyAD|Pentest_bloodyAD_Install|1
bloodhound-python|Pentest_bloodhound_python_Install|1
proxychains4|Pentest_proxychains4_Install|0
minikerberos|Pentest_minikerberos_Install|1
gMSADumper|Pentest_gMSADumper_Install|1
exegol|Pentest_Exegol_Install|1
john|Pentest_john_Install|0
ldapsearch|Pentest_ldapsearch_Install|0
evil-winrm|Pentest_evil_winrm_Install|0
ligolo-ng|Pentest_ligolo_ng_Install|0
linpeas|Pentest_linpeas_Install|0
pyGPOAbuse|Pentest_pyGPOAbuse_Install|1
PassTheCert|Pentest_PassTheCert_Install|1
targetedKerberoast|Pentest_targetedKerberoast_Install|1
noPac|Pentest_noPac_Install|1
zerologon|Pentest_zerologon_Install|1
lsassy|Pentest_lsassy_Install|0
donpapi|Pentest_DonPAPI_Install|0
pywhisker|Pentest_pywhisker_Install|1
dfscoerce|Pentest_DFSCoerce_Install|1
shadowcoerce|Pentest_ShadowCoerce_Install|1
gpowned|Pentest_GPOwned_Install|1
gpp-decrypt|Pentest_gpp_decrypt_Install|0
powersharppack|Pentest_PowerSharpPack_Install|1
playwright-mcp|Pentest_playwright_mcp_Install|0
claude-code|Pentest_claude_code_Install|0
nps|nps_Install|0
redguard|RedGuard_Install|0
interactsh|interactsh_Install|0
merlin|merlin_Install|0
wpscan|wpscan_Install|0
yakit|yakit_Install|0
bypass|bypass_Install|2
aircrack|aircrack_Install|0
binwalk|binwalk_Install|0
clamav|clamav_Install|0
volatility|Volatility_Install|1
suricata|suricata_Install|0
docker|Docker_Install|0
golang|Go_Install|0
nodejs|nn_Install|0
ruby|Ruby_Install|0
rust|Rust_Install|0
nginx|nginx_Install|0
jq|jq_Install|0
arl|arl_Install|0
mobsf|mobsf_Install|0
mythic|mythic_Install|0
viper|viper_Install|0
vulhub|vulhub_Install|0
vulfocus|vulfocus_Install|0
"

# -install <tool>: install a single tool by name
F8x_Install_Tool(){
    local tool_name=$(echo "$1" | tr 'A-Z' 'a-z')
    local entry=$(echo "$F8X_TOOL_LIST" | grep "^${tool_name}|" | head -1)

    if [ -z "$entry" ]; then
        Echo_ERROR "Unknown tool: $1"
        echo -e "\033[1;33mAvailable tools similar to '$1':\033[0m"
        F8x_Search_Tool "$1"
        echo -e "\nUse \033[1;34m./f8x --list-tools\033[0m to see all available tools"
        return 1
    fi

    local func=$(echo "$entry" | cut -d'|' -f2)
    local dep_level=$(echo "$entry" | cut -d'|' -f3)

    echo -e "\033[1;33m\n>> Installing $1 (function: $func, deps: $dep_level)\n\033[0m"

    mac_Check || return 1
    Proxy_Switch
    Base_Check

    if [ "$dep_level" -ge 1 ]; then
        echo -e "\033[1;33m>> Checking Python dependency...\033[0m"
        Py_Check
    fi
    if [ "$dep_level" -ge 2 ]; then
        echo -e "\033[1;33m>> Checking Go dependency...\033[0m"
        GO_Check
    fi

    $func
    F8x_Record_Install "$tool_name" "install"
    echo -e "\033[1;32m\n>> $1 installation completed\033[0m"
}

# --list-tools: output machine-readable tool catalog
F8x_List_Tools(){
    local format=${1:-"json"}

    if [ "$format" = "table" ]; then
        printf "%-25s %-15s %s\n" "TOOL" "DEPS" "FUNCTION"
        printf "%-25s %-15s %s\n" "----" "----" "--------"
        echo "$F8X_TOOL_LIST" | grep -v '^$' | sort | while IFS='|' read -r tool func dep; do
            local dep_str="basic"
            [ "$dep" = "1" ] && dep_str="python"
            [ "$dep" = "2" ] && dep_str="go"
            [ "$dep" = "3" ] && dep_str="python+go"
            printf "%-25s %-15s %s\n" "$tool" "$dep_str" "$func"
        done
        return
    fi

    echo '['
    local first=true
    echo "$F8X_TOOL_LIST" | grep -v '^$' | sort | while IFS='|' read -r tool func dep; do
        local dep_str="basic"
        [ "$dep" = "1" ] && dep_str="python"
        [ "$dep" = "2" ] && dep_str="go"
        [ "$dep" = "3" ] && dep_str="python+go"
        $first || echo ','
        printf '  {"name":"%s","function":"%s","deps":"%s"}' "$tool" "$func" "$dep_str"
        first=false
    done
    echo -e '\n]'
}

# --search <keyword>: fuzzy search tools by name
F8x_Search_Tool(){
    local keyword=$(echo "$1" | tr 'A-Z' 'a-z')
    local found=0
    echo "$F8X_TOOL_LIST" | grep -v '^$' | sort | while IFS='|' read -r tool func dep; do
        if echo "$tool" | grep -qi "$keyword"; then
            local dep_str="basic"
            [ "$dep" = "1" ] && dep_str="python"
            [ "$dep" = "2" ] && dep_str="go"
            [ "$dep" = "3" ] && dep_str="python+go"
            printf "  %-25s (deps: %-10s func: %s)\n" "$tool" "$dep_str" "$func"
        fi
    done
    local count=$(echo "$F8X_TOOL_LIST" | grep -v '^$' | grep -i "$keyword" | wc -l | tr -d ' ')
    if [ "$count" -eq 0 ]; then
        echo "  No tools found matching '$keyword'"
    else
        echo -e "\n  Found $count tool(s). Use \033[1;34m./f8x -install <tool>\033[0m to install."
    fi
}

# Record a successful tool installation to /opt/.f8x/installed.json
F8x_Record_Install(){
    local tool_name="$1"
    local method="$2"  # "install" or "flag:<flag>"
    local install_file="/opt/.f8x/installed.json"
    local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

    mkdir -p /opt/.f8x

    if command -v jq &>/dev/null && [ -f "$install_file" ]; then
        # Use jq to update existing file
        local tmp=$(mktemp)
        jq --arg name "$tool_name" --arg at "$timestamp" --arg m "$method" --arg ver "$F8x_Version" \
            '.tools[$name] = {"installed_at": $at, "method": $m} | .f8x_version = $ver | .last_updated = $at' \
            "$install_file" > "$tmp" && mv "$tmp" "$install_file"
    else
        # Bootstrap or no jq: simple printf approach
        if [ ! -f "$install_file" ]; then
            printf '{"tools":{"%s":{"installed_at":"%s","method":"%s"}},"f8x_version":"%s","last_updated":"%s"}\n' \
                "$tool_name" "$timestamp" "$method" "$F8x_Version" "$timestamp" > "$install_file"
        elif command -v jq &>/dev/null; then
            local tmp=$(mktemp)
            jq --arg name "$tool_name" --arg at "$timestamp" --arg m "$method" --arg ver "$F8x_Version" \
                '.tools[$name] = {"installed_at": $at, "method": $m} | .f8x_version = $ver | .last_updated = $at' \
                "$install_file" > "$tmp" && mv "$tmp" "$install_file"
        else
            # Fallback: use sed to insert before the closing brace of "tools"
            local entry="\"$tool_name\":{\"installed_at\":\"$timestamp\",\"method\":\"$method\"}"
            sed -i "s/\"tools\":{/\"tools\":{$entry,/" "$install_file" 2>/dev/null || true
        fi
    fi
}

# -h
Help(){

    echo -e "\033[1;34mBatch installation \033[0m"
    echo -e "  \033[1;34m-b\033[0m \033[0;34m               : install Basic Environment\033[0m          \033[1;32m(gcc、make、git、vim、telnet、jq、unzip ...)\033[0m"
    echo -e "  \033[1;34m-p\033[0m \033[0;34m               : install Proxy Environment\033[0m          \033[1;31m(Warning : Use only when needed)\033[0m"
    echo -e "  \033[1;34m-d\033[0m \033[0;34m               : install Development Environment\033[0m    \033[1;32m(python3、pip3、Go、Docker、Docker-Compose、SDKMAN)\033[0m"
    echo -e "  \033[1;34m-k(a/b/c/d/e)\033[0m\033[0;34m     : install Pentest environment\033[0m        \033[1;32m(hashcat、ffuf、OneForAll、ksubdomain、impacket ...)\033[0m"
    echo -e "  \033[1;34m-s\033[0m \033[0;34m               : install Blue Team Environment\033[0m      \033[1;32m(Fail2Ban、chkrootkit、rkhunter、shellpub)\033[0m"
    echo -e "  \033[1;34m-f\033[0m \033[0;34m               : install Other Tools\033[0m                \033[1;32m(AdguardTeam、trash-cli、fzf)\033[0m"
    echo -e "  \033[1;34m-cloud\033[0m \033[0;34m           : install Cloud Applications\033[0m         \033[1;32m(Terraform、Serverless Framework、wrangler)\033[0m"
    echo -e "  \033[1;34m-all\033[0m \033[0;34m             : fully automated deployment\033[0m"
    echo -e ""
    echo -e "\033[1;34mDevelopment Environment \033[0m"
    echo -e "  \033[1;34m-docker\033[0m \033[0;34m          : install docker\033[0m"
    echo -e "  \033[1;34m-docker-cn\033[0m \033[0;34m       : install docker (aliyun source)\033[0m"
    echo -e "  \033[1;34m-lua\033[0m \033[0;34m             : install lua\033[0m"
    echo -e "  \033[1;34m-nn\033[0m \033[0;34m              : install npm & NodeJs\033[0m"
    echo -e "  \033[1;34m-go\033[0m\033[0;34m               : install golang\033[0m"
    echo -e "  \033[1;34m-oraclejdk(8/11/17)\033[0m\033[0;34m install oraclejdk\033[0m"
    echo -e "  \033[1;34m-openjdk\033[0m \033[0;34m         : install openjdk\033[0m"
    echo -e "  \033[1;34m-py3(7/8/9/10)\033[0m\033[0;34m    : install python3\033[0m                    \033[1;33m(Based on package manager)\033[0m"
    echo -e "  \033[1;34m-py2\033[0m \033[0;34m             : install python2\033[0m                    \033[1;33m(Based on package manager)\033[0m"
    echo -e "  \033[1;34m-py2-f\033[0m \033[0;34m           : force install python2\033[0m              \033[1;33m(It is recommended to run with the -python2 option failing)\033[0m"
    echo -e "  \033[1;34m-pip2-f\033[0m \033[0;34m          : force install pip2\033[0m                 \033[1;33m(It is recommended to run with the -python2 option failing)\033[0m"
    echo -e "  \033[1;34m-pyenv\033[0m\033[0;34m            : install pyenv\033[0m"
    echo -e "  \033[1;34m-perl\033[0m \033[0;34m            : install perl\033[0m"
    echo -e "  \033[1;34m-ruby\033[0m \033[0;34m            : install ruby\033[0m                       \033[1;33m(If that fails, try -ruby-f)\033[0m"
    echo -e "  \033[1;34m-rust\033[0m \033[0;34m            : install rust\033[0m"
    echo -e "  \033[1;34m-code\033[0m \033[0;34m            : install code-server\033[0m"
    echo -e "  \033[1;34m-chromium\033[0m \033[0;34m        : install Chromium\033[0m                   \033[1;33m(Used with rad, crawlergo in the -k option) \033[0m"
    echo -e "  \033[1;34m-crawl\033[0m \033[0;34m           : install crawl tools\033[0m"
    echo -e "  \033[1;34m-phantomjs\033[0m \033[0;34m       : install PhantomJS\033[0m"
    #echo -e "  \033[1;34m-k8s\033[0m \033[0;34m             : install k8s\033[0m"
    echo -e ""
    echo -e "\033[1;34mBlue Team Tools \033[0m"
    echo -e "  \033[1;34m-binwalk\033[0m \033[0;34m         : install binwalk\033[0m"
    echo -e "  \033[1;34m-binwalk-f\033[0m \033[0;34m       : force install binwalk\033[0m              \033[1;33m(It is recommended to run if the -binwalk option fails)\033[0m"
    echo -e "  \033[1;34m-clamav\033[0m \033[0;34m          : install ClamAV\033[0m"
    echo -e "  \033[1;34m-lt\033[0m \033[0;34m              : install LogonTracer\033[0m                \033[1;33m(High hardware configuration requirements)\033[0m"
    echo -e "  \033[1;34m-suricata\033[0m \033[0;34m        : install Suricata\033[0m"
    echo -e "  \033[1;34m-vol\033[0m \033[0;34m             : install volatility\033[0m"
    echo -e "  \033[1;34m-vol3\033[0m \033[0;34m            : install volatility3\033[0m"
    echo -e ""
    echo -e "\033[1;34mRed Team Tools \033[0m"
    echo -e "  \033[1;34m-aircrack\033[0m \033[0;34m        : install aircrack-ng\033[0m"
    echo -e "  \033[1;34m-bypass\033[0m \033[0;34m          : install Bypass\033[0m"
    echo -e "  \033[1;34m-wpscan\033[0m \033[0;34m          : install wpscan\033[0m"
    echo -e "  \033[1;34m-wx\033[0m \033[0;34m              : install wxappUnpacker\033[0m"
    echo -e "  \033[1;34m-yakit\033[0m \033[0;34m           : install yakit\033[0m"
    echo -e ""
    echo -e "\033[1;34mRed Team Infrastructure \033[0m"
    echo -e "  \033[1;34m-arl\033[0m \033[0;34m             : install ARL (~872 MB)\033[0m              \033[1;33m(https://github.com/TophantTechnology/ARL)\033[0m"
    echo -e "  \033[1;34m-awvs15\033[0m \033[0;34m          : install AWVS15\033[0m"
    echo -e "  \033[1;34m-cs45\033[0m \033[0;34m            : install CobaltStrike 4.5\033[0m"
    echo -e "  \033[1;34m-frp\033[0m \033[0;34m             : install frp\033[0m"
    echo -e "  \033[1;34m-iox\033[0m \033[0;34m             : install iox\033[0m                        \033[1;33m(https://github.com/EddieIvan01/iox)\033[0m"
    echo -e "  \033[1;34m-chisel\033[0m \033[0;34m          : install chisel\033[0m                     \033[1;33m(https://github.com/jpillora/chisel)\033[0m"
    echo -e "  \033[1;34m-evil-winrm\033[0m \033[0;34m      : install evil-winrm\033[0m                 \033[1;33m(https://github.com/Hackplayers/evil-winrm)\033[0m"
    echo -e "  \033[1;34m-playwright-mcp\033[0m \033[0;34m  : install @playwright/mcp\033[0m             \033[1;33m(https://github.com/nichochar/playwright-mcp)\033[0m"
    echo -e "  \033[1;34m-claude-code\033[0m \033[0;34m     : install Claude Code CLI\033[0m            \033[1;33m(https://docs.anthropic.com/en/docs/claude-code)\033[0m"
    echo -e "  \033[1;34m-interactsh\033[0m \033[0;34m      : install interactsh\033[0m                 \033[1;33m(https://github.com/projectdiscovery/interactsh)\033[0m"
    echo -e "  \033[1;34m-merlin\033[0m \033[0;34m          : install merlin\033[0m                     \033[1;33m(https://github.com/Ne0nd0g/merlin)\033[0m"
    echo -e "  \033[1;34m-msf\033[0m \033[0;34m             : install Metasploit\033[0m"
    echo -e "  \033[1;34m-mobsf\033[0m \033[0;34m           : install MobSF (~1.54 GB)\033[0m"
    echo -e "  \033[1;34m-mythic\033[0m \033[0;34m          : install mythic\033[0m                     \033[1;33m(建议使用国外地区的vps,不然部署速度太慢了)\033[0m"
    echo -e "  \033[1;34m-nodejsscan\033[0m \033[0;34m      : install nodejsscan (~873 MB)\033[0m"
    echo -e "  \033[1;34m-nps\033[0m \033[0;34m             : install nps\033[0m"
    echo -e "  \033[1;34m-pupy\033[0m \033[0;34m            : install pupy\033[0m\033[0m                       \033[1;33m(https://github.com/n1nj4sec/pupy)\033[0m"
    echo -e "  \033[1;34m-rg\033[0m \033[0;34m              : install RedGuard\033[0m                   \033[1;33m(https://github.com/wikiZ/RedGuard)\033[0m"
    echo -e "  \033[1;34m-http\033[0m \033[0;34m            : install simplehttpserver\033[0m"
    echo -e "  \033[1;34m-sliver\033[0m \033[0;34m          : install sliver-server && client\033[0m\033[0m    \033[1;33m(https://github.com/BishopFox/sliver)\033[0m"
    echo -e "  \033[1;34m-sliver-client\033[0m \033[0;34m   : install sliver-client\033[0m\033[0m"
    echo -e "  \033[1;34m-sps\033[0m \033[0;34m             : install SharPyShell\033[0m\033[0m                \033[1;33m(https://github.com/antonioCoco/SharPyShell)\033[0m"
    echo -e "  \033[1;34m-viper\033[0m \033[0;34m           : install Viper (~2.1 GB)\033[0m\033[0m            \033[1;33m(https://github.com/FunnyWolf/Viper)\033[0m"
    echo -e ""
    echo -e "\033[1;34mVulnerable Environments\033[0m"
    echo -e "  \033[1;34m-metarget\033[0m \033[0;34m        : install metarget\033[0m                   \033[1;33m(https://github.com/Metarget/metarget)\033[0m"
    echo -e "  \033[1;34m-vulhub\033[0m \033[0;34m          : install vulhub (~210 MB)\033[0m           \033[1;33m(https://github.com/vulhub/vulhub)\033[0m"
    echo -e "  \033[1;34m-vulfocus\033[0m \033[0;34m        : install vulfocus (~1.04 GB)\033[0m        \033[1;33m(https://github.com/fofapro/vulfocus)\033[0m"
    echo -e "  \033[1;34m-TerraformGoat\033[0m \033[0;34m   : install TerraformGoat\033[0m              \033[1;33m(https://github.com/HXSecurity/TerraformGoat)\033[0m"
    echo -e ""
    echo -e "\033[1;34mMiscellaneous Services \033[0m"
    echo -e "  \033[1;34m-asciinema\033[0m \033[0;34m       : install asciinema\033[0m"
    echo -e "  \033[1;34m-aa\033[0m \033[0;34m              : install aaPanel\033[0m                    \033[1;33m(https://www.aapanel.com/)\033[0m"
    echo -e "  \033[1;34m-1panel\033[0m \033[0;34m          : install 1Panel\033[0m"
    echo -e "  \033[1;34m-bt\033[0m \033[0;34m              : install 宝塔服务\033[0m"
    echo -e "  \033[1;34m-clash\033[0m \033[0;34m           : install clash\033[0m"
    # echo -e "  \033[1;34m-music\033[0m \033[0;34m           : install UnblockNeteaseMusic\033[0m"
    echo -e "  \033[1;34m-nginx\033[0m \033[0;34m           : install nginx\033[0m"
    echo -e "  \033[1;34m-ssh\033[0m \033[0;34m             : install ssh\033[0m                        \033[1;33m(RedHat is available by default, no need to reinstall)\033[0m"
    echo -e "  \033[1;34m-ssr\033[0m \033[0;34m             : install ssr\033[0m"
    echo -e "  \033[1;34m-zsh\033[0m \033[0;34m             : install zsh\033[0m"
    echo -e ""
    echo -e "\033[1;34mOther \033[0m"
    echo -e "  \033[1;34m-install <tool>\033[0m \033[0;34m  : install a single tool by name\033[0m       \033[1;32m(e.g. ./f8x -install nuclei)\033[0m"
    echo -e "  \033[1;34m-arsenal\033[0m \033[0;34m         : download multi-platform arsenal\033[0m    \033[1;32m(fscan/gogo/zombie/spray/cdk/iox/frpc/chisel)\033[0m"
    echo -e "  \033[1;34m--list-tools\033[0m \033[0;34m     : list all available tools (JSON)\033[0m     \033[1;32m(use --list-tools table for table format)\033[0m"
    echo -e "  \033[1;34m--search <kw>\033[0m \033[0;34m    : search tools by keyword\033[0m             \033[1;32m(e.g. ./f8x --search scan)\033[0m"
    echo -e "  \033[1;34m-clear\033[0m \033[0;34m           : Clean up system usage traces\033[0m"
    echo -e "  \033[1;34m-info\033[0m \033[0;34m            : View system information\033[0m"
    echo -e "  \033[1;34m-optimize\033[0m \033[0;34m        : Improve device options and optimize performance\033[0m"
    echo -e "  \033[1;34m-remove\033[0m \033[0;34m          : Uninstall some vps cloud monitoring\033[0m"
    echo -e "  \033[1;34m-rmlock\033[0m \033[0;34m          : Run the Unlock module\033[0m"
    echo -e "  \033[1;34m-swap\033[0m \033[0;34m            : Configuring swap partitions\033[0m"
    echo -e "  \033[1;34m-update\033[0m \033[0;34m          : Update f8x\033[0m"
    echo -e "  \033[1;34m-upgrade\033[0m \033[0;34m         : Upgrade some tools\033[0m"
    echo -e ""
    echo -e "\033[1;37mAuthor r0fus0d , feel free to submit an issue if you need to add tool support or run into problems\033[0m"
    echo -e ""

}

# -p
Proxy(){

    echo -e "\033[1;33m\n>> Do you want to update DNS settings? [Y/n,Default Y]\033[0m"
    Change_DNS_IP

    echo -e "\033[1;33m\nPlease enter Source aliyun[a] huawei[h] tuna[t] 默认t\033[0m" && read -r input
    case $input in
        [aA])
            Mirror "aliyun"
            ;;
        [hH])
            Mirror "huawei"
            ;;
        [tT])
            Mirror "tuna"
            ;;
        *)
            Mirror "tuna"
            ;;
    esac

    if [ $Docker_OK != 1 ] 2>> /tmp/f8x_error.log
    then
        echo -e "\033[1;33m\n>> Installing resolvconf\n\033[0m"
        DNS_T00ls
        echo -e "\033[1;33m\n>> Configuring the base compilation environment\n\033[0m"
        Proxychains_Install
    fi

}

# -debug
Debug_Fun(){

    echo -e "none :>"

}

# -arsenal
Arsenal_Build(){

    Arsenal_Dir=${P_Dir}/arsenal
    Arsenal_Platforms="linux_amd64 linux_arm64 windows_amd64"

    echo -e "\033[1;33m\n>> Building Arsenal (multi-platform deliverables)\n\033[0m"
    echo -e "\033[1;34m   Target dir: ${Arsenal_Dir}\033[0m"
    echo -e "\033[1;34m   Platforms : ${Arsenal_Platforms}\033[0m"
    echo -e ""

    # Arsenal tool definitions: name|github_repo|version|file_pattern
    # file_pattern uses {PLATFORM} as placeholder (linux_amd64, linux_arm64, windows_amd64)
    # For windows, .exe suffix is auto-appended if missing
    local ARSENAL_TOOLS="
fscan|shadow1ng/fscan|${fscan_Ver}|fscan_{PLATFORM}
gogo|chainreactors/gogo|${gogo_Ver}|gogo_{PLATFORM}
zombie|chainreactors/zombie|${zombie_Ver}|zombie_{PLATFORM}
spray|chainreactors/spray|${spray_Ver}|spray_{PLATFORM}
cdk|cdk-team/CDK|${cdk_Ver}|cdk_{PLATFORM}
k8spider|Esonhugh/k8spider|${k8spider_Ver}|k8spider_{K8S_PLATFORM}.tar.gz
ingressnightmare|Esonhugh/ingressNightmare-CVE-2025-1974-exps|${ingressnightmare_Ver}|ingressnightmare
kubeletctl|cyberark/kubeletctl|${kubeletctl_Ver}|kubeletctl_{PLATFORM}
peirates|inguardians/peirates|${peirates_Ver}|peirates-{PLATFORM}.tar.xz
etcdctl|etcd-io/etcd|${etcdctl_Ver}|etcd-{PLATFORM}.tar.gz
kubectl|kubernetes/kubectl|${kubectl_Ver}|kubectl
iox|EddieIvan01/iox|${iox_Ver}|iox_{PLATFORM}
frpc|fatedier/frp|${frp_Ver}|frp_{FRP_PLATFORM}.tar.gz
chisel|jpillora/chisel|${chisel_Ver}|chisel_{CHISEL_PLATFORM}.gz
ligolo-agent|nicocha30/ligolo-ng|${ligolo_ng_Ver}|ligolo-ng_agent_{PLATFORM}.tar.gz
linpeas|peass-ng/PEASS-ng|${peass_ng_Ver}|linpeas
winpeas|peass-ng/PEASS-ng|${peass_ng_Ver}|winPEAS
GodPotato|BeichenDream/GodPotato|${GodPotato_Ver}|GodPotato
mimikatz|gentilkiwi/mimikatz|${mimikatz_Ver}|mimikatz_trunk.zip
SharpHound|BloodHoundAD/SharpHound|${SharpHound_Ver}|SharpHound
PrintSpoofer|itm4n/PrintSpoofer|${PrintSpoofer_Ver}|PrintSpoofer
SharpWMI|QAX-A-Team/sharpwmi|${SharpWMI_Ver}|sharpwmi
SharPersist|mandiant/SharPersist|${SharPersist_Ver}|SharPersist
StandIn|FuzzySecurity/StandIn|${StandIn_Ver}|StandIn
"

    local total_ok=0
    local total_fail=0

    echo "$ARSENAL_TOOLS" | grep -v '^$' | while IFS='|' read -r tool_name repo ver pattern; do
        tool_dir="${Arsenal_Dir}/${tool_name}"
        mkdir -p "${tool_dir}"
        echo -e "\033[1;33m>> ${tool_name} ${ver}\033[0m"

        for platform in $Arsenal_Platforms; do
            local dl_url=""
            local out_file=""

            case "${tool_name}" in
                fscan)
                    # fscan uses non-standard naming: fscan (amd64), fscan_arm64, fscan64.exe
                    case "$platform" in
                        linux_amd64)  file_name="fscan" ;;
                        linux_arm64)  file_name="fscan_arm64" ;;
                        windows_amd64) file_name="fscan.exe" ;;
                    esac
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${file_name}"
                    out_file="fscan_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="fscan_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        chmod +x "${tool_dir}/${out_file}"
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                frpc)
                    # frp releases: frp_0.67.0_linux_amd64.tar.gz, frp_0.67.0_windows_amd64.zip
                    local frp_ver_num=$(echo "$ver" | sed 's/^v//')
                    local frp_plat=$(echo "$platform" | sed 's/_/\//' | sed 's/\//_/')
                    if [ "$platform" = "windows_amd64" ]; then
                        local frp_archive="frp_${frp_ver_num}_${frp_plat}.zip"
                    else
                        local frp_archive="frp_${frp_ver_num}_${frp_plat}.tar.gz"
                    fi
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${frp_archive}"
                    out_file="frpc_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="frpc_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_frp_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${frp_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        local frp_dir="frp_${frp_ver_num}_${frp_plat}"
                        if [ "$platform" = "windows_amd64" ]; then
                            unzip -o "${frp_archive}" > /dev/null 2>&1
                            cp "${frp_dir}/frpc.exe" "${tool_dir}/${out_file}" 2>/dev/null
                        else
                            tar -zxf "${frp_archive}" > /dev/null 2>&1
                            cp "${frp_dir}/frpc" "${tool_dir}/${out_file}" 2>/dev/null
                        fi
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                chisel)
                    # chisel releases: chisel_1.11.5_linux_amd64.gz, chisel_1.11.5_windows_amd64.zip
                    local chisel_ver_num=$(echo "$ver" | sed 's/^v//')
                    if [ "$platform" = "windows_amd64" ]; then
                        local chisel_archive="chisel_${chisel_ver_num}_${platform}.zip"
                    else
                        local chisel_archive="chisel_${chisel_ver_num}_${platform}.gz"
                    fi
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${chisel_archive}"
                    out_file="chisel_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="chisel_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_chisel_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${chisel_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        if [ "$platform" = "windows_amd64" ]; then
                            unzip -o "${chisel_archive}" > /dev/null 2>&1
                            cp chisel.exe "${tool_dir}/${out_file}" 2>/dev/null
                        else
                            gunzip "${chisel_archive}" > /dev/null 2>&1
                            local chisel_bin=$(echo "${chisel_archive}" | sed 's/.gz$//')
                            cp "${chisel_bin}" "${tool_dir}/${out_file}" 2>/dev/null
                        fi
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                k8spider)
                    # k8spider: tar.gz for linux/darwin, zip for windows
                    # naming: k8spider_v3.2.0_linux_amd64.tar.gz
                    case "$platform" in
                        linux_amd64)   local k8s_archive="k8spider_${ver}_linux_amd64.tar.gz" ;;
                        linux_arm64)   local k8s_archive="k8spider_${ver}_linux_arm64.tar.gz" ;;
                        windows_amd64) local k8s_archive="k8spider_${ver}_windows_amd64.zip" ;;
                    esac
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${k8s_archive}"
                    out_file="k8spider_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="k8spider_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_k8spider_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${k8s_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        if [ "$platform" = "windows_amd64" ]; then
                            unzip -o "${k8s_archive}" > /dev/null 2>&1
                            cp k8spider.exe "${tool_dir}/${out_file}" 2>/dev/null
                        else
                            tar -zxf "${k8s_archive}" > /dev/null 2>&1
                            cp k8spider "${tool_dir}/${out_file}" 2>/dev/null
                        fi
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                ingressnightmare)
                    # ingressnightmare: tar.gz for linux, zip for windows
                    # naming: ingressnightmare_v0.4.1_linux_amd64.tar.gz
                    case "$platform" in
                        linux_amd64)   local in_archive="ingressnightmare_${ver}_linux_amd64.tar.gz" ;;
                        linux_arm64)   local in_archive="ingressnightmare_${ver}_linux_arm64.tar.gz" ;;
                        windows_amd64) local in_archive="ingressnightmare_${ver}_windows_amd64.zip" ;;
                    esac
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${in_archive}"
                    out_file="ingressnightmare_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="ingressnightmare_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_ingressnightmare_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${in_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        if [ "$platform" = "windows_amd64" ]; then
                            unzip -o "${in_archive}" > /dev/null 2>&1
                            cp ingressnightmare.exe "${tool_dir}/${out_file}" 2>/dev/null
                        else
                            tar -zxf "${in_archive}" > /dev/null 2>&1
                            cp ingressnightmare "${tool_dir}/${out_file}" 2>/dev/null
                        fi
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                peirates)
                    # peirates: tar.xz, no windows build
                    # naming: peirates-linux-amd64.tar.xz
                    if [ "$platform" = "windows_amd64" ]; then
                        echo -e "   ⏭️  peirates_${platform} (no windows build)"
                        continue
                    fi
                    case "$platform" in
                        linux_amd64) local pei_archive="peirates-linux-amd64.tar.xz" ;;
                        linux_arm64) local pei_archive="peirates-linux-arm64.tar.xz" ;;
                    esac
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${pei_archive}"
                    out_file="peirates_${platform}"

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_peirates_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${pei_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        tar xJf "${pei_archive}" > /dev/null 2>&1
                        find . -name "peirates" -type f -exec cp {} "${tool_dir}/${out_file}" \; 2>/dev/null
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                etcdctl)
                    # etcd releases: etcd-v3.6.10-linux-amd64.tar.gz, contains etcdctl binary
                    case "$platform" in
                        linux_amd64)   local etcd_archive="etcd-${ver}-linux-amd64.tar.gz" ;;
                        linux_arm64)   local etcd_archive="etcd-${ver}-linux-arm64.tar.gz" ;;
                        windows_amd64) local etcd_archive="etcd-${ver}-windows-amd64.zip" ;;
                    esac
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${etcd_archive}"
                    out_file="etcdctl_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="etcdctl_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_etcdctl_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${etcd_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        if [ "$platform" = "windows_amd64" ]; then
                            unzip -o "${etcd_archive}" > /dev/null 2>&1
                            find . -name "etcdctl.exe" -type f -exec cp {} "${tool_dir}/${out_file}" \; 2>/dev/null
                        else
                            tar -zxf "${etcd_archive}" > /dev/null 2>&1
                            find . -name "etcdctl" -type f -exec cp {} "${tool_dir}/${out_file}" \; 2>/dev/null
                        fi
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                kubectl)
                    # kubectl: official binary from dl.k8s.io (no GitHub releases)
                    case "$platform" in
                        linux_amd64)   local kube_os="linux"; local kube_arch="amd64" ;;
                        linux_arm64)   local kube_os="linux"; local kube_arch="arm64" ;;
                        windows_amd64) local kube_os="windows"; local kube_arch="amd64" ;;
                    esac
                    out_file="kubectl_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="kubectl_${platform}.exe"
                        dl_url="https://dl.k8s.io/release/${ver}/bin/${kube_os}/${kube_arch}/kubectl.exe"
                    else
                        dl_url="https://dl.k8s.io/release/${ver}/bin/${kube_os}/${kube_arch}/kubectl"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    $Proxy_OK wget ${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        chmod +x "${tool_dir}/${out_file}"
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                iox)
                    # iox uses non-standard naming: iox_v0.4-next_Linux_x86_64.tar.gz
                    local iox_ver_num=$(echo "$ver" | sed 's/^v//')
                    case "$platform" in
                        linux_amd64)  local iox_archive="iox_v${iox_ver_num}-next_Linux_x86_64.tar.gz" ;;
                        linux_arm64)  local iox_archive="iox_v${iox_ver_num}-next_Linux_i386.tar.gz" ;;
                        windows_amd64) local iox_archive="iox_v${iox_ver_num}-next_Windows_x86_64.tar.gz" ;;
                    esac
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${iox_archive}"
                    out_file="iox_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="iox_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_iox_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${iox_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        tar -zxf "${iox_archive}" > /dev/null 2>&1
                        if [ "$platform" = "windows_amd64" ]; then
                            cp iox.exe "${tool_dir}/${out_file}" 2>/dev/null || cp iox "${tool_dir}/${out_file}" 2>/dev/null
                        else
                            cp iox "${tool_dir}/${out_file}" 2>/dev/null
                        fi
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                ligolo-agent)
                    # ligolo-ng agent: tar.gz for linux, zip for windows
                    local ver_num=$(echo "$ver" | sed 's/^v//')
                    case "$platform" in
                        linux_amd64)   local ligolo_archive="ligolo-ng_agent_${ver_num}_linux_amd64.tar.gz" ;;
                        linux_arm64)   local ligolo_archive="ligolo-ng_agent_${ver_num}_linux_arm64.tar.gz" ;;
                        windows_amd64) local ligolo_archive="ligolo-ng_agent_${ver_num}_windows_amd64.zip" ;;
                    esac
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${ligolo_archive}"
                    out_file="ligolo-agent_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        out_file="ligolo-agent_${platform}.exe"
                    fi

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    local tmp_dir="/tmp/arsenal_ligolo_${platform}"
                    mkdir -p "${tmp_dir}" && cd "${tmp_dir}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${ligolo_archive}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ]; then
                        if [ "$platform" = "windows_amd64" ]; then
                            unzip -o "${ligolo_archive}" > /dev/null 2>&1
                            cp agent.exe "${tool_dir}/${out_file}" 2>/dev/null
                        else
                            tar -zxf "${ligolo_archive}" > /dev/null 2>&1
                            cp agent "${tool_dir}/${out_file}" 2>/dev/null
                        fi
                        chmod +x "${tool_dir}/${out_file}" 2>/dev/null
                        [ -f "${tool_dir}/${out_file}" ] && echo -e "   ✅ ${out_file}" || echo -e "   ❌ ${out_file} (extract failed)"
                    else
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    rm -rf "${tmp_dir}"
                    cd /tmp
                    ;;
                linpeas)
                    # PEASS-ng linpeas: shell script + Go binary per platform
                    case "$platform" in
                        linux_amd64)
                            out_file="linpeas_linux_amd64"
                            dl_url="https://github.com/${repo}/releases/download/${ver}/linpeas_linux_amd64"
                            ;;
                        linux_arm64)
                            out_file="linpeas_linux_arm64"
                            dl_url="https://github.com/${repo}/releases/download/${ver}/linpeas_linux_arm64"
                            ;;
                        windows_amd64)
                            out_file="linpeas.sh"
                            dl_url="https://github.com/${repo}/releases/download/${ver}/linpeas.sh"
                            ;;
                    esac

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        chmod +x "${tool_dir}/${out_file}"
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                winpeas)
                    # PEASS-ng winPEAS: Windows-only .exe files
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  winpeas_${platform} (windows only)"
                        continue
                    fi
                    # Download all winPEAS variants
                    local winpeas_ok=0
                    for exe_name in winPEASx64.exe winPEASx64_ofs.exe winPEASany.exe; do
                        if [ -f "${tool_dir}/${exe_name}" ]; then
                            echo -e "   ✅ ${exe_name} (exists)"
                            winpeas_ok=1
                            continue
                        fi
                        dl_url="https://github.com/${repo}/releases/download/${ver}/${exe_name}"
                        $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${exe_name}" ${wget_option} 2>/dev/null
                        if [ $? -eq 0 ] && [ -s "${tool_dir}/${exe_name}" ]; then
                            echo -e "   ✅ ${exe_name}"
                            winpeas_ok=1
                        else
                            rm -f "${tool_dir}/${exe_name}"
                            echo -e "   ❌ ${exe_name} (download failed)"
                        fi
                    done
                    ;;
                GodPotato)
                    # GodPotato: Windows-only .NET exe
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  GodPotato_${platform} (windows only)"
                        continue
                    fi
                    for exe_name in GodPotato-NET4.exe GodPotato-NET35.exe GodPotato-NET2.exe; do
                        if [ -f "${tool_dir}/${exe_name}" ]; then
                            echo -e "   ✅ ${exe_name} (exists)"
                            continue
                        fi
                        dl_url="https://github.com/${repo}/releases/download/${ver}/${exe_name}"
                        $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${exe_name}" ${wget_option} 2>/dev/null
                        if [ $? -eq 0 ] && [ -s "${tool_dir}/${exe_name}" ]; then
                            echo -e "   ✅ ${exe_name}"
                        else
                            rm -f "${tool_dir}/${exe_name}"
                            echo -e "   ❌ ${exe_name} (download failed)"
                        fi
                    done
                    ;;
                mimikatz)
                    # mimikatz: Windows-only, single zip with x86+x64 binaries
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  mimikatz_${platform} (windows only)"
                        continue
                    fi
                    out_file="mimikatz_trunk.zip"

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    dl_url="https://github.com/${repo}/releases/download/${ver}/${out_file}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        # Also extract for convenience
                        unzip -o "${tool_dir}/${out_file}" -d "${tool_dir}/mimikatz" > /dev/null 2>&1
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                SharpHound)
                    # SharpHound: Windows-only zip
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  SharpHound_${platform} (windows only)"
                        continue
                    fi
                    out_file="SharpHound_${ver}_windows_x86.zip"

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    dl_url="https://github.com/${repo}/releases/download/${ver}/${out_file}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                PrintSpoofer)
                    # PrintSpoofer: Windows-only, two exe files (32+64 bit)
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  PrintSpoofer_${platform} (windows only)"
                        continue
                    fi
                    local ps_ok=0
                    for exe_name in PrintSpoofer32.exe PrintSpoofer64.exe; do
                        if [ -f "${tool_dir}/${exe_name}" ]; then
                            echo -e "   ✅ ${exe_name} (exists)"
                            ps_ok=1
                            continue
                        fi
                        dl_url="https://github.com/${repo}/releases/download/${ver}/${exe_name}"
                        $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${exe_name}" ${wget_option} 2>/dev/null
                        if [ $? -eq 0 ] && [ -s "${tool_dir}/${exe_name}" ]; then
                            ps_ok=1
                            echo -e "   ✅ ${exe_name}"
                        else
                            rm -f "${tool_dir}/${exe_name}"
                            echo -e "   ❌ ${exe_name} (download failed)"
                        fi
                    done
                    ;;
                SharpWMI)
                    # SharpWMI: Windows-only single exe
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  SharpWMI_${platform} (windows only)"
                        continue
                    fi
                    out_file="sharpwmi.exe"

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    dl_url="https://github.com/${repo}/releases/download/${ver}/${out_file}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                SharPersist)
                    # SharPersist: Windows-only single exe
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  SharPersist_${platform} (windows only)"
                        continue
                    fi
                    out_file="SharPersist.exe"

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    dl_url="https://github.com/${repo}/releases/download/${ver}/${out_file}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                StandIn)
                    # StandIn: Windows-only zip with Net35+Net45 builds
                    if [ "$platform" != "windows_amd64" ]; then
                        echo -e "   ⏭️  StandIn_${platform} (windows only)"
                        continue
                    fi
                    # v1.3 → StandIn_v13_Net35_45.zip
                    local standin_ver_short=$(echo "$ver" | sed 's/^v//;s/\.//')
                    out_file="StandIn_v${standin_ver_short}_Net35_45.zip"

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    dl_url="https://github.com/${repo}/releases/download/${ver}/${out_file}"
                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
                *)
                    # Simple single-binary tools (gogo, zombie, spray, cdk)
                    # cdk has no windows build
                    if [ "$tool_name" = "cdk" ] && [ "$platform" = "windows_amd64" ]; then
                        echo -e "   ⏭️  ${tool_name}_${platform} (no windows build)"
                        continue
                    fi
                    local file_name="${tool_name}_${platform}"
                    if [ "$platform" = "windows_amd64" ]; then
                        file_name="${tool_name}_${platform}.exe"
                    fi
                    dl_url="https://github.com/${repo}/releases/download/${ver}/${file_name}"
                    out_file="${file_name}"

                    if [ -f "${tool_dir}/${out_file}" ]; then
                        echo -e "   ✅ ${out_file} (exists)"
                        continue
                    fi

                    $Proxy_OK wget ${GitProxy}${dl_url} -O "${tool_dir}/${out_file}" ${wget_option} 2>/dev/null
                    if [ $? -eq 0 ] && [ -s "${tool_dir}/${out_file}" ]; then
                        chmod +x "${tool_dir}/${out_file}"
                        echo -e "   ✅ ${out_file}"
                    else
                        rm -f "${tool_dir}/${out_file}"
                        echo -e "   ❌ ${out_file} (download failed)"
                    fi
                    ;;
            esac
        done
        echo ""
    done

    echo -e "\033[1;33m>> Arsenal build complete\033[0m"
    echo -e "\033[1;34m   Location: ${Arsenal_Dir}\033[0m"
    echo ""
    ls -la ${Arsenal_Dir}/*/ 2>/dev/null

}

# Main
Main(){

    case "$(uname)" in
        *"Darwin"*)
            Running_Mode="Darwin"
            ;;
        *"MINGW64_NT"*)
            echo "Not supported on windows platform"
            exit 1
            ;;
        *)
            Running_Mode="Linux"
            setenforce 0 > /dev/null 2>&1
            ;;
    esac

    if [[ $UID != 0 ]]; then
        Echo_ERROR "Please run with sudo or root privileged account!"
        exit 1
    fi

    printf "\033c"

}

# Allow --list-tools and --search to run without root (read-only operations)
for _arg in "$@"; do
    case $_arg in
        --list-tools)
            _next_arg=""
            _found=false
            for _a in "$@"; do
                if $_found; then _next_arg="$_a"; break; fi
                [ "$_a" = "--list-tools" ] && _found=true
            done
            F8x_List_Tools "${_next_arg:-json}"
            exit 0
            ;;
        --search)
            _next_arg=""
            _found=false
            for _a in "$@"; do
                if $_found; then _next_arg="$_a"; break; fi
                [ "$_a" = "--search" ] && _found=true
            done
            if [ -n "$_next_arg" ]; then
                F8x_Search_Tool "$_next_arg"
            else
                echo -e "\033[1;31mUsage: ./f8x --search <keyword>\033[0m"
            fi
            exit 0
            ;;
        --list-installed)
            install_file="/opt/.f8x/installed.json"
            if [ -f "$install_file" ]; then
                cat "$install_file"
            else
                echo '{"tools":{}}'
            fi
            exit 0
            ;;
    esac
done

Main
Banner

case $Running_Mode in
    *"Darwin"*)
        Sys_Version_Mac
        ;;
    *"Linux"*)
        Sys_Version
        ;;
    *)
        exit 1
        ;;
esac

Sys_Info
echo -e "\033[1;36m \n-----Start execution----- \033[0m"
echo -e "\033[1;33m\n>> Initializing\n\033[0m"
Base_Dir
Docker_run_Check

_f8x_install_next=0
_f8x_search_next=0
_f8x_list_next=0

for cmd in $@
do
    # Handle arguments for -install / --search / --list-tools
    if [ "$_f8x_install_next" = "1" ]; then
        _f8x_install_next=0
        F8x_Install_Tool "$cmd"
        continue
    fi
    if [ "$_f8x_search_next" = "1" ]; then
        _f8x_search_next=0
        F8x_Search_Tool "$cmd"
        continue
    fi
    if [ "$_f8x_list_next" = "1" ]; then
        _f8x_list_next=0
        if [[ "$cmd" != -* ]]; then
            F8x_List_Tools "$cmd"
            continue
        else
            F8x_List_Tools "json"
            # Fall through to process this cmd as a normal flag
        fi
    fi

    case $cmd in
        -b | b)
            mac_Check || exit 1
            Base_Install
            ;;
        -p | p)
            mac_Check || exit 1
            Proxy
            ;;
        -d | d)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Dev_Tools
            ;;
        -ad | ad)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            GO_Check
            Ad_Tools
            ;;
        -k | k)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            pip2_Check
            GO_Check
            kali_Tools
            ;;
        -ka | ka)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            kali_Tools "a"
            ;;
        -kb | kb)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            kali_Tools "b"
            ;;
        -kc | kc)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            kali_Tools "c"
            ;;
        -kd | kd)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            kali_Tools "d"
            ;;
        -ke | ke)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            kali_Tools "e"
            ;;
        -s | s)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Secure
            ;;
        -f | f)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            pip3_Check
            Fun_Tools
            ;;
        -h | h)
            printf "\033c"
            Help
            ;;
        -cloud)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            cloud
            ;;
        -all)
            mac_Check || exit 1
            all_Install
            ;;
        -docker)
            mac_Check || exit 1
            Base_Check
            Dev_Base_Install
            Docker_Install
            ;;
        -docker-cn)
            mac_Check || exit 1
            Base_Check
            Dev_Base_Install
            Docker_Install "tuna"
            ;;
        -lua)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            lua_Install
            ;;
        -nn)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            nn_Install
            ;;
        -go)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Go_Option
            ;;
        -jenv)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            jenv_Install
            ;;
        -openjdk)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Openjdk_Install
            ;;
        -oraclejdk)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Oraclejdk_Install
            ;;
        -oraclejdk8)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Oraclejdk_Install "oraclejdk8"
            ;;
        -oraclejdk11)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Oraclejdk_Install "oraclejdk11"
            ;;
        -oraclejdk17)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Oraclejdk_Install "oraclejdk17"
            ;;
        -py3 | py3)
            mac_Check || exit 1
            Python3_Install
            ;;
        -py37 | py37)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Python3_Install "py37"
            ;;
        -py38 | py38)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Python3_Install "py38"
            ;;
        -py39 | py39)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Python3_Install "py39"
            ;;
        -py310 | py310)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Python3_Install "py310"
            ;;
        -py2 | py2)
            mac_Check || exit 1
            Python2_Install
            ;;
        -py2-f)
            mac_Check || exit 1
            Python2_force_Install
            ;;
        -pip2-f)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            pip2_Install
            ;;
        -pyenv)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            pyenv_Install
            ;;
        -perl)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Perl_Install
            ;;
        -ruby)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Ruby_Install
            ;;
        -ruby-f)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Ruby_Install_f
            ;;
        -rust)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Rust_Install
            ;;
        -code)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            code-server_Install
            ;;
        -crawl)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            crawl_Install
            ;;
        -chromium)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            chromium_Install
            ;;
        -phantomjs)
            mac_Check || exit 1
            linux_arm64_Check || exit 1
            Proxy_Switch
            Base_Check
            phantomjs_Install
            ;;
        -k8s)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            k8s_Install
            ;;
        -binwalk)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            binwalk_Install
            ;;
        -binwalk-f)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            binwalk_force_Install
            ;;
        -clamav)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            clamav_Install
            ;;
        -vol)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            pip2_Check
            Volatility_Install
            ;;
        -vol3)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            pip3_Check
            volatility3_Install
            ;;
        -lt)
            mac_Check || exit 1
            Proxy_Switch
            lt_Install
            ;;
        -aircrack)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            aircrack_Install
            ;;
        -bypass)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            bypass_Install
            ;;
        -cs)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            cs_Install
            ;;
        -cs45)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            cs45_Install
            ;;
        -interactsh)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            interactsh_Install
            ;;
        -merlin)
            mac_Check || exit 1
            linux_arm64_Check || exit 1
            Proxy_Switch
            Base_Check
            merlin_Install
            ;;
        -msf)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Pentest_Metasploit_Install
            ;;
        -sps)
            mac_Check || exit 1
            linux_arm64_Check || exit 1
            Proxy_Switch
            Base_Check
            Pentest_Base_Install
            Py_Check
            SharPyShell_Install
            ;;
        -frp)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            frp_Install
            ;;
        -iox)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Pentest_iox_Install
            ;;
        -chisel)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Pentest_chisel_Install
            ;;
        -evil-winrm)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Ruby_Check
            Pentest_evil_winrm_Install
            ;;
        -playwright-mcp)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            nn_Check
            Pentest_playwright_mcp_Install
            ;;
        -claude-code)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            nn_Check
            Pentest_claude_code_Install
            ;;
        -nps)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            nps_Install
            ;;
        -rg)
            mac_Check || exit 1
            linux_arm64_Check || exit 1
            Proxy_Switch
            Base_Check
            RedGuard_Install
            ;;
        -http)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Pentest_simplehttpservert_Install
            ;;
        -sliver)
            mac_Check || exit 1
            # linux_arm64_Check || exit 1
            Proxy_Switch
            Base_Check
            sliver-server_Install
            ;;
        -sliver-client)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            sliver-client_Install
            ;;
        -sliver-script)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Pentest_sliver_Install_Script
            ;;
        -wpscan)
            mac_Check || exit 1
            linux_arm64_Check || exit 1
            Proxy_Switch
            Base_Check
            Ruby_Check
            wpscan_Install
            ;;
        -wx)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            nn_Check
            wx_Install
            ;;
        -yakit)
            mac_Check || exit 1
            linux_arm64_Check || exit 1
            Proxy_Switch
            Base_Check
            yakit_Install
            ;;
        -suricata)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            suricata_Install
            ;;
        -arl)
            mac_Check || exit 1
            Proxy_Switch
            Pentest_Base_Install
            arl_Install
            ;;
        -awvs | -awvs14 | -awvs15)
            mac_Check || exit 1
            Proxy_Switch
            awvs15_Install_secfa
            ;;
        -mobsf)
            mac_Check || exit 1
            Proxy_Switch
            mobsf_Install
            ;;
        -mythic)
            mac_Check || exit 1
            Proxy_Switch
            mythic_Install
            ;;
        -nodejsscan)
            mac_Check || exit 1
            Proxy_Switch
            nodejsscan_Install
            ;;
        -pupy)
            mac_Check || exit 1
            Proxy_Switch
            pupy_Install
            ;;
        -viper)
            mac_Check || exit 1
            Proxy_Switch
            viper_Install
            ;;
        -metarget)
            mac_Check || exit 1
            Proxy_Switch
            metarget_Install
            ;;
        -vulhub)
            mac_Check || exit 1
            Proxy_Switch
            vulhub_Install
            ;;
        -vulfocus)
            mac_Check || exit 1
            Proxy_Switch
            vulfocus_Install
            ;;
        -TerraformGoat)
            mac_Check || exit 1
            Proxy_Switch
            TerraformGoat_Install
            ;;
        -asciinema)
            mac_Check || exit 1
            asciinema_Install
            ;;
        -bt)
            mac_Check || exit 1
            Base_Check
            bt_Install
            ;;
        -aa)
            mac_Check || exit 1
            Base_Check
            aaPanel_Install
            ;;
        -1panel)
            mac_Check || exit 1
            Base_Check
            1Panel_Install
            ;;
        #-clash)
        #    mac_Check || exit 1
        #    Proxy_Switch
        #    Base_Check
        #    clash_Install
        #    ;;
        #-clash-old)
        #    mac_Check || exit 1
        #    Base_Check
        #    clash_Install_old
        #    ;;
        -music)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            music_Install
            ;;
        -nginx)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            nginx_Install
            ;;
        -ssh)
            mac_Check || exit 1
            SSH
            ;;
        -ssr)
            mac_Check || exit 1
            linux_arm64_Check || exit 1
            Base_Check
            ssr_Install
            ;;
        -zsh)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            pip3_Check
            zsh_Install
            ;;
        -jq)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            jq_Install
            ;;
        -clear)
            mac_Check || exit 1
            clear_log
            ;;
        -info)
            # Base_Check
            System_info
            ;;
        -optimize)
            mac_Check || exit 1
            optimize_setting
            ;;
        -remove)
            mac_Check || exit 1
            remove_watcher
            ;;
        -rmlock)
            mac_Check || exit 1
            Rm_Lock

            case $Linux_Version in
                *"Kali"*|*"Ubuntu"*|*"Debian"*)
                    dpkg --configure -a > /dev/null 2>&1
                    ;;
                *) ;;
            esac

            ;;
        -swap)
            mac_Check || exit 1
            swap_setting
            ;;
        -update)
            mac_Check || exit 1
            Proxy_Switch
            if test -e /usr/local/bin/f8x
            then
                rm -f /usr/local/bin/f8x && $Proxy_OK curl -o /usr/local/bin/f8x https://raw.githubusercontent.com/ffffffff0x/f8x/main/f8x && chmod +x /usr/local/bin/f8x && Echo_INFOR "Update successful" || Echo_ERROR "Update failed"
            else
                rm -f f8x && $Proxy_OK curl -o f8x https://raw.githubusercontent.com/ffffffff0x/f8x/main/f8x > /dev/null 2>&1 && Echo_INFOR "Update successful" || Echo_ERROR "Update failed"
            fi
            ;;
        -upgrade)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Py_Check
            GO_Check
            Pentest_Base_Install
            pentest_tool_upgrade
            ;;
        -proxy)
            mac_Check || exit 1
            Proxychains_Install
            ;;
        -arsenal)
            mac_Check || exit 1
            Proxy_Switch
            Base_Check
            Arsenal_Build
            ;;
        -debug)
            mac_Check || exit 1
            Base_Check
            Pentest_Base_Install
            Proxy_Switch
            Debug_Fun
            ;;
        -install)
            # Next argument should be the tool name — mark it for pickup
            _f8x_install_next=1
            ;;
        --list-tools)
            _f8x_list_format="json"
            _f8x_list_next=1
            ;;
        --search)
            _f8x_search_next=1
            ;;
        *)
            echo -e ""
            echo -e "\033[1;34mUse the -h option to view the help documentation\033[0m"
            ;;
    esac

    echo -e "\033[1;36m \n-----End of execution-----\n \033[0m"
done

# Handle trailing flags without arguments
if [ "$_f8x_list_next" = "1" ]; then
    F8x_List_Tools "json"
fi
if [ "$_f8x_install_next" = "1" ]; then
    echo -e "\033[1;31mUsage: ./f8x -install <tool_name>\033[0m"
    echo -e "Example: ./f8x -install nuclei"
fi
if [ "$_f8x_search_next" = "1" ]; then
    echo -e "\033[1;31mUsage: ./f8x --search <keyword>\033[0m"
    echo -e "Example: ./f8x --search scan"
fi
