Posts

Showing posts from December, 2019

Plesk - Decrypt FTP Passwords

I was working on a project where Plesk user details were being imported into a database and it would help to know the password. Since Plesk 11 the Plesk Client account is hashed which makes it unrecoverable, but other passwords are encrypted with 128 bit AES encryption and a salt. If the FTP login name is the same as the client login there is a chance the customer was lazy and used the same details. To decrypt the passwords you will need the server secret key and the password string from the plesk database. The server secret key can be retrieved with the following command on a linux server: cat /etc/psa/private/secret_key | base64 Matching FTP logins (and their encrypted password) can be retrieved from the Plesk database with: SELECT REPLACE(s.home, '/var/www/vhosts/', '') AS domain, c.login, a.password FROM clients c LEFT JOIN sys_users s ON s.login = c.login LEFT JOIN accounts a on s.account_id = a.id; The results will look like: +-------------------

MySQL - Sort by IP Address

If you have a column containing ip addresses, sort the ip addresses numerically with: ORDER BY  INET_ATON(ip_address_column)