Restructure repository: organize tools by purpose, create what search tool
- Move single-file tools to tools/ organized by category (security, forensics, data, etc.) - Move multi-file projects to projects/ (go-tools, puzzlebox, timesketch, rust-tools) - Move system scripts to scripts/ (proxy, display, setup, windows) - Organize config files in config/ (shell, visidata, applications) - Move experimental tools to archive/experimental - Create 'what' fuzzy search tool with progressive enhancement (ollama->fzf->grep) - Add initial metadata database for intelligent tool discovery - Preserve git history using 'git mv' commands
This commit is contained in:
21
scripts/proxy/get_proxy.sh
Normal file
21
scripts/proxy/get_proxy.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
proxy_ip=$(env | grep http_proxy | grep -Pio '[^@/:]+(?=:\d+/?$)')
|
||||
proxy_port=$(env | grep http_proxy | grep -Pio '(?<=:)(\d+)(?=/?$)')
|
||||
|
||||
if [ -z "${proxy_ip}" ]; then
|
||||
echo "Enter Proxy IP or Hostname (no port): "
|
||||
read proxy_ip
|
||||
else
|
||||
echo "Using >>${proxy_ip}<< as Proxy-Address"
|
||||
fi
|
||||
|
||||
if [ -z "${proxy_port}" ]; then
|
||||
echo -n "Proxy-Port: "
|
||||
read proxy_port
|
||||
else
|
||||
echo "Using >>${proxy_port}<< as Proxy-Port"
|
||||
fi
|
||||
|
||||
echo "Using ${proxy_ip}:${proxy_port} as Proxy!"
|
||||
|
||||
27
scripts/proxy/update_apt_proxy.sh
Executable file
27
scripts/proxy/update_apt_proxy.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
config_file='/etc/apt/apt.conf.d/80certproxy'
|
||||
#remove proxy settings from docker
|
||||
if [[ "${1}" == "off" ]]; then
|
||||
echo "TURNING OFF PROXY FOR APT"
|
||||
sudo rm -rf "${config_file}"
|
||||
sudo snap unset system proxy.http
|
||||
sudo snap unset system proxy.https
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#populate proxy_ip and proxy_port variables
|
||||
path=$(dirname $(readlink -f "${0}"))
|
||||
. "${path}/get_proxy.sh"
|
||||
|
||||
|
||||
echo -n "Username: "
|
||||
read username
|
||||
echo -n "Password: "
|
||||
read -s password
|
||||
encpassword=$(echo -n ${password} | xxd -p | sed -e 's/\(..\)/%\1/g' )
|
||||
echo 'Acquire::http::Proxy "http://'"${username}:${encpassword}@${proxy_ip}:${proxy_port}/"'";' | sudo tee "${config_file}"
|
||||
echo 'Acquire::http::Timeout "360";' | sudo tee -a "${config_file}"
|
||||
|
||||
echo "SETTING PROXY FOR SNAP ASWELL"
|
||||
sudo snap set system proxy.http=http://${username}:${encpassword}@${proxy_ip}:${proxy_port}/
|
||||
sudo snap set system proxy.https=http://${username}:${encpassword}@${proxy_ip}:${proxy_port}/
|
||||
49
scripts/proxy/update_bashrc_proxy.sh
Executable file
49
scripts/proxy/update_bashrc_proxy.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
user=$(logname)
|
||||
bashrc_file=/home/${user}/.bashrc
|
||||
proxy_file=/home/${user}/.http_proxy
|
||||
noproxy_file=/home/${user}/.http_noproxy
|
||||
|
||||
#turn off bashrc proxy settings
|
||||
if [[ "${1}" == "off" ]]; then
|
||||
echo "TURNING OFF PROXY IN BASHRC"
|
||||
mv -v "${proxy_file}" "${proxy_file}.off"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#turn on bashrc proxy settings
|
||||
if [[ "${1}" == "on" ]]; then
|
||||
if [[ -f "${proxy_file}.off" ]] ; then
|
||||
echo "TURNING ON PROXY IN BASHRC"
|
||||
mv -v "${proxy_file}.off" "${proxy_file}"
|
||||
exit 0
|
||||
else
|
||||
echo "No disabled Proxy-Config found. Creating a new one!"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
marker="#PROXY_A93JK2"
|
||||
path=$(dirname $(readlink -f "${0}"))
|
||||
. "${path}/get_proxy.sh"
|
||||
echo -n "Username: "
|
||||
read username
|
||||
echo -n "Password: "
|
||||
read -s password
|
||||
|
||||
|
||||
encpassword=$(echo -n ${password} | xxd -p | sed -e 's/\(..\)/%\1/g' )
|
||||
|
||||
if ! grep -qF -e "PROXY_A93JK2" "${bashrc_file}" ; then
|
||||
echo "[ -f ${proxy_file} ] && . ${proxy_file} #PROXY_A93JK2" >> "${bashrc_file}"
|
||||
fi
|
||||
|
||||
echo 'export "HTTP_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" > "${proxy_file}"
|
||||
echo 'export "HTTPS_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" >> "${proxy_file}"
|
||||
echo 'export "http_proxy=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" >> "${proxy_file}"
|
||||
echo 'export "https_proxy=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" >> "${proxy_file}"
|
||||
echo 'export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt' >> "${proxy_file}"
|
||||
echo "[ -f ${noproxy_file} ] && . ${noproxy_file}" >> "${proxy_file}"
|
||||
|
||||
[ -f "${noproxy_file}" ] || echo 'export "NO_PROXY=localhost,127.0.0.1"' > "${noproxy_file}"
|
||||
|
||||
51
scripts/proxy/update_service_proxy.sh
Executable file
51
scripts/proxy/update_service_proxy.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
services=(docker snapd)
|
||||
|
||||
function restart_services(){
|
||||
echo "Reloading Systemd - Configfiles"
|
||||
sudo systemctl daemon-reload
|
||||
for service in ${services[*]} ; do
|
||||
echo "Restarting Service $service"
|
||||
sudo systemctl restart $service
|
||||
done
|
||||
}
|
||||
|
||||
#remove proxy settings from docker
|
||||
if [[ "${1}" == "off" ]]; then
|
||||
for service in ${services[*]} ; do
|
||||
echo "TURNING OFF PROXY FOR ${service^^}"
|
||||
sudo rm -v "/etc/systemd/system/${service}.service.d/http-proxy.conf"
|
||||
done
|
||||
restart_services
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#populate proxy_ip and proxy_port variables
|
||||
path=$(dirname $(readlink -f "${0}"))
|
||||
. "${path}/get_proxy.sh"
|
||||
|
||||
|
||||
echo -n "Username: "
|
||||
read username
|
||||
echo -n "Password: "
|
||||
read -s password
|
||||
#encpassword=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${password}")
|
||||
#encpassword=$(echo -n ${password} | sed -e 's/\@/\\x40/g' -e 's/\!/\\x21/g' -e 's/\$/\\x24/g' -e 's/\*/\\x2a/g' -e 's/\%/\\x25/g' -e 's/\&/\\x26/g' -e 's/\#/\\x30/g')
|
||||
encpassword=$(echo -n ${password} | xxd -p | sed -e 's/\(..\)/%%\1/g' )
|
||||
|
||||
for service in ${services[*]} ; do
|
||||
if ! [[ -d "/etc/systemd/system/${service}.service.d" ]] ; then
|
||||
sudo mkdir -p "/etc/systemd/system/${service}.service.d/"
|
||||
fi
|
||||
echo "[Service]" | sudo tee "/etc/systemd/system/${service}.service.d/http-proxy.conf" >/dev/null
|
||||
echo 'Environment="HTTP_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" | sudo tee -a "/etc/systemd/system/${service}.service.d/http-proxy.conf" >/dev/null
|
||||
echo 'Environment="HTTPS_PROXY=http://'"${username}"':"'"${encpassword}@${proxy_ip}:${proxy_port}/" | sudo tee -a "/etc/systemd/system/${service}.service.d/http-proxy.conf" >/dev/null
|
||||
if [[ -z "$NO_PROXY" ]] ; then
|
||||
echo -n 'Environment="NO_PROXY=localhost,127.0.0.1"' | sudo tee -a "/etc/systemd/system/${service}.service.d/http-proxy.conf" >/dev/null
|
||||
else
|
||||
echo 'Environment="'$(env | grep NO_PROXY)'"' | sudo tee -a "/etc/systemd/system/${service}.service.d/http-proxy.conf" >/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
restart_services
|
||||
Reference in New Issue
Block a user