This commit is contained in:
2026-05-26 19:36:35 -06:00
parent 657b53c8fb
commit 764590c350
5 changed files with 142 additions and 2 deletions
+69
View File
@@ -0,0 +1,69 @@
#!/bin/bash
# file paths
sha256_file_path=./checksums.sha256
md5_file_path=./checksums.md5
error_log=./checksums_error.log
# text colors
RED='\e[31m'
GREEN='\e[32m'
RESET='\e[0m'
# set these false at the start to be safe
checksha256=false
checkmd5=false
# output errors to error log
exec 2> >(tee -a "$error_log" >&2)
# environment checks
## check for presence of $sha256_file_path, fail with general error on error
if [ ! -f "$sha256_file_path" ]; then
echo -e "\n${RED}FAIL!${RESET} File $sha256_file_path Not Found!\n" >&2
exit 1
fi
## check if $sha256_file_path is writable
if [ ! -r "$sha256_file_path" ]; then
echo -e "\n${RED}FAIL!${RESET} File $sha256_file_path Exists But Not Readable!\n" >&2
exit 1
fi
## check for presence of $md5_file_path, fail with general error on error
if [ ! -f "$md5_file_path" ]; then
echo -e "\nFAIL! File $md5_file_path Not Found!\n" >&2
exit 1
fi
## check if $md5_file_path is writable
if [ ! -r "$md5_file_path" ]; then
echo -e "\n${RED}FAIL!${RESET} File $md5_file_path Exists But Not Readable!\n" >&2
exit 1
fi
# check checksums
## check sha256
if sha256sum -c "$sha256_file_path" 1>/dev/null; then
echo -e "SHA256 Checksums: ${GREEN}OK!${RESET}"
checksha256=true
else
echo -e "\n\nSHA256 Checksums: ${RED}BAD!${RESET}\nDumping SHA256 Checksum Fails:" >&2
sha256sum -c "$sha256_file_path" | grep 'FAILED' >&2
echo -e "\nSHA256 Checksums: ${RED}BAD!${RESET}\n" >&2
fi
## check md5
if md5sum -c "$md5_file_path" 1>/dev/null; then
echo -e "MD5 checksums: ${GREEN}OK!${RESET}"
checkmd5=true
else
echo -e "\n\nFAIL: MD5 Checksums: ${RED}BAD!${RESET}\n\tDumping MD5 Checksum Fails:" >&2
md5sum -c "md5_file_path" | grep 'FAILED' >&2
echo -e "\nMD5 Checksums: ${RED}BAD!${RESET}\n" >&2
fi
# tally checks
if [[ $checksha256 == true && $checkmd5 == true ]]; then
echo -e "\nFile Integrity: VERIFIED! All Checksums: ${GREEN}OK!${RESET}\n"
exit 0 # exit success
else
echo -e "\nFile Integrity Check: ${RED}FAILED!${RESET}\n\tSee Above or See $error_log" >&2
exit 1 # exit general failure
fi
@@ -0,0 +1,40 @@
#!/bin/bash
# file paths
sha256_file_path=./checksums.sha256
md5_file_path=./checksums.md5
error_log=./checksums_error.log
# text colors
RED='\e[31m'
YELLOW='\033[33m'
GREEN='\e[32m'
RESET='\e[0m'
# output errors to error log
exec 2> >(tee -a "$error_log" >&2)
if [ -f "sha256_file_path" ]; then
echo -e "${YELLOW}Warn${RESET}: Existing $sha256_file_path Found, Deleting..."
rm -f "sha256_file_path"
fi
if [ -f "$md5_file_path" ]; then
echo -e "${YELLOW}Warn${RESET}: Existing $md5_file_path Found, Deleting..."
rm -f "$md5_file_path"
fi
if [ -f "$error_log" ]; then
echo -e "${YELLOW}Warn${RESET}: Existing $error_log Found, Deleting..."
rm -f "$error_log"
fi
# notify user
echo "Calculating SHA256 and MD5 Checksums Recursively into $sha256_file_path and $md5_file_path\n\t${YELLOW}This May Take a Long Time!${RESET}"
# exclude git
if find . -type f ! -path "*/.git/*" ! -path "$error_log" ! -path "$md5_file_path" ! -path "$sha256_file_path" ! -path "$0" ! -path "./check_checksums.sh" -exec bash -c "file_path={} && sha256sum \$file_path 1>> $sha256_file_path && md5sum \$file_path 1>> $md5_file_path" \;; then
echo -e "\n${GREEN}SUCCESS!${RESET} Generated SHA256 and MD5 Checksums into $sha256_file_path and $md5_file_path Respectively!\n"
exit 0 # explicitly exit success
else
echo -e "\n${RED}FAIL!${RESET} Failed to Generate SHA256 and MD5 Checksums! Check Error Output or Check Error Log: $error_log\n" >&2
exit 1 # explicitly fail
fi
+1 -2
View File
@@ -87,7 +87,7 @@ checkcode () {
if [ $retcode -ne 0 ]; then
echo -e "\t\e[31mERROR!\033[0m Response Code: $retcode"
else
printf '\e[1;32mOK!\e[0m'
echo -e '\t\e[1;32mOK!\e[0m'
fi
}
@@ -121,7 +121,6 @@ user() {
usermod -aG $group $new_username &> /dev/null
checkcode $?
done
checkcode $?
echo "user: FINISHED"
}
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
# packages required: git trufflehog gitsecrets
github='https://github.com/InfoSecREDD/'
out_dir="$PWD/redd_repos"
mkdir -p "$out_dir"
repos=("DWipe" "wifipineapplepager-payloads" "ThreatVis" "RadioRef-Export" "REDDs-PCAP-Uploader" "Uptime-Monitor" "Uni-Adblock" "PolyZip" "CVE-Discord-Notify" "shlt-plugins" "DarkGPT-Lite" "RPT-Installer" "YOURLS-Security-Audit-Plugin" "YOURLS-IP-Info" "InfoSecREDD.github.io" "sharkjack-payloads" "ExPW" "DeLookup" "CheckSim" "sb" "REPG-Community-Payloads" "BTSM-Payloads" "Flip-pi" "InvisInk-Encoder" "REPG" "NET-UP" "Adafruit_WebSerial_ESPTool" "BadPS" "omg-payloads" "k" "Flipper" "REDD-Demo" "SecF0EncKey" "SIN-Main" "sj-webui-patch" "MHS35-lcd-64bit-rpi" "verifymd5" "proxmark3" "DHunter" "termux-pm3-helper" "Proxmark3-Amiibo-Emulate" "Termux-Helper-Script" "NFC-Cloner" "Handshake-Transfer" "shark-files" "rtl8812au" "SharkLib" "rtl8812AU_8821AU_linux" "NET-UP-modules" "boot-dev" "RPi-Tweaks" "auto-ssh" "HoppEye" "bashbunny-payloads" "CPUMINER" "bash-no-ip-updater")
# if [ -d "$out_dir" ]; then
# printf "deleting existing $out_dir..."
# rm -rf "$out_dir" > /dev/null 2>&1
# printf "$?\n"
#
# printf "remaking $out_dir..."
# mkdir -p "$out_dir"
# printf "$?\n"
# fi
#
# for repo in "${repos[@]}"; do
# printf "cloning $repo into $out_dir/$repo..."
# git clone --recursive "$github/$repo" "$out_dir/$repo" > /dev/null 2>&1
# printf "$?\n"
# done
for repo in "${repos[@]}"; do
cd "$out_dir/$repo"
trufflehog git file://. --relative
gitleaks detect -v
cd -
done