!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/usr/lib/python2.4/site-packages/   drwxr-xr-x
Free 3.8 GB of 27.03 GB (14.07%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     ForgeBlackBox.py (3.47 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/python
import Alchemist
import os
import re
import stat
from xml.xslt.Processor import Processor

def getBox(box_cfg):
    """
    getBox: get a BlackBox from this module
    @box_cfg: a box_cfg conformant AdmList element containing
    the following elements:
    path: type string, the path to the context file (required)
    returns: Forge object
    """
    if box_cfg == None:
        raise ValueError
    return ForgeBlackBox(box_cfg)



class ForgeBlackBox(Alchemist.BlackBox):
    """o
    The ForgeBlackBox is the class which handles converting the xml with a XSLT
    stylesheet and writing this as a configuration file
    """

    def __init__(self,box_cfg):
        """
        __init__: Initialize a ForgeBlackBox
        @self: the class instance
        @box_cfg: a box_cfg conformant AdmList element containing
                  the following elements:
                  xslstylesheetpath: a string
                  configfilepath: a string
                  mode: an integer
        """
        
        self.status=0
        self.me=self.__class__.__module__
        self._errNo=0
        self._errStr=None
        self.readable=0
        self.writable=1
        Alchemist.validateBoxCfg(box_cfg)
        
        self.sspath=box_cfg.getChildByName("xslstylesheetpath").getValue()
        try:
            if os.access(self.sspath, os.R_OK):
                mode = os.stat(self.sspath)[stat.ST_MODE]
                if (not stat.S_ISREG(mode)):
                    raise ValueError
        except:
            raise ValueError, "ForgeBlackBox box_cfg must contain a 'xslstylesheetpath' entry pointing at a readable file (" + self.sspath + ")"

        try:
            self.cfgpath=box_cfg.getChildByName("configfilepath").getValue()
            if self.cfgpath=="SPLITFILES":
                self.splitfiles=1
            else:
                self.splitfiles=0
            
        except:
            raise ValueError, "ForgeBlackBox box_cfg must contain a 'configfilepath' entry"
        try:
            self.mode=box_cfg.getChildByName("mode").getValue()
        except:
            raise ValueError, "ForgeBlackBox box_cfg must contain a 'mode' entry"


   
    def write (self,context):
        """
        Extract xml, stylesheetpath and target file from the context
        and create the configuration file.
        @self: the class instance
        @context: the context from which to extract information
        """

        xml_string = context.toXML()
        if (not xml_string):
            return 0

        processor=Processor()
        processor.appendStylesheetFile(self.sspath)
        result=processor.runString(xml_string)
        if (self.splitfiles==0):
            fd = os.open(self.cfgpath, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, self.mode)
            file = os.fdopen(fd, "w")
            file.write(result)
            file.close()
        else:
            myreg=re.compile(r'^--------CUTFILEHERE: (?P<filename>.*?)$(?P<content>.*?)^--------ENDFILEHERE?(?P<remaining>.*)',re.MULTILINE|re.DOTALL)
            match=1
            while match:
                match=myreg.search(result)
                if not match:
                    break
                else:
                    result=match.group("remaining")
                    fd = os.open(match.group("filename"), os.O_WRONLY | os.O_CREAT | os.O_TRUNC, self.mode)
                    file = os.fdopen(fd, "w")
                    file.write(match.group("content"))
                    file.close()
                    
            

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0028 ]--