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


Viewing file:     urlmethod.py (5.75 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# urlmethod.py - method code support getting packages from remote URLs
#
# Copyright 2003 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# General Public License.
#
# 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 os,sys,string,stat
import rpm
from method import InstallMethod
from constants import *
import urllib2
import GroupSet
import install
import time
import tempfile

from rhpl.log import log
from rhpl.translate import _, N_
from rhpl.GenericError import *
import rhpl.discid


def isValidUrl(path):
    try:
        f = urllib2.urlopen(path)
        buf = f.read(1)
        f.close()
    except urllib2.HTTPError:
        return None
    
    if len(buf) > 0:
        return 1
    else:
        return 0


class UrlInstallMethod(InstallMethod):
    """Install method for installing packages from a remote URL.

    This can be used to get packages from a remote FTP/HTTP location."""

    def __init__(self, url):
        InstallMethod.__init__(self)
        self.url = url
        self.firsturl = url
        self.multidisc = 0

        discid = rhpl.discid.discid()

        found = 0
        for dir in ["", "/disc1"]:
            try:
                f = urllib2.urlopen(self.url + dir + "/.discinfo")
                buf = f.read()
                f.close()
            except urllib2.HTTPError:
                continue

            try:
                discid.readFromBuffer(buf)
            except rhpl.discid.DiscidException:
                continue

            # we found it, be happy
            found = 1
            break

        if not found:
            GenericError(TYPE_ERROR,
                         _("Installation Tree Not Found."),
                         _("The path %s does not look like a valid installation source.") % self.url).display()
            sys.exit(0)

        if dir == "/disc1":
            self.multidisc = 1
            self.firsturl = self.url + "/disc1"

        self.releaseName = discid.release_name
        self.discidPixmapPath = "%s/%s" % (self.firsturl, discid.pixmap_path)
        self.pixmapPath = [ "%s/%s" % (self.firsturl, discid.pixmap_path),
                            "/usr/share/pixmaps/comps",
                            "/usr/share/pixmaps" ]
        self.baseDir = discid.comps_path
        self.packagesDir = discid.rpms_path

    def getPixmapFile(self, file, discid_only=0):
        if discid_only:
            file = self.discidPixmapPath + "/" + file
            if isValidUrl(file):
                return file
            else:
                return None

        for parent_path in self.getPixmapPath():
            test_file = parent_path + "/" + file
            if isValidUrl(test_file):
                return test_file

        return None

    def readCompsViaMethod(self, hdlist, update_method=None):
        return GroupSet.groupSetFromCompsFile("%s/%s/comps.xml"
                                              % (self.firsturl, self.baseDir),
                                              hdlist, doSelect = 0,
                                              update_method = update_method)

    def readHeaders(self, update_method=None):
        fn = "%s/%s/hdlist" %(self.firsturl, self.baseDir)
        try:
            hdlist = urllib2.urlopen(fn)
        except urllib2.HTTPError:
            GenericError(TYPE_ERROR,
                         _("Header List Not Found."),
                         _("The path %s does not appear to contain a header "
                           "list which is required to function.")
                         % self.firsturl).display()
            sys.exit(0)

        fn = "%s/%s/hdlist2" %(self.firsturl, self.baseDir)
        if isValidUrl(fn):
            try:
                hdlist2 = urllib2.urlopen(fn)
            except urllib2.HTTPError:
                hdlist2 = None
       else:
            hdlist2 = None
                
        return GroupSet.HeaderListFromFds(hdlist.fileno(), hdlist2.fileno(),
                                          self, update_method)

    def getFilename(self, h, pkgTimer, installed = 0):
        if h[RCPFILELOCATIONTAG] is not None:
            return h[RCPFILELOCATIONTAG]

        # FIXME: there is no mkstemp in python :(
        fn = tempfile.mktemp()

        if (1000005 not in h.hdr.keys()) or (h[1000005] is None):
            path = self.packagesDir
        else:
            path = "%s/../Updates" %(self.packagesDir,)

        if self.multidisc:
            urlpath = "%s/disc%d/%s/%s" %(self.url, h[1000002],
                                          path, h[1000000])
        else:
            urlpath = "%s/%s/%s" %(self.url, path, h[1000000])

        tries = 0
        while tries < 5:
            try:
                url = urllib2.urlopen(urlpath)
                f = open(fn, 'w+')
                f.write(url.read())
                f.close()
                url.close()
            except urllib2.HTTPError, e:
                log("HTTPError %s occurred getting %s: %s" %(e.code, urlpath,
                                                             e.msg))
                time.sleep(5)
                break
            except IOError, (errnum, msg):
        log("IOError %s occurred getting %s: %s"
                    %(errnum, urlpath, str(msg)))
                time.sleep(5)
                break
            else:
                if os.stat(fn)[stat.ST_SIZE] != 0:
                    break
            tries = tries + 1

        if tries >= 5:
            print "more than five tries"
            raise install.InstallErrorException, "Unable to retrieve %s" %(urlpath,)

        return fn

    def unlinkFilename(self, fn):
        os.unlink(fn)

    def filesDone(self):
        pass
        
        

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