Warning: chmod(): No such file or directory in /home/tuempresavirtual.cl/public_html/wp-content/plugins/appointment-hour-booking/app-booking-plugin.php on line 3
403WebShell
403Webshell
Server IP : 186.64.123.29  /  Your IP : 216.73.217.94
Web Server : LiteSpeed
System : Linux house.hostinglat.cl 5.15.0-185-generic #195-Ubuntu SMP Fri Jun 19 17:11:50 UTC 2026 x86_64
User : tuemp9827 ( 1016)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/CyberCP/plogical/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/CyberCP/plogical/rebuildQuotas.py
import os,sys

sys.path.append('/usr/local/CyberCP')
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
try:
    django.setup()
except:
    pass
import subprocess



class rebuildQuotas:

    def __init__(self):
        pass

    def Rebuild(self):
        try:
            print("Fixing and rebuilding Quotas...")

            fstab_path = '/etc/fstab'

            rData = open(fstab_path, 'r').read()

            if rData.find('xfs') > -1:
                command  = "mount | grep ' / '"

                try:
                    qResult = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
                except:
                    qResult = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)

                if qResult.stdout.find('usrquota') > -1:
                    print("Looks like Quotas are enabled in filesystem, moving on..")
                else:
                    print("Looks like Quotas are not enabled in filesystem, exiting.")
                    print("Please follow this guide to enable Quotas on XFS file system: ")
                    exit(1)
            else:
                command  = "mount | grep quota"
                try:
                    qResult = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
                except:
                    qResult = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                                             universal_newlines=True, shell=True)

                if qResult.stdout.find('usrquota') > -1:
                    print("Looks like Quotas are enabled in filesystem, moving on..")
                else:
                    print("Looks like Quotas are not enabled in filesystem, exiting.")
                    exit(1)


            from websiteFunctions.models import Websites
            for website in Websites.objects.all():
                print(f"Rebuilding quotas for {website.domain}...")
                command = 'chattr -R -i /home/%s/' % (website.domain)
                try:
                    qResult = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
                except:
                    qResult = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                                             universal_newlines=True, shell=True)

                if website.package.enforceDiskLimits:
                    spaceString = f'{website.package.diskSpace}M {website.package.diskSpace}M'
                    command = f'setquota -u {website.externalApp} {spaceString} 0 0 /'
                    print(command)
                    try:
                        qResult = subprocess.run(command, capture_output=True, universal_newlines=True, shell=True)
                    except:
                        qResult = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                                                 universal_newlines=True, shell=True)

                else:
                    print(f"Ignored {website.domain} because the selected package does not enforce disk limits.")
        except:
            pass

def main():

    rbQ = rebuildQuotas()
    rbQ.Rebuild()



if __name__ == "__main__":
    main()

Youez - 2016 - github.com/yon3zu
LinuXploit