This commit is contained in:
PrincessPi committed 2026-11-15 09:49:54 -07:00
1 parent ff76074355
commit db7a9c4324
5 files changed
+223

No files matched your search

File renamed without changes.
+2
View File
@@ -17,3 +17,5 @@ sha256dsum SAMPLE.zip # get sha256 to look up on the site
curl -X POST -H "X-ApiKey: $VIRUSTOTAL_API_KEY" -F "file=@$PWD/SAMPLE.zip" https://www.virustotal.com/api/v3/files curl -X POST -H "X-ApiKey: $VIRUSTOTAL_API_KEY" -F "file=@$PWD/SAMPLE.zip" https://www.virustotal.com/api/v3/files
# then look up file by sha256 checksum on the site # then look up file by sha256 checksum on the site
``` ```
@@ -0,0 +1,33 @@
#!/bin/bash
OUTPUT_FILE="/mnt/c/Users/human/Downloads/NORMIEDIRWTFFILEHGISTORYFUCKYOUWINDOWSFUCKYOUTOHELLANDYOUDIEWINDOWS-$(date +%s).txt"
TEST_DIR="/mnt/c/Users/human/OneDrive/Documents/Git/general-scripts-and-system-ssssssetup/customscripts"
echo -n "" > "$OUTPUT_FILE" # inuitialize fiel ig lmao
# mAWEK dildohe3aderz
# INItuialie fiel to empty, add HEASDWERS ABDDDD PRINT TO SCREEEEBN
printf "%-85s %-66s %-22s %-22s %-15s %-12s\n" "FILENAME" "SHA-256 CHECKSUM" "DATETIME CREATED" "DATETIME MODIFIED" "SIZE (BYTES)" "SIZE (HUMAN)" | tee "$OUTPUT_FILE"
for file in $TEST_DIR/*; do # loop da fuck threough fileZ in TEST_DIR
if [ -f "$file" ]; then
filename=$(basename "$file") # DELET DA PAAATH
sha256=$(sha256sum "$file" | awk '{print $1}') # CHECJKSUYMNZZZ! VUUUT DELETE DA FIEL ANMEEE
created=$(stat -c '%w' "$file" 2>/dev/null | cut -d'.' -f1) # ATTENP GET CREATUIION DARTE
if [ "$created" = "-" ] || [ -z "$created" ]; then # IF DAT FUCKS UP
created="N/A" # ajust fuckinA N/A it lmao
fi
modified=$(stat -c '%y' "$file" | cut -d'.' -f1) # MODIFIED TIMDATESTAMP
bytes=$(du -b "$file" | awk '{print $1}' | tr -d '\n') # FIEK SIZE IN BYTES BUT NUKE FILEBNANE AND NUJKE NEWLINES
human_size=$(du -h "$file" | awk '{print $1}' | tr -d '\n') # HUMNAN FIEL SIZE VBT KILL DA FIELNAME AND NUKE NWEKLINEZ
# output DILDIOFACTZ 2 FIEL AND TERMINALLL
printf "%-85s %-66s %-22s %-22s %-15s %-12s\n" "$filename" "$sha256" "$created" "$modified" "$bytes" "$human_size" | tee -a "$OUTPUT_FILE"
fi
done
echo "Report generated successfully in $OUTPUT_FILE"
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
if [ -z "$1" ]; then
echo -e 'Usage:\n\tfind_ext.sh <str extensions whitelist> <str extensions blacklist>\n\tfind_ext.sh "jpg mp3 png" ["doc pdf svg"]'
exit 1
else
# start the whitelist group
whitelist_find_str='\('
# break whitelist str into array
IFS=' ' read -r -a whitelist <<< "$1"
# loop through array of whitelisted exts
for ext in "${whitelist[@]}"; do
whitelist_find_str+=" -iname \" *.${ext}\" "
done
# finish the whitelist group
whitelist_find_str+='/)'
echo "$whitelist_find_str";
# make find command
# find_cmd="find . "
fi
if [ ! -z "$2" ]; then
# break blacklist str into array
IFS=' ' read -r -a blacklist <<< "$2"
fi
@@ -0,0 +1,159 @@
#!/bin/bash
# Ensure script is run as root
if [ "$EUID" -ne 0 ]; then
echo "[-] Error: This script must be run as root." >&2
exit 1
fi
# Check if directory argument is provided
if [ -z "$1" ]; then
echo "[-] Usage: $0 <target_directory>" >&2
exit 1
fi
TARGET_DIR="$1"
if [ ! -d "$TARGET_DIR" ]; then
echo "[-] Error: '$TARGET_DIR' is not a valid directory." >&2
exit 1
fi
# Interactive password prompt (hidden input)
echo -n "Enter archive password for full decryption test (or press Enter to skip): "
read -s PASSWORD
echo "" # Print a newline after hidden input
echo "[*] Scanning directory recursively: $TARGET_DIR"
if [ -n "$PASSWORD" ]; then
echo "[*] Password provided: Archive full decryption & integrity test enabled."
else
echo "[*] Password skipped: Running signature, header encryption check, and SHA512 verification."
fi
echo "--------------------------------------------------"
ERROR_COUNT=0
FILE_COUNT=0
while IFS= read -r -d '' file; do
FILE_COUNT=$((FILE_COUNT + 1))
filename=$(basename "$file")
failed=0
echo "[*] Checking: $file"
# 1. Check if file ends in .7z or .sha512
if [[ "$filename" != *.7z && "$filename" != *.sha512 ]]; then
echo " [X] Failed extension check: does not end in .7z or .sha512"
failed=1
else
echo " [+] Extension check passed ($filename)"
fi
# 2. Check and enforce ownership (root:root)
owner=$(stat -c '%U:%G' "$file")
if [ "$owner" != "root:root" ]; then
echo " [!] Incorrect ownership ($owner). Fixing to root:root..."
chown root:root "$file"
if [ $? -ne 0 ]; then
echo " [X] Failed to change ownership to root:root."
failed=1
else
echo " [+] Ownership corrected to root:root."
fi
else
echo " [+] Ownership check passed (root:root)."
fi
# 3. Check and enforce permissions (600)
perms=$(stat -c '%a' "$file")
if [ "$perms" != "600" ]; then
echo " [!] Incorrect permissions ($perms). Fixing to 600..."
chmod 600 "$file"
if [ $? -ne 0 ]; then
echo " [X] Failed to change permissions to 600."
failed=1
else
echo " [+] Permissions corrected to 600."
fi
else
echo " [+] Permissions check passed (600)."
fi
# 4. If it is a .7z file, perform verification and SHA512 management
if [[ "$filename" == *.7z ]]; then
if [ -n "$PASSWORD" ]; then
# Full decryption and integrity test using the provided password
if ! 7z t -p"$PASSWORD" "$file" >/dev/null 2>&1; then
echo " [X] Failed integrity/decryption check: Incorrect password, corrupted archive, or invalid data."
failed=1
else
echo " [+] Archive successfully decrypted and integrity verified with password."
fi
else
# Fallback mode: Signature check + Header encryption verification
expected_header=$'\x37\x7a\xbc\xaf\x27\x1c'
file_header=$(head -c 6 "$file")
if [ "$file_header" != "$expected_header" ]; then
echo " [X] Failed format check: Not a valid 7-zip file signature."
failed=1
else
echo " [+] Valid 7-zip file signature confirmed."
# Confirm header/filename encryption is active (-mhe=on)
if 7z l "$file" </dev/null >/dev/null 2>&1; then
echo " [X] Failed encryption check: Archive headers/filenames are NOT encrypted."
failed=1
else
echo " [+] Filename and header encryption confirmed (-mhe=on active)."
fi
fi
fi
# SHA512 check / generation
sha_file="${file}.sha512"
if [ ! -f "$sha_file" ]; then
echo " [!] Missing .sha512 file. Generating..."
sha512sum "$file" > "$sha_file"
chown root:root "$sha_file"
chmod 600 "$sha_file"
if [ $? -eq 0 ]; then
echo " [+] Generated and secured new SHA512 checksum file."
else
echo " [X] Failed to generate or secure SHA512 checksum file."
failed=1
fi
else
echo " [+] Found existing .sha512 file. Verifying..."
file_dir=$(dirname "$file")
base_sha=$(basename "$sha_file")
if (cd "$file_dir" && sha512sum -c "$base_sha" >/dev/null 2>&1); then
echo " [+] SHA512 hash verification passed."
else
echo " [X] FAILED: SHA512 hash verification failed!"
failed=1
fi
fi
fi
if [ $failed -eq 1 ]; then
echo " [-] STATUS: FILE COMPLIANCE FAILED"
ERROR_COUNT=$((ERROR_COUNT + 1))
else
echo " [+] STATUS: OK"
fi
echo ""
done < <(find "$TARGET_DIR" -type f -print0)
echo "--------------------------------------------------"
echo "[*] Scan complete."
echo " Total files checked: $FILE_COUNT"
echo " Files with compliance failures: $ERROR_COUNT"
if [ $ERROR_COUNT -gt 0 ]; then
exit 1
else
exit 0
fi