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


Viewing file:     language_gui.py (10.42 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/python

## language_gui.py - Contains the UI code needed for system-config-language
## Copyright (C) 2002, 2003 Red Hat, Inc.
## Copyright (C) 2002, 2003 Brent Fox <bfox@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; either version 2 of the License, or
## (at your option) any later version.

## 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 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., 675 Mass Ave, Cambridge, MA 02139, USA.

import string
import gtk
import gobject
import sys, os
sys.path.append('/usr/share/system-config-language/')
import language_backend

##
## I18N
## 
from rhpl.translate import _, N_
import rhpl.translate as translate
translate.textdomain ("system-config-language")

##
## Icon for windows
##

iconPixbuf = None      
try:
    iconPixbuf = gtk.gdk.pixbuf_new_from_file("/usr/share/system-config-language/pixmaps/system-config-language.png")
except:
    pass

class childWindow:
    #You must specify a runPriority for the order in which you wish your module to run
    runPriority = 0
    moduleName = _("Language")
    moduleClass = "reconfig"
    nameTag = _("Language Selection")
    commentTag = _("Change the default system language")

    def destroy(self, args):
        gtk.main_quit()
    
    def __init__(self):
        self.doDebug = None
        self.firstboot = None
        self.languageBackend = language_backend.LanguageBackend()
        self.toplevel = gtk.VBox()
        self.iconBox = gtk.HBox()
        self.langStore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                       gobject.TYPE_STRING, gobject.TYPE_STRING)
        self.title = gtk.Label(_("Language Selection"))
        self.title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse ("white"))

        self.msgLabel = gtk.Label(_("Please select the default language for the system."))
        self.msgLabel.set_line_wrap(True)
        self.msgLabel.set_alignment(0.0, 0.5)

        defaultLang, self.installedLangs = self.languageBackend.getInstalledLangs()
        self.originalLang = defaultLang
        self.fillStore()

        self.langView = gtk.TreeView(self.langStore)
        self.langViewSW = gtk.ScrolledWindow()
        self.langViewSW.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.langViewSW.set_shadow_type(gtk.SHADOW_IN)
        self.langViewSW.add(self.langView)
        self.col = gtk.TreeViewColumn(None, gtk.CellRendererText(), text=3)        
        self.langView.append_column(self.col)
        self.langView.set_property("headers-visible", False)

        self.langChangedFlag = 0
        self.setDefault(defaultLang)

        self.langView.get_selection().connect("changed", self.langChanged)

        #Add icon to the top frame
        p = None
        try:
            p = gtk.gdk.pixbuf_new_from_file("../pixmaps/system-config-language.png")
        except:
            try:
                p = gtk.gdk.pixbuf_new_from_file("/usr/share/system-config-language/pixmaps/system-config-language.png")
            except:
                pass

        if p:
            self.icon = gtk.Image()
            self.icon.set_from_pixbuf(p)

    def listScroll(self, widget, *args):
        # recenter the list
        rc = self.langView.get_selection().get_selected()
        if rc is None:
            return
        model, iter = rc
        
        path = self.langStore.get_path(iter)
        col = self.langView.get_column(0)
        self.langView.scroll_to_cell(path, col, True, 0.5, 0.5)

    def setDefault(self, defaultLang):
        iter = self.langStore.get_iter_first()
        while iter:
            langBase = self.languageBackend.removeEncoding(self.langStore.get_value(iter, 0))
            if langBase == defaultLang:
                path = self.langStore.get_path(iter)
                self.langView.set_cursor(path, self.col, False)
                self.langView.scroll_to_cell(path, self.col, True, 0.5, 0.5)
                break
            iter = self.langStore.iter_next(iter)

    def fillStore(self):
        lines = self.languageBackend.readTable()

        #If /etc/sysconfig/i18n file is empty for some reason, assume English is the only lang
        if self.originalLang == None:
            iter = self.langStore.append()
            self.langStore.set_value(iter, 0, 'en_US.UTF-8')
            self.langStore.set_value(iter, 1, 'iso01')
            self.langStore.set_value(iter, 2, 'lat0-sun16')
            self.langStore.set_value(iter, 3, 'English (USA)')
            self.installedLangs = ['en_US.UTF-8:en']
            return

        for line in lines:
            tokens = string.split(line)
            if self.installedLangs == None:
                iter = self.langStore.append()
                self.langStore.set_value(iter, 0, tokens[0])
                self.langStore.set_value(iter, 1, tokens[1])
                self.langStore.set_value(iter, 2, tokens[2])
                name = ""
                for token in tokens[3:]:
                    name = name + " " + token
                self.langStore.set_value(iter, 3, name)            

            else:
                if '.' in tokens[0]:
                    #Chop encoding off so we can compare to self.installedLangs
                    langBase = self.languageBackend.removeEncoding(tokens[0])

                    if langBase in self.installedLangs:
                        iter = self.langStore.append()
                        self.langStore.set_value(iter, 0, tokens[0])
                        self.langStore.set_value(iter, 1, tokens[1])
                        self.langStore.set_value(iter, 2, tokens[2])
                        name = ""
                        for token in tokens[3:]:
                            name = name + " " + token
                        self.langStore.set_value(iter, 3, name)
   
    def langChanged(self, *args):
        self.langChangedFlag = 1

    def okClicked(self, *args):
        self.apply()
        gtk.main_quit()

    def apply(self, *args):
        if self.doDebug:
            return 0

        if not self.langChangedFlag:
            #If the user didn't actually change the lang when in the app, then just return 1
            return 0

        #Get the lang from the list of languages
        rc = self.langView.get_selection().get_selected()
        if rc:
            model, iter = rc
            defaultLang =  self.langStore.get_value(iter, 0)
            sysfontacm = self.langStore.get_value(iter, 1)
            sysfont = self.langStore.get_value(iter, 2)
            fullName = self.langStore.get_value(iter, 3)

        if self.installedLangs == None:
            self.languageBackend.writeI18N(defaultLang, "", sysfont, sysfontacm)

        else:
            modules = self.installedLangs[0]
            for lang in self.installedLangs[1:]:
                modules = modules + ":" + lang

            self.languageBackend.writeI18N(defaultLang, modules, sysfont, sysfontacm)

        #If the language selection has changed, then apply the changes
        if self.firstboot:
            #If running in firstboot mode, allow firstboot to change the current locale
            self.firstboot.changeLocale(defaultLang, fullName)
        else:
            #Else, we're not in firstboot mode, so show the dialog
            dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
                                    _("The changes will take effect the next time you log in."))
            dlg.set_position (gtk.WIN_POS_CENTER)
            dlg.set_icon(iconPixbuf)
            dlg.set_border_width(2)
            dlg.set_modal(True)
            rc = dlg.run()
            dlg.destroy()
            
        # send message to login manager to re-read config / pick up lang change
        if os.access("/var/gdm/.gdmfifo", os.F_OK):
            try:
                fd = os.open("/tmp/.gdm_socket",
                             os.O_WRONLY | os.O_APPEND | os.O_NONBLOCK)
                if fd >= 0:
                    os.write(fd, "\nUPDATE_CONFIG\n")
                    os.close(fd)
            except:
                pass

        return 0

    def setKickstartData(self, kickstartData):
        #Get the lang from the list of languages
        rc = self.langView.get_selection().get_selected()
        if rc:
            model, iter = rc
            defaultLang =  self.langStore.get_value(iter, 0)

        try:
            prefix, suffix = string.split(defaultLang, ".")
            defaultLang = prefix
        except:
            pass

        kickstartData.setDefaultLang(defaultLang)
        return 0

    def setKickstartDefaults(self, kickstartData):
        pass

    def passInParent(self, parent):
        self.firstboot = parent

    def launch(self, doDebug = None):
        self.doDebug = doDebug

        self.mainVBox = gtk.VBox()
        self.internalVBox = gtk.VBox(False, 10)
        self.internalVBox.set_border_width(10)

        self.msgLabel.set_size_request(500, -1)
        self.internalVBox.pack_start(self.msgLabel, False)
        self.internalVBox.pack_start(self.langViewSW)
        self.mainVBox.pack_start(self.internalVBox, True)
        return self.mainVBox, self.icon, self.moduleName

    def stand_alone(self):
        self.mainWindow = gtk.Window()
        self.mainWindow.connect("destroy", self.destroy)
        self.mainWindow.set_title(_("Language Selection"))
        self.mainWindow.set_icon(iconPixbuf)
        self.mainWindow.set_size_request(400, 350)
        self.mainWindow.set_border_width(10)

        self.bb = gtk.HButtonBox()
        self.bb.set_layout(gtk.BUTTONBOX_END)
        self.bb.set_spacing(10)
        self.okButton = gtk.Button(stock='gtk-ok')
        self.okButton.connect("clicked", self.okClicked)
        self.bb.pack_start(self.okButton)

        self.toplevel.set_spacing(5)
        self.iconBox.pack_start(self.icon, False)
        self.iconBox.pack_start(self.msgLabel)
        self.toplevel.pack_start(self.iconBox, False)
        self.toplevel.pack_start(self.langViewSW)
        self.toplevel.pack_start(gtk.HSeparator(), False)
        self.toplevel.pack_start(self.bb, False)
        self.mainWindow.add(self.toplevel)
        self.mainWindow.show_all()
        gtk.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.0097 ]--