!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: nginx/1.23.4. PHP/5.6.40-65+ubuntu20.04.1+deb.sury.org+1 

uname -a: Linux foro-restaurado-2 5.15.0-1040-oracle #46-Ubuntu SMP Fri Jul 14 21:47:21 UTC 2023
aarch64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/home/scripts/pba/phc-read-only/src/lib/   drwxrwxr-x
Free 83.21 GB of 96.73 GB (86.02%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     escape.cpp (3.26 KB)      -rw-rw-r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
 * phc -- the open source PHP compiler
 * See doc/license/README.license for licensing information
 *
 * Various routines for escaping strings.
 */

#include <sstream>
#include <iomanip> 

#include "lib/String.h"

using namespace std;

// TODO: All of these functions could be substantially refactored, as they
// all duplicate functionality, but are all slightly different. No point
// fixing them now, as they work, but if they need to be bug-fixed, it might
// be easier to refactor them at the same time.

String* escape_C_dq (String* s)
{
    stringstream ss;

    foreach (char c, *s)
    {
        if(c == '"' || c == '\\')
        {
            ss << "\\" << c;
        }
        else if(c >= 32 && c < 127)
        {
            ss << c;
        }
        else
        {
            ss << "\\" << setw(3) << setfill('0') << oct << uppercase << (unsigned long int)(unsigned char) c;
            ss << resetiosflags(ss.flags ());
        }
    }

    return new String (ss.str());
}

String* escape_C_comment (String* s)
{
    // TODO: this really just needs to remove \ns
    stringstream ss;

    foreach (char c, *s)
    {
        if(c == '\n')
        {
            ss << "\\" << c;
        }
        else if((c >= 32 && c < 127) || c == '\t')
        {
            ss << c;
        }
        else
        {
            ss << "\\" << setw(3) << setfill('0') << oct << uppercase << (unsigned long int)(unsigned char) c;
            ss << resetiosflags(ss.flags ());
        }
    }

    return new String (ss.str());
}

String* escape_PHP_dq (String* s)
{
    stringstream os;

    string::iterator i;
    for(i = s->begin(); i != s->end(); i++)
    {
        switch(*i)
        {
            case '\n':
                os << "\\n";
                break;
            case '\r':
                os << "\\r";
                break;
            case '\t':
                os << "\\t";
                break;
            case '\\':
            case '$':
            case '"':
                os << "\\" << *i;
                break;
            default:
                if(*i < 32 || *i == 127)
                {
                        os << "\\x" << setw(2) <<
                            setfill('0') << hex << uppercase << (unsigned long int)(unsigned char)*i;
                        os << resetiosflags(os.flags());
                }
                else
                    os << *i;
                break;
        }
    }
    
    return new String(os.str());    
}

String* escape_PHP_sq (String* s)
{
    stringstream os;

    string::iterator i;
    for(i = s->begin(); i != s->end(); i++)
    {
        switch (*i)
        {
            case '\'': // single quote
            case '\\': // backslash
                os << '\\' << *i;
                break;
            default:
                os << *i;
                break;
        }
    }
    
    return new String(os.str());    
}


String* escape_DOT (String* in, int max_length)
{
    unsigned ml = max_length;

    if (max_length == -1)
        ml = in->size();

    stringstream escaped;
    unsigned i;

    for(i = 0; i < ml && i < in->size(); i++)
    {
        switch((*in)[i])
        {
            case '\\':
            case '"':
            case '|':
            case '{':
            case '}':
                escaped << "\\" << (*in)[i];
                break;
            default:
                if((*in)[i] >= 32 && (*in)[i] != 127) escaped << (*in)[i];
                break;
        }
    }    

    if(i < in->size())
        escaped << "..";

    return s(escaped.str());
}

String* escape_DOT_record (String* in, int max_length)
{
    unsigned ml = max_length;

    if (max_length == -1)
        ml = in->size();

    stringstream escaped;
    unsigned i;

    for(i = 0; i < ml && i < in->size(); i++)
    {
        switch((*in)[i])
        {
            case '\\':
            case '>': // must be escaped within the label of a record
            case '<': // must be escaped within the label of a record
            case '"':
                escaped << "\\" << (*in)[i];
                break;
            default:
                if((*in)[i] >= 32 && (*in)[i] != 127) escaped << (*in)[i];
                break;
        }
    }    

    if(i < in->size())
        escaped << "..";

    return s(escaped.str());
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by HackingTool | HackingTool | Generation time: 0.0053 ]--