Posts

Showing posts from July, 2024

delete admin users automatically in turdpress

So, Turdpress (aka wordpress) randomly gets hacker users added to the list of admin users. This sucks. Hence it is called Turdpress. To fix:  Make a folder, something like /scripts/ mkdir /scripts inside there make two shell scripts, call them delete.sh and run_sql.sh set up a user, e.g. john , to automatically run mysql as root without authentication (obviously put a strong password on that user).  mysql_config_editor set --host=localhost --user=john --password mysql_config_editor set --host=localhost --user=root --password Script: run_sql.sh #!/bin/sh if [ -z "`cat $1 | grep -i drop `" ] ; then su - john -c mysql < $1 else echo "Dont like that sql, bye" fi Script: delete.sh #!/bin/sh for i in cat list.txt ; do ( echo $i cat delete.sql | sed -e s/xxx/$i/g > /tmp/delete-$i.sql  sh run_sql.sh /tmp/delete-$i.sql rm /tmp/delete-$i.sql ) ; done Now make the basic SQL commands to run. In this SQL, leave the xxx in place but replace #1, #2, etc., with ...