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

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

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


Viewing file:     xserver.py (7.37 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#
# xserver.py - initial xserver startup for GUI mode.
#
# Michael Fulbright <msf@redhat.com>
# Matt Wilson <msw@redhat.com>
# Brent Fox <bfox@redhat.com>
# Chris Lumens <clumens@redhat.com>
#
# Copyright 1999-2006 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import os
import string
import subprocess
import sys
import time

import videocard
import monitor
import mouse
import rhpl.translate as translate
import rhpl.arch
from rhpl.translate import _
from xhwstate import *
import xf86config

translate.textdomain('rhpxl')

END = 0
PROBED = 1
LCD = 2
VESA = 3
FB = 4

class XServer:
    def __init__(self):
        self.config = None
        self.defaultdepth = 24
        self.display = ":9"
        self.hwstate = None
        self.keyboard = None
        self.logfile = "/dev/null"
        self.monitorhw = None
        self.mousehw = None
        self.resolution = "800x600"
        self.root = "/"
        self.serverflags = ["vt6", "-config", "/tmp/XConfig.test",
                            "-extension", "Composite", "-s", "1440", "-dpms",
                            "-v", "-ac", "-nolisten", "tcp", "-fp",
                            "/usr/share/X11/fonts/misc"]
        self.videohw = None

    def generateConfig(self):
        if self.hwstate.videocard == None:
            return

        self.config = self.hwstate.generate_xconfig(self.mousehw, self.keyboard)

    def addExtraScreen(self, identifier):
        screen = xf86config.XF86ConfScreen()
        self.config.screen.insert(screen)
        screen.identifier = identifier
        # Might need to make this a parameter in the future.
        screen.device = "Videocard0"
        screen.defaultdepth = self.defaultdepth

        display = xf86config.XF86ConfDisplay()
        screen.display.insert(display)
        display.modes.insert(xf86config.XF86Mode(self.resolution))

    def writeConfig(self, filename="/tmp/XConfig.test"):
        if self.config:
            self.config.write(filename)

    def setHWState(self, confFile=None):
        self.hwstate = XF86HardwareState(defcard=self.videohw, defmon=self.monitorhw,
                                         probeflags=XF86HW_PROBE_NONE, xconfig=confFile)
        self.hwstate.set_videocard_driver(self.videohw.primaryCard().getDriver())

    def probeHW(self, skipMouseProbe=0, logFunc=None, forceDriver=None):
        self.videohw = videocard.VideoCardInfo(forceDriver=forceDriver)

        if self.videohw and self.videohw.primaryCard():
            cardstr = self.videohw.primaryCard().getDescription()
        else:
            cardstr = _("Unable to probe")

        cardstr = _("Probing for video card:   %s") % (cardstr,)
        if logFunc is None:
            print cardstr
        else:
            logFunc(cardstr)

        self.monitorhw = monitor.MonitorInfo()
        self.mousehw = mouse.Mouse(skipProbe=skipMouseProbe)

    def startX(self, xStartedCB=None, useFB=False):
        if not os.access("/usr/bin/Xorg", os.X_OK):
            raise RuntimeError, "No X server binaries found to run"

        os.environ['DISPLAY'] = self.display

        # use the framebuffer server by default on ppc
        if rhpl.arch.getCanonArch() == "ppc64pseries" or useFB:
            attempt = FB
        else:
            attempt = PROBED

        while attempt != END:
            (found_card, attempt) = self._getAttempt(attempt, self.videohw.primaryCard())

            if found_card:
                try:
                    self.hwstate.set_resolution(self.resolution)
                    self.writeConfig()

                    self.hwstate.set_resolution(self.resolution, change=True)
                    pid = self._run(xStartedCB=xStartedCB)
                    return pid
                except (RuntimeError, IOError):
                    pass

        # If we make it here, no card was defined so we have no choice but to error
        raise RuntimeError, "No X server binaries found to run"

    def _getAttempt(self, attempt, primary_card):
        if attempt == END:
            return (False, END)
        elif attempt == PROBED:
            if primary_card is not None:
                print _("Attempting to start native X server")
                return (True, LCD)

            return (False, LCD)
        elif attempt == LCD:
            if primary_card and self.logfile != "/dev/null" and os.access(self.logfile, os.R_OK):
                import guesslcd

                (xres, yres) = guesslcd.scanXLogForLCD(self.logfile, primary_card.getDriver())
                if xres:
                    self.resolution = "%sx%s" % (xres, yres)
                    print _("Attempting to start native X server using resolution %s") % self.resolution
                    return (True, VESA)

            return (False, VESA)
        elif attempt == VESA:
            if primary_card and primary_card.getDescription() != "VESA driver (generic)":
                print _("Attempting to start VESA X server")
                if primary_card.getVideoRam():
                    self.videohw = videocard.VideoCardInfo(forceDriver="vesa")
                    self.hwstate.set_videocard_driver(self.videohw.primaryCard().getDriver())
                    self.hwstate.merge_into(self.config)
                    return (True, END)

            return (False, END)
        elif attempt == FB:
            print _("Attempting to start frame buffer X server")
            self.videohw = videocard.VideoCardInfo(forceDriver="fbdev")
            self.hwstate.set_videocard_driver(self.videohw.primaryCard().getDriver())
            self.hwstate.merge_into(self.config)
            return (True, END)

    def _run(self, xStartedCB = None):
        def chroot():
            if self.root != "/":
                os.chroot(self.root)
                os.chdir("/")

        args = ['-logfile', self.logfile, self.display] + self.serverflags

        if self.hwstate.videocard == None:
            sys.stderr.write("X SERVER FAILED\n")
            raise RuntimeError, "X server failed to start"

        noOutput = os.open("/dev/null", os.O_RDWR)

        try:
            proc = subprocess.Popen(["/usr/bin/Xorg"] + args, preexec_fn=chroot,
                                    stdout=noOutput, stderr=noOutput)

            sys.stdout.write(_("Waiting for X server to start...log located in %s\n") % self.logfile)
            sys.stdout.flush()

            for i in range(5):
                time.sleep(1)
                sys.stdout.write("%s..." % (i+1))
                sys.stdout.flush()

                # If the X process failed for some reason, raise an error now.
                if proc.poll() is not None:
                    raise OSError
        except OSError:
            sys.stderr.write("X SERVER FAILED\n");
            raise RuntimeError, "X server failed to start"
        except:
            import traceback
            (ty, value, tb) = sys.exc_info()
            lst = traceback.format_exception (ty, value, tb)
            text = string.joinfields (lst, "")
            print text

            sys.stderr.write("X SERVER FAILED\n")
            raise RuntimeError, "X server failed to start"

        print _(" X server started successfully.")

        if xStartedCB is not None:
            xStartedCB()

        return proc.pid

:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0119 ]--