Created
October 12, 2014 05:41
-
-
Save ryanrhanson/41330e36d7e21c4fdea9 to your computer and use it in GitHub Desktop.
Lists all users with duplicate password (and their password) - Tested with up to Plesk 11.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Lists all users that share a password with other users. Sorted by the duplicate passwords. This could probably be optimized in a hundred different ways, but it works. | |
#Grab our list of duplicate passwords | |
mysql psa -BNse "select password from mail left join domains on mail.dom_id = domains.id inner join accounts where mail.account_id = accounts.id and postbox = 'true' group by password having COUNT(*) > 1" | while read -r line | |
do | |
echo "=====" | |
echo "Users with password $line" | |
echo "=====" | |
#Output a list in the format of user@domain, where the users share the same password. | |
mysql psa -BNse "select concat(mail_name,'@',name) from mail left join domains on mail.dom_id = domains.id inner join accounts where mail.account_id = accounts.id and postbox = 'true' and password = '$line' " | |
echo "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment