!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/sbin/   drwxr-xr-x
Free 52.29 GB of 127.8 GB (40.92%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     system-cdinstall-helper (11.22 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/python -tt
#
# Copyright 2006  Red Hat, Inc.
#
# Jeremy Katz <katzj@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 only
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


import os, sys
# # Python gettext:
# import gettext
from optparse import OptionParser

try:
    import gtk
    import gtk.glade
    import gtk.gdk as gdk    
except Exception, e:
    print >> sys.stderr, "Unable to import modules.  Maybe you're not running under X?"
    sys.exit(1)

from rhpl.exception import installExceptionHandler
from rhpl.translate import _, N_, textdomain

from yum.constants import *

from pirut import *
from pirut.constants import *
from pirut.Errors import *

if os.path.exists("data/cdinstaller.glade"):
    gladefn = "data/cdinstaller.glade"
else:
    gladefn = PIRUTUI + "cdinstaller.glade"

# # Python gettext:
# t = gettext.translation(I18N_DOMAIN, "/usr/share/locale", fallback = True)
# _ = t.lgettext

# lame main loop runner... this should probably just be where we need it
def _runGtkMain(*args):
    while gtk.events_pending():
        gtk.main_iteration()
    

class CDInstaller(GraphicalYumBase):
    def __init__(self, config, repopath):
        self.xml = gtk.glade.XML(gladefn, domain=I18N_DOMAIN)
        self.mainwin = gtk.Assistant()
        self.mainwin.set_icon_name(PIRUTPIX + "pirut.png")
        self._connectSignals()
        self._setupRepo = False
        self._setupAllRepos = False

        GraphicalYumBase.__init__(self, False, config)
        
        self._setupTitlePage()
        self._setupGroupViewPage()
        self._setupConfirmPage()
        self._setupInstallPage()
        self._setupSummaryPage()

        self.enabled_repos = self.repos.listEnabled()
        map(lambda x: x.disable(), self.enabled_repos)

        # set up the repo
        self.cdreponame = "extracdinstaller"
        repo = yum.yumRepo.YumRepository(self.cdreponame)
        if not (repopath.startswith("http://") or
                repopath.startswith("ftp://")):
            repopath = "file://%s" %(os.path.abspath(repopath,))
        repo.baseurl.append(repopath)
        conf = yum.config.RepoConf()
        for k, v in conf.iteritems():
            if v or not hasattr(repo, k):
                repo.setAttribute(k, v)
        repo.basecachedir = self.conf.cachedir
        repo.metadata_expire = 0
        repo.enable()
        self.repos.add(repo)

    def _setupPage(self, page, text, type, done = False,
                   image = "pirut.png"):
        self.mainwin.append_page(page)
        if image.endswith(".png") or image.endswith(".gif"):
            if not image.startswith("/") and not image.startswith("./"):
                image = PIRUTPIX + image
            p = gtk.gdk.pixbuf_new_from_file(image)
        else:            
            i = gtk.Image()
            i.set_from_icon_name(image, gtk.ICON_SIZE_DIALOG)
            p = i.get_pixbuf()
        self.mainwin.set_page_header_image(page, p)
        self.mainwin.set_page_title(page, text)
        self.mainwin.set_page_type(page, type)
        self.mainwin.set_page_complete(page, done)

    def _setupTitlePage(self):
        title = self.xml.get_widget("title_page")
        title.unparent()
        title.set_data("name", "title")
        self._setupPage(title, _("Add/Remove Packages"),
                        gtk.ASSISTANT_PAGE_INTRO, True)

    def _setupSummaryPage(self):
        page = self.xml.get_widget("summary_page")
        page.unparent()
        page.set_data("name", "summary")
        self._setupPage(page, _("Add/Remove Packages"),
                        gtk.ASSISTANT_PAGE_SUMMARY, True)

    def _setupConfirmPage(self):
        page = self.xml.get_widget("confirm_page")
        page.unparent()
        page.set_data("name", "confirm")
        page.set_data("pkglist", self.xml.get_widget("toinstallBuffer"))
        self._setupPage(page, _("Installation Overview"),
                        gtk.ASSISTANT_PAGE_CONTENT, True)

    def _setupInstallPage(self):
        # XXX: should we embed the progress bars in the assistant?
        page = gtk.VBox()
        page.show()
        page.set_data("pbar", 1)
        page.set_data("name", "install")
        self._setupPage(page, _("Installing software"),
                        gtk.ASSISTANT_PAGE_PROGRESS, False)

    def _setupGroupViewPage(self):
        grpsel = PirutGroupSelector(self, self.xml.relative_file)
        page = grpsel.vbox
        page.set_data("name", "grpsel")
        page.set_data("grpsel", grpsel)
        self._setupPage(grpsel.vbox, _("Add/Remove Packages"),
                        gtk.ASSISTANT_PAGE_CONTENT, True)
        
    def _connectSignals(self):
        self.mainwin.connect("close", self.quit)
        self.mainwin.connect("cancel", self.quit)
        self.mainwin.connect("prepare", self._prepare)
        self.mainwin.connect("delete_event", self.quit)

        sigs = {}
        self.xml.signal_autoconnect(sigs)

    def _busyCursor(self):
        self.mainwin.window.set_cursor(gdk.Cursor(gdk.WATCH))
        self.mainwin.set_sensitive(False)
        _runGtkMain()

    def _normalCursor(self):
        self.mainwin.window.set_cursor(None)
        self.mainwin.set_sensitive(True)        
        _runGtkMain()        

    def doRefresh(self, thisrepo = None):
        if self._setupRepo and thisrepo:
            return
        if self._setupAllRepos:
            return
        if not thisrepo:
            # re-enable all the repos
            map(lambda x: x.enable(), self.enabled_repos)
            if hasattr(self, 'pkgSack'): # this is kind of a hack...
                delattr(self, 'pkgSack')
                self.pkgSack = None
            self._setupAllRepos = True
        
        self.doRefreshRepos(thisrepo)
        self._setupRepo = True

    def _prepare(self, asst, page):
        grpsel = page.get_data("grpsel")
        if grpsel is not None:
            self.doRefresh(thisrepo = self.cdreponame)
            grpsel.doRefresh()
            return

        pkglist = page.get_data("pkglist")
        if pkglist is not None:
            self._confirm(pkglist, page)
            return

        inst = page.get_data("pbar")
        if inst is not None:
            self._apply(asst, page)
            return

    # XXX: largely lifted from pirut.py:_apply
    def _confirm(self, pkglist, page):
        if len(self.tsInfo) == 0:
            d = gtk.MessageDialog(self.mainwin, gtk.DIALOG_MODAL,
                                  gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
                                  _("No software selected for installation "
                                    "or removal."))
            d.run()
            d.destroy()
            # FIXME: gtkassistant sucks for going backwards :(
            self.quit()
#            self._back()
            return

        self.tsInfo.makelists()
        d = PirutDetailsDialog(self.mainwin, gtk.MESSAGE_QUESTION,
                               [('gtk-cancel', gtk.RESPONSE_CANCEL),
                                (_("Continue"), gtk.RESPONSE_OK, 'gtk-ok')],
                               _("Package selections"),
                               _("You have selected the following software "
                                 "installations and removals."))

        b = gtk.TextBuffer()
        tag = b.create_tag('bold')
        tag.set_property('weight', pango.WEIGHT_BOLD)
        tag = b.create_tag('indented')
        tag.set_property('left-margin', 10)
        types=[(self.tsInfo.installed,_("Installing:")),
               (self.tsInfo.updated, _("Updating:")),
               (self.tsInfo.removed, _("Removing:"))]
        for (lst, strng) in types:
            if len(lst) > 0:
                i = b.get_end_iter()
                b.insert_with_tags_by_name(i, "%s\n" %(strng,), "bold")
                for txmbr in lst:
                    i = b.get_end_iter()
                    (n,a,e,v,r) = txmbr.pkgtup
                    b.insert_with_tags_by_name(i, "%s-%s-%s\n" % (n,v,r),
                                               "indented")
        pkglist.set_buffer(b)


    def _apply(self, asst, page):
        _runGtkMain()
        # do a depsolve to see if we need to grab any other stuff... this is
        # kind of a hack knowing what resolveDeps does
        self.populateTs(test=1)
        deps = self.ts.check()
        if deps:
            self.doRefresh()
            
        try:
            self.applyChanges(self.mainwin)
        except PirutError:
            # FIXME: gtkassistant sucks for going backwards
            self.quit()
#            self._back()
        else:
            self._forward()


    def _forward(self):
        c = self.mainwin.get_current_page()
        if c == self.mainwin.get_n_pages():
            print "On the last page!"
            return
        self.mainwin.set_current_page(c + 1)

    # we don't ever actually use this because it really breaks the crap
    # out of gtkassistant.  *sigh*  FIXME
    def _back(self):
        c = self.mainwin.get_current_page()
        if c == 1:
            print "On the first page!"
            return
        self.mainwin.set_current_page(c - 1)

    def quit(self, *args, **kwargs):
        # we want to cleanup after ourself here but only for the cd repo
        map(lambda x: x.disable(), self.enabled_repos)
        self.cleanHeaders()
        self.cleanPackages()
        self.cleanMetadata()
        self.cleanSqlite()
        self.plugins.run('clean')
        # try to fully cleanup
        try:
            for d in ("/headers", "/packages", ""):
                os.rmdir("%s/%s%s" %(self.conf.cachedir, self.cdreponame, d))
        except OSError:
            pass
        
        GraphicalYumBase.quit(self, args, kwargs)

    def run(self):
        _runGtkMain()
        self.mainwin.show()
        gtk.main()
    

def main():
    textdomain(I18N_DOMAIN)

    gtk.glade.bindtextdomain(I18N_DOMAIN, "/usr/share/locale")

    parser = OptionParser()
    parser.add_option("-c", "--config", type="string",
                      dest="config", default="/etc/yum.conf",
                      help="Config file to use (default: /etc/yum.conf)")
    parser.add_option("-r", "--repo", type="string",
                      dest="repo",
                      help="Path to repository that we want to install things from")
    (options,args) = parser.parse_args()

    if not options.repo and len(args) > 0:
        options.repo = args[0]

    if not options.repo:
        d = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
                              gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
                              _("No repository given to install from."))
        d.run()
        d.destroy()
        sys.exit(1)

    try:
        cd = CDInstaller(options.config, options.repo)
    except PirutError, e:
        startupError(e)
    cd.run()

if __name__ == "__main__":
    installExceptionHandler("pirut", "")
    main()

:: 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.0048 ]--