!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16. PHP/5.4.16 

uname -a: Linux roko-bkp 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64 

uid=48(apache) gid=48(apache) groups=48(apache),1003(webmaster) 

Safe-mode: OFF (not secure)

/var/www/html/lib/fckeditor/editor/filemanager/connectors/perl/   drwxr-xr-x
Free 9.17 GB of 93.48 GB (9.81%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     commands.pl (5.58 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#####
#  FCKeditor - The text editor for Internet - http://www.fckeditor.net
#  Copyright (C) 2003-2009 Frederico Caldeira Knabben
#
#  == BEGIN LICENSE ==
#
#  Licensed under the terms of any of the following licenses at your
#  choice:
#
#   - GNU General Public License Version 2 or later (the "GPL")
#     http://www.gnu.org/licenses/gpl.html
#
#   - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
#     http://www.gnu.org/licenses/lgpl.html
#
#   - Mozilla Public License Version 1.1 or later (the "MPL")
#     http://www.mozilla.org/MPL/MPL-1.1.html
#
#  == END LICENSE ==
#
#  This is the File Manager Connector for Perl.
#####

sub GetFolders
{

    local($resourceType, $currentFolder) = @_;

    # Map the virtual path to the local server path.
    $sServerDir = &ServerMapFolder($resourceType, $currentFolder);
    print "<Folders>";            # Open the "Folders" node.

    opendir(DIR,"$sServerDir");
    @files = grep(!/^\.\.?$/,readdir(DIR));
    closedir(DIR);

    foreach $sFile (@files) {
        if($sFile != '.' && $sFile != '..' && (-d "$sServerDir$sFile")) {
            $cnv_filename = &ConvertToXmlAttribute($sFile);
            print '<Folder name="' . $cnv_filename . '" />';
        }
    }
    print "</Folders>";            # Close the "Folders" node.
}

sub GetFoldersAndFiles
{

    local($resourceType, $currentFolder) = @_;
    # Map the virtual path to the local server path.
    $sServerDir = &ServerMapFolder($resourceType,$currentFolder);

    # Initialize the output buffers for "Folders" and "Files".
    $sFolders    = '<Folders>';
    $sFiles        = '<Files>';

    opendir(DIR,"$sServerDir");
    @files = grep(!/^\.\.?$/,readdir(DIR));
    closedir(DIR);

    foreach $sFile (@files) {
        if($sFile ne '.' && $sFile ne '..') {
            if(-d "$sServerDir$sFile") {
                $cnv_filename = &ConvertToXmlAttribute($sFile);
                $sFolders .= '<Folder name="' . $cnv_filename . '" />' ;
            } else {
                ($iFileSize,$refdate,$filedate,$fileperm) = (stat("$sServerDir$sFile"))[7,8,9,2];
                if($iFileSize > 0) {
                    $iFileSize = int($iFileSize / 1024);
                    if($iFileSize < 1) {
                        $iFileSize = 1;
                    }
                }
                $cnv_filename = &ConvertToXmlAttribute($sFile);
                $sFiles    .= '<File name="' . $cnv_filename . '" size="' . $iFileSize . '" />' ;
            }
        }
    }
    print $sFolders ;
    print '</Folders>';            # Close the "Folders" node.
    print $sFiles ;
    print '</Files>';            # Close the "Files" node.
}

sub CreateFolder
{

    local($resourceType, $currentFolder) = @_;
    $sErrorNumber    = '0' ;
    $sErrorMsg        = '' ;

    if($FORM{'NewFolderName'} ne "") {
        $sNewFolderName = $FORM{'NewFolderName'};
        $sNewFolderName =~ s/\.|\\|\/|\||\:|\?|\*|\"|<|>|[[:cntrl:]]/_/g;
        # Map the virtual path to the local server path of the current folder.
        $sServerDir = &ServerMapFolder($resourceType, $currentFolder);
        if(-w $sServerDir) {
            $sServerDir .= $sNewFolderName;
            $sErrorMsg = &CreateServerFolder($sServerDir);
            if($sErrorMsg == 0) {
                $sErrorNumber = '0';
            } elsif($sErrorMsg eq 'Invalid argument' || $sErrorMsg eq 'No such file or directory') {
                $sErrorNumber = '102';        #// Path too long.
            } else {
                $sErrorNumber = '110';
            }
        } else {
            $sErrorNumber = '103';
        }
    } else {
        $sErrorNumber = '102' ;
    }
    # Create the "Error" node.
    $cnv_errmsg = &ConvertToXmlAttribute($sErrorMsg);
    print '<Error number="' . $sErrorNumber . '" />';
}

sub FileUpload
{
eval("use File::Copy;");

    local($resourceType, $currentFolder) = @_;
    $allowedExtensions = $allowedExtensions{$resourceType};

    $sErrorNumber = '0' ;
    $sFileName = '' ;
    if($new_fname) {
        # Map the virtual path to the local server path.
        $sServerDir = &ServerMapFolder($resourceType,$currentFolder);

        # Get the uploaded file name.
        $sFileName = $new_fname;
        $sFileName =~ s/\\|\/|\||\:|\?|\*|\"|<|>|[[:cntrl:]]/_/g;
        $sFileName =~ s/\.(?![^.]*$)/_/g;

        $ext = '';
        if($sFileName =~ /([^\\\/]*)\.(.*)$/) {
            $ext  = $2;
        }

        $allowedRegex = qr/^($allowedExtensions)$/i;
        if (!($ext =~ $allowedRegex)) {
            SendUploadResults('202', '', '', '');
        }

        $sOriginalFileName = $sFileName;

        $iCounter = 0;
        while(1) {
            $sFilePath = $sServerDir . $sFileName;
            if(-e $sFilePath) {
                $iCounter++ ;
                ($path,$BaseName,$ext) = &RemoveExtension($sOriginalFileName);
                $sFileName = $BaseName . '(' . $iCounter . ').' . $ext;
                $sErrorNumber = '201';
            } else {
                copy("$img_dir/$new_fname","$sFilePath");
                if (defined $CHMOD_ON_UPLOAD) {
                    if ($CHMOD_ON_UPLOAD) {
                        umask(000);
                        chmod($CHMOD_ON_UPLOAD,$sFilePath);
                    }
                }
                else {
                    umask(000);
                    chmod(0777,$sFilePath);
                }
                unlink("$img_dir/$new_fname");
                last;
            }
        }
    } else {
        $sErrorNumber = '202' ;
    }
    $sFileName    =~ s/"/\\"/g;

    SendUploadResults($sErrorNumber, $GLOBALS{'UserFilesPath'}.$resourceType.$currentFolder.$sFileName, $sFileName, '');
}

sub SendUploadResults
{

    local($sErrorNumber, $sFileUrl, $sFileName, $customMsg) = @_;

    # Minified version of the document.domain automatic fix script (#1919).
    # The original script can be found at _dev/domain_fix_template.js
    # Note: in Perl replace \ with \\ and $ with \$
    print <<EOF;
Content-type: text/html

<script type="text/javascript">
(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|\$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();

EOF
    print 'window.parent.OnUploadCompleted(' . $sErrorNumber . ',"' . JS_cnv($sFileUrl) . '","' . JS_cnv($sFileName) . '","' . JS_cnv($customMsg) . '") ;';
    print '</script>';
    exit ;
}

1;

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0041 ]--