Plesk Hack: Email and FTP Usernames And Passwords

Posted: November 9, 2009 in Debian
Great script i found 
#!/usr/bin/env bash
#**********************************************
# Plesk Quick Info Script v0.0.1
# Written by Patrick Burns
#  SQL Queries provided by Christopher Haynie
#  Special Thanks to Tim G. for the help
#
#   This script simply queries mysql to give all email addresses, ftp users, and passwords
#   associated with both
#
#       Features:
#         1.  No password required
#         2.  No mysql CLI knowledge required
#         3.  OS Detection, works on both FreeBSD and Linux (only redhat right now)
#
#
#
#     last modified: 2/24/2009
#**********************************************

#The following function determines if the machine is FreeBSD or Linux

function detect_os {
        OS=$(uname)
        if [ "${OS}" == "FreeBSD" ]; then
                echo
                #freebsd stuff
        elif [ "${OS}" == "Linux" ]; then
                DIST=$(lsb_release -si)
                VER=$(lsb_release -sr)
                ARCH=$(uname -i)
        fi
}

#The following function is the Linux Version, scroll down for the FreeBSD function

function linux_run {

echo $OS

    clear

    echo "                                          "
    echo "                                          "
    echo "##########################################"
    echo "#                                        #"
    echo "# Quick Plesk Info Troubleshooting Script#"
    echo "#                                        #"
    echo "#    Below are the email addresses       #"
    echo "#            on this server              #"
    echo "#                                        #"
    echo "##########################################"
    echo "                                          "
    echo "                                          "

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "SELECT accounts.id, mail.mail_name, accounts.password, domains.name FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id"

    echo "                                          "
    echo "                                          "
    echo "##########################################"
    echo "#                                        #"
    echo "#      Below are the ftp users           #"
    echo "#           on this server               #"
    echo "#                                        #"
    echo "##########################################"
    echo "                                          "
    echo "                                          "

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "select s.login,s.home,a.password from sys_users s,accounts a where a.id=s.account_id"
}  #END linux portion

#the following function is for FreeBSD

function freebsd_run {

    clear

    echo "                                          "
    echo "                                          "
    echo "##########################################"
    echo "#                                        #"
    echo "# Quick Plesk Info Troubleshooting Script#"
    echo "#                                        #"
    echo "#    Below are the email addresses       #"
    echo "#            on this server              #"
    echo "#                                        #"
    echo "##########################################"
    echo "                                          "
    echo "                                          "

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "SELECT accounts.id, mail.mail_name, accounts.password, domains.name FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id"

    echo "                                          "
    echo "                                          "
    echo "##########################################"
    echo "#                                        #"
    echo "#      Below are the ftp users           #"
    echo "#           on this server               #"
    echo "#                                        #"
    echo "##########################################"
    echo "                                          "
    echo "                                          "

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "select s.login,s.home,a.password from sys_users s,accounts a where a.id=s.account_id"
} #END freebsd portion

#Main Program:

detect_os

if [ "$OS" = "Linux" ]; then
	linux_run
else
	freebsd_run
fi
echo "doneskies..."
Comments
  1. Marcel says:

    as what kind of file do I have to save this script

  2. pankz says:

    can you please provide me your contact email id …
    need some help solving some problems…related to cpanel & plesk

  3. Greetings from Idaho! I’m bored at work so I decided to check out your site on my iphone during
    lunch break. I really like the knowledge you provide
    here and can’t wait to take a look when I get
    home. I’m surprised at how fast your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, wonderful blog!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s