initial commit via gitinitshit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# todo:
|
||||
## auto byobu?
|
||||
|
||||
# to use dis i need to do checks for the dfiles that cleanup_environ cleans
|
||||
# set -e # stahp on any errpr
|
||||
|
||||
# all thos silly hex sillyvalues from 0x00000 to 0xFFFFF
|
||||
# to be used to split the hibp sha1 file into multiple files
|
||||
# each file containing all sha1 hashes starting with that sillyvalue
|
||||
dec_max=1048575
|
||||
start_val_hex=0x00000
|
||||
end_val_hex=0xFFFFF
|
||||
increment_hex=0x00001
|
||||
|
||||
# da file shit
|
||||
timestamp=$(date +%Y%m%d)
|
||||
# tmp file values
|
||||
## this is the value fed to haveibeenpwned-downloader
|
||||
## it automatically appends .txt to da filename
|
||||
tmp_file="$PWD/${timestamp}_hibp_sha1.tmp"
|
||||
## this is the txt file created by haveibeenpwned-downloader
|
||||
tmp_file_txt="$tmp_file.txt"
|
||||
new_dir="$PWD/${timestamp}_haveibeenpwned_sha1"
|
||||
softlink_name="$PWD/hibp_sha1_dir"
|
||||
softlink_target="$new_dir"
|
||||
|
||||
setup_environ () {
|
||||
# cleanup environment
|
||||
# fail quietly if no such files/dirs exist
|
||||
## nuek any temp files
|
||||
# rm -f $PWD/*_hibp_sha1.tmp.txt 2>/dev/null
|
||||
## delet any old hibp sha1 dirs
|
||||
# rm -rf $PWD/*_haveibeenpwned_sha1 2>/dev/null
|
||||
|
||||
# make new dir for new hibp sha1 files
|
||||
mkdir -p "$new_dir" # exit quietly if exists
|
||||
}
|
||||
|
||||
finish_cleanup () {
|
||||
# nuke da temp file
|
||||
rm -f "$tmp_file_txt"
|
||||
# reboot in 2 mins to clear any cached
|
||||
sudo shutdown -r +2
|
||||
}
|
||||
|
||||
downdoot_file () {
|
||||
# downdoot da fuckin file
|
||||
haveibeenpwned-downloader "$tmp_file"
|
||||
}
|
||||
|
||||
# fuckin do the hell
|
||||
do_the_fucking_split () {
|
||||
# loop throught a bajuilli9opn fuckin numbs for hex bitch
|
||||
for((i=0; i<=$dec_max; i++)) {
|
||||
current_hex=$(printf "0x%05X" $i)
|
||||
echo "$current_hex"
|
||||
|
||||
# do da fuckin hunt and shit fuckbitchfuck
|
||||
rg --no-line-number "^$current_hex" "$tmp_file_txt" > "$new_dir/$current_hex.txt"
|
||||
}
|
||||
}
|
||||
|
||||
post_process_files () {
|
||||
# softlink
|
||||
# s softlink, f force overwrite existing softlink, n no dereference treat as dir
|
||||
ln -sfn "$softlink_target" "$softlink_name"
|
||||
}
|
||||
|
||||
setup_environ
|
||||
downdoot_file
|
||||
do_the_fucking_split
|
||||
post_process_files
|
||||
# finish_cleanup
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
smbencrypt dingle | awk '{print $1}' | tail -1
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
echo "$1" | sha1sum | awk '{print $1}' | tr 'a-z' 'A-Z'
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# fiels
|
||||
input_file=./test_sha1.tmp.txt
|
||||
sorted_file=./test_SORTED_sha1.tmp.txt
|
||||
backup_file=./bak/20251020_single_sha1.txt.7z
|
||||
# lougs
|
||||
info_log=./info_log.log
|
||||
error_log=./error_log.log
|
||||
|
||||
# start da timer
|
||||
echo "startin timer"
|
||||
start=$(date +%s)
|
||||
|
||||
# do da magical sortfuck
|
||||
echo "performin da magical sortfuck"
|
||||
# awk '{val="0x" $1; print strtonum(val),$0 ;}' "$input_file" | sort -n -k 1 | sed 's/^[^ ]* //' > "$sorted_file" 2>> "$error_log"
|
||||
awk '{val="0x" $1; print strtonum(val),$0 ;}' $input_file | sort -n -k 1 | sed 's/^[^ ]* //' > $sorted_file
|
||||
echo "finished da magical sortfuck! retcode $?"
|
||||
|
||||
# end da timer and caluclate duratrion
|
||||
echo "endin timer"
|
||||
end=$(date +%s)
|
||||
duration=$(($end - $start))
|
||||
echo "sorted (in theoty) in $duration seconds"
|
||||
|
||||
# updoot da log
|
||||
## can reuse dis in a function or sumshit
|
||||
echo "loggin shit"
|
||||
echo "$(date): $input_file sorted to $sorted_file in $duration seconds" | tee -a "$info_log"
|
||||
|
||||
# send silly webhookfuckin
|
||||
echo "sendin webhookfuckin"
|
||||
webhook "DILDO MACCARONI ITS FOOKAN DONE IN FOOKAN $duration SECONDS" true
|
||||
|
||||
# maek an backup
|
||||
echo "maekan a backup"
|
||||
7z a "$backup_file" "$input_file"
|
||||
|
||||
# mayhaps reboot
|
||||
## 10 minute delay to make sure shit fucks
|
||||
echo "doin an rebootasn in 10 mins or sumtin"
|
||||
sudo shutdown -r +10 "REBOOTFUCKIN IN 10 MINS BITCH"
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# fiels
|
||||
input_file=./test_sha1.tmp.txt
|
||||
sorted_file=./test_SORTED_sha1.tmp.txt
|
||||
# lougs
|
||||
info_log=./info_log.log
|
||||
error_log=./error_log.log
|
||||
|
||||
# maek an backup
|
||||
echo "maekan a backup"
|
||||
cp "$input_file" "$input_file.bak"
|
||||
|
||||
# start da timer
|
||||
echo "startin timer"
|
||||
start=$(date +%s)
|
||||
|
||||
# do da magical sortfuck
|
||||
echo "performin da magical sortfuck"
|
||||
awk '{val="0x" $1; print strtonum(val),$0 ;}' "$input_file" | sort -n -k 1 | sed 's/^[^ ]* //' > "$sorted_file" 2>> "$error_log"
|
||||
echo "finished da magical sortfuck! retcode $?"
|
||||
|
||||
# end da timer and caluclate duratrion
|
||||
echo "endin timer"
|
||||
end=$(date +%s)
|
||||
duration=$(($end - $start))
|
||||
echo "sorted (in theoty) in $duration seconds"
|
||||
|
||||
# updoot da log
|
||||
## can reuse dis in a function or sumshit
|
||||
echo "loggin shit"
|
||||
echo "$(date): $input_file sorted to $sorted_file in $duration seconds" | tee -a "$info_log"
|
||||
|
||||
# send silly webhookfuckin
|
||||
echo "sendin webhookfuckin"
|
||||
webhook "DILDO MACCARONI ITS FOOKAN DONE IN FOOKAN $duration SECONDS" true
|
||||
|
||||
# mayhaps reboot
|
||||
## 10 minute delay to make sure shit fucks
|
||||
echo "doin an rebootasn in 10 mins or sumtin"
|
||||
sudo shutdown -r +10 "REBOOTFUCKIN IN 10 MINS BITCH"
|
||||
Reference in New Issue
Block a user