From aa3a86335b22fcdb0fe0ea4c712c183a2390c8ad Mon Sep 17 00:00:00 2001 From: crt0mega Date: Wed, 13 Jan 2021 20:54:19 +0100 Subject: [PATCH] Initial upload --- byezlax | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100755 byezlax diff --git a/byezlax b/byezlax new file mode 100755 index 0000000..45b1170 --- /dev/null +++ b/byezlax @@ -0,0 +1,130 @@ +#!/bin/bash + +####################### +# Database connection # +####################### + +declare DB_NAME="hubzilla" +declare DB_HOST="localhost" +declare DB_PORT="3306" +declare DB_USER="user" +declare DB_PASS="pass" + +################### +# Array of Zlaxes # +################### + +declare -a SPAMMERS=( + "vm66%@diaspora.ruhrmail.de" + "ivan_exlax@pod.dapor.net" + "zlax@%" + "zlaxy@%" + "zlaxyizlax@%" + "zalx@%" + "zlxa@%" + "zlax%@d.consumium.org" + "vm66%@mondiaspora.net" + "vm66%@diaspora.club" + "vm66%@nerdpol.ch" + "vm66%@diasp.org" + "vm66%@diaspora.asrun.eu" + "vm66%@diaspora-fr.org" + "vm66%@diasporing.ch" + "vm66%@daspr.io" + "vm66%@pod.tchncs.de" + "mrd_ill_be_back@neptune.jerrylumpkins.me" + "mrd_ill_be_back@protagio.social" + "mrd_ill_be_back@pod.dapor.net" + "christophs@nota.404.mn" + "christophs@podbay.net" + "deusfigendi@neptune.jerrylumpkins.me" + "atomjack@podbay.net" + "atomjack@pod.tchncs.de" + "hackbyte@pod.dapor.net" + "hackbyte@diaspora.club" + "pufcorn@podbay.net" + "0mega@podbay.net" + "florida_ted@pod.dapor.net" + "jlumpkins@podbay.net" + "jlumpkins@pod.dapor.net" + "jlumpkins@spora.grin.hu" + "wurstaufbrot@pod.dapor.net" + "wurstaufbrot@pod.tchncs.de" + "owlmagic@pod.tchncs.de" + "kennychaffin@pod.tchncs.de" + "mrd_ill_be_back@pod.tchncs.de" + "alien23@pod.tchncs.de" + "johnhummel@diasporing.ch" + "dg7bba@pod.tchncs.de" + "heynicepod@pod.tchncs.de" + "christophs@pod.tchncs.de" + "hernan_labbe@pod.tchncs.de" + ) + +#################################### +# Extermination of Zlaxes' actions # +#################################### + +for SPAM in "${SPAMMERS[@]}" +do + echo "Preparing to remove items from handle $SPAM ..." + mysql --user=$DB_USER \ + --password=$DB_PASS \ + --database=$DB_NAME \ + --host=$DB_HOST \ + --port=$DB_PORT \ + --silent \ + -e "UPDATE item SET item_pending_remove = '1' WHERE author_xchan LIKE '$SPAM'; SELECT ROW_COUNT()" + #TODO: Add handle to serialized array in config where cat="system" and k="blacklisted_channels" +done + +################################################# +# Finally remove all marked items from database # +################################################# + +echo "All items have been marked for deletion and won't be visible anymore. If you wish to delete them permamently, type YES." +read REMOVAL + +if [ "$REMOVAL" = "YES" ]; then + mysql --user=$DB_USER \ + --password=$DB_PASS \ + --database=$DB_NAME \ + --host=$DB_HOST \ + --port=$DB_PORT \ + --silent \ + -e "DELETE from item WHERE item_pending_remove = '1'; SELECT ROW_COUNT()" +fi + +######################## +# Remove notifications # +######################## + +for SPAM in "${SPAMMERS[@]}" +do + POD=$(echo -e "$SPAM" | cut -f2 -d"@") + USR=$(echo -e "$SPAM" | cut -f1 -d"@") + URL="htt%://$POD/u/$USR" + echo "Preparing to remove notifications from handle $SPAM ..." + mysql --user=$DB_USER \ + --password=$DB_PASS \ + --database=$DB_NAME \ + --host=$DB_HOST \ + --port=$DB_PORT \ + --silent \ + -e "DELETE FROM notify WHERE url LIKE '$URL'; SELECT ROW_COUNT()" + +done + +############################################## +# TBD # +############################################## +# Blocking further communication from Zlaxes # +############################################## +# +#HZ_BANLIST=$(mysql --user=$DB_USER \ +# --password=$DB_PASS \ +# --database=$DB_NAME \ +# --host=$DB_HOST \ +# --port=$DB_PORT \ +# --silent \ +# -e "SELECT v FROM config WHERE cat='system' AND k='blacklisted_channels';")