From 12eb2b0eb6f9f6d0e115d6b9369acfe9c8c065aa Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:22:19 +1100 Subject: [PATCH] Remove unused stuff --- .dockerignore | 6 ++---- .gitignore | 1 - botStartup.bat | 1 - startWithYarn.cjs | 1 - ufwReject.sh | 35 ----------------------------------- 5 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 botStartup.bat delete mode 100644 startWithYarn.cjs delete mode 100755 ufwReject.sh diff --git a/.dockerignore b/.dockerignore index 1d4e483..8936d2c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,6 @@ # Pointless stuff Dockerfile -docker-compose.yml +docker-compose.*.yml .ncurc.json .env .mailmap @@ -9,8 +9,6 @@ docker-compose.yml .github postgres-replica-stuff README.md -ufwReject.sh # Startup files -startWithYarn.cjs -botStartup.bat +startDocker.sh diff --git a/.gitignore b/.gitignore index c55b01c..9a2e64d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .env -ips.txt # Yarn stuff .yarn # TypeScript stuff diff --git a/botStartup.bat b/botStartup.bat deleted file mode 100644 index 7d5b42a..0000000 --- a/botStartup.bat +++ /dev/null @@ -1 +0,0 @@ -pm2 start startWithYarn.cjs --name Daggerbot diff --git a/startWithYarn.cjs b/startWithYarn.cjs deleted file mode 100644 index f26c1e2..0000000 --- a/startWithYarn.cjs +++ /dev/null @@ -1 +0,0 @@ -require('node:child_process').spawn('yarn node dist/index.js', {stdio: [null,process.stdout,process.stderr,null], windowsHide: true, shell: true}) \ No newline at end of file diff --git a/ufwReject.sh b/ufwReject.sh deleted file mode 100755 index d148a0a..0000000 --- a/ufwReject.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -if [ "$EUID" -ne 0 ]; then - echo "Please run this script as root or sudo" - exit 1 -fi - -# Store the IP addresses in a file -IP_ADDRESSES_STORE="ips.txt" - -# Scan the kernel log for IP addresses and store them in a file -dmesg | grep 'SRC=' | awk -F'SRC=' '{ print $2 }' | awk '{ print $1 }' | sort | uniq | head -n 5000 > "$IP_ADDRESSES_STORE" - -# Initialize a counter for new IPs -new_ips=0 - -# Store the output of ufw status in a variable -ufw_status=$(ufw status) - -# Populate the UFW reject rule with the IP addresses collected from the kernel log -while IFS= read -r ip -do - ip_prefix="${ip%.*}" - # Check if the IP is already in the UFW rules - if ! echo "$ufw_status" | grep -q "$ip" && [ "$ip_prefix" != "${TOAST_IP%.*}" ] - then - ufw reject from $ip - # Increment the counter - ((new_ips++)) - fi -done < "$IP_ADDRESSES_STORE" - -echo "Done populating UFW reject rule" -echo "$new_ips IP addresses were added" -exit 0