403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/yum/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/yum/misc.pyo
7Jc @sdZddkZddkZddkZddklZddkZddkZddkZddk	Z	ddk
Z
ddkZddkZddk
Z
ddkZddkZddkZddkTyddkZddkZWnej
o
dZnXy1ddkZeddddgZdgZWnYej
oMddkZddkZeddgZdgZd	d9d
YZnXddk
lZddklZlZha ha!d
Z"dZ#da$dZ%da&dZ'dZ(dZ)da*dZ+dZ,dd:dYZ-dd;dYZ.d<ddZ/dZ0dd=dYZ1dZ2e3d Z4d!Z5d"Z6ddd#Z7d$Z8dd%Z9d&e:d'Z;d(Z<d)Z=d*Z>d+Z?d,Z@d-ZAd.ZBd/d0ZCd/d1ZDd2ZEd3ZFe3d4ZGd5ZHd6ZIddkJZJddkKZKe:e3d7ZLd8ZMdS(>s%
Assorted utility functions for yum.
iN(tStringIO(t*tmd5tsha1tsha256tsha512thashlibcBseZedZRS(cCs=|djotiS|djotiStddS(NRRsBad checksum type(Rtnewtshat
ValueError(talgo((s,/usr/lib/python2.6/site-packages/yum/misc.pyR&s


(t__name__t
__module__tstaticmethodR(((s,/usr/lib/python2.6/site-packages/yum/misc.pyR$s(t	MiscError(tto_utf8t
to_unicodecCsKt}t|to
t}nt|tijo|S|i||S(s Take a value and use the same value from the store,
        if the value isn't in the store this one becomes the shared version. (t_share_data_storet
isinstancetunicodet_share_data_store_uttypettypest	TupleTypet
setdefault(tvaluetstore((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
share_data6s
cCshahadS(N(RR(((s,/usr/lib/python2.6/site-packages/yum/misc.pytunshare_dataFscCs-tdjotidanti|S(s( Tests if a string is a shell wildcard. s.*([*?]|\[.+\])N(t_re_compiled_glob_matchtNonetretcompiletmatch(ts((s,/usr/lib/python2.6/site-packages/yum/misc.pytre_globMs
cCs-tdjotidanti|S(s Tests if a string could be a filename. We still get negated character
        classes wrong (are they supported), and ranges in character classes. s^(/|[*?]|\[[^]]*/[^]]*\])N(t_re_compiled_filename_matchRRR R!(R"((s,/usr/lib/python2.6/site-packages/yum/misc.pytre_filenameUs
cCs=d|jotS|idotS|djotStS(s Tests if a filename string, can be matched against just primary.
        Note that this can produce false negatives (but not false
        positives). sbin/s/etc/s/usr/lib/sendmail(tTruet
startswithtFalse(tfilename((s,/usr/lib/python2.6/site-packages/yum/misc.pytre_primary_filename]s

cCs+d|jotS|idotStS(sA Tests if a dirname string, can be matched against just primary. sbin/s/etc/(R&R'R((tdirname((s,/usr/lib/python2.6/site-packages/yum/misc.pytre_primary_dirnameis

cCsetdjo.tid}tid}||fanx#tD]}|i|otSqBWtS(sC Tests if a string needs a full nevra match, instead of just name. s.*[-\.\*\?\[\]].*.$s^[0-9]N(t_re_compiled_full_matchRRR R!R&R((R"tonettwotrec((s,/usr/lib/python2.6/site-packages/yum/misc.pytre_full_search_neededrs
	c
Cs&t|}|djogSyt|}Wntj
onXt|Syt|}|iWntj
o
~nnX|d}d}}xM||jo?|||jo ||||<}|d7}n|d7}qW|| Sg}x,|D]$}||jo|i|qqW|S(sReturn a list of the elements in s, but without duplicates.

    For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
    unique("abcabc") some permutation of ["a", "b", "c"], and
    unique(([1, 2], [2, 3], [1, 2])) some permutation of
    [[2, 3], [1, 2]].

    For best speed, all sequence elements should be hashable.  Then
    unique() will usually work in linear time.

    If not possible, the sequence elements should enjoy a total
    ordering, and if list(s).sort() doesn't raise TypeError it's
    assumed that they do enjoy a total ordering.  Then unique() will
    usually work in O(N*log2(N)) time.

    If that's not possible either, the sequence elements must support
    equality-testing.  Then unique() will usually work in quadratic
    time.
    ii(tlentsett	TypeErrortlisttsorttappend(R"tntutttlasttlastititx((s,/usr/lib/python2.6/site-packages/yum/misc.pytuniques8

	



t	ChecksumscBseeZdZdedZdZdZddZdZ	ddZ
d	Zdd
ZRS(
sn Generate checksum(s), on given pieces of data. Producing the
        Length and the result(s) when complete. cCs|djo
t}ng|_g|_d|_t}x|D]}|djo
d}n||joqBn|tjoti|}n|oqBnt	d||i
||ii||ii|qBW|p
t	dndS(NiRRs(Error Checksumming, bad checksum type %ss*Error Checksumming, no valid checksum type(Rt_default_checksumst	_sumalgost	_sumtypest_lenR3t_available_checksumsRRRtaddR7(tselft	checksumstignore_missingtdonetsumtypetsumalgo((s,/usr/lib/python2.6/site-packages/yum/misc.pyt__init__s,

				





cCs|iS(N(RD(RG((s,/usr/lib/python2.6/site-packages/yum/misc.pyt__len__scCs:|it|7_x|iD]}|i|qWdS(N(RDR2RBtupdate(RGtdataRL((s,/usr/lib/python2.6/site-packages/yum/misc.pyROs
iicCs |i|}|i||S(N(treadRO(RGtfotsizeRP((s,/usr/lib/python2.6/site-packages/yum/misc.pyRQs
cCs@h}x3t|i|iD]\}}|i||<qW|S(N(tzipRCRBt	hexdigest(RGtretRKtsumdata((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
hexdigestss
cCsC|djo|id}n|djo
d}n|i|S(NiRR(RRCRX(RGtchecksum((s,/usr/lib/python2.6/site-packages/yum/misc.pyRUs



cCs@h}x3t|i|iD]\}}|i||<qW|S(N(RTRCRBtdigest(RGRVRKRW((s,/usr/lib/python2.6/site-packages/yum/misc.pytdigestss
cCsC|djo|id}n|djo
d}n|i|S(NiRR(RRCR[(RGRY((s,/usr/lib/python2.6/site-packages/yum/misc.pyRZs



Ni(
RRt__doc__RR(RMRNRORQRXRUR[RZ(((s,/usr/lib/python2.6/site-packages/yum/misc.pyR@s				tAutoFileChecksumscBs/eZdZedZdZddZRS(sk Generate checksum(s), on given file/fileobject. Pretending to be a file
        object (overrrides read). cCs||_t|||_dS(N(t_foR@RH(RGRRRHRI((s,/usr/lib/python2.6/site-packages/yum/misc.pyRMs	cCst|i|S(N(tgetattrR^(RGtattr((s,/usr/lib/python2.6/site-packages/yum/misc.pyt__getattr__sicCs|ii|i|S(N(RHRQR^(RGRS((s,/usr/lib/python2.6/site-packages/yum/misc.pyRQs(RRR\R(RMRaRQ(((s,/usr/lib/python2.6/site-packages/yum/misc.pyR]
s	iicCs yt|tijo
|}nt|d|}t|g}x=|i||o)|dj	ot||joPqGqGWt|tijo|i	~n|dj	o+|t|jod||i
|fS|i
|SWn(ttfj
o}t
d|nXdS(stakes filename, hand back Checksum of it
       sumtype = md5 or sha/sha1/sha256/sha512 (note sha == sha1)
       filename = /path/to/file
       CHUNK=65536 by defaulttrs!%u!%ss#Error opening file for checksum: %sN(RRtStringTypestopenR@RQRR2t
StringTypetcloseRUtIOErrortOSErrorR(RKtfiletCHUNKtdatasizeRRRPte((s,/usr/lib/python2.6/site-packages/yum/misc.pyRYs"
 

 cCst|}yti|}Wn(tj
o}td||fnXx|D]}tii|d|ot|d|||}qQ||id|jo+tii	|d|}|i
|qQqQW|S(sfReturn all files in path matching ext, store them in filelist, 
       recurse dirs return list objects Error accessing directory %s, %st/s%s(R2tostlistdirRhRtpathtisdirtgetFileListtlowertnormpathR7(Rptexttfilelisttextlentdir_listRltdtnewpath((s,/usr/lib/python2.6/site-packages/yum/misc.pyRr8st
GenericHoldercBs,eZdZddZdZdZRS(sGeneric Holder class used to hold other objects of known types
       It exists purely to be able to do object.somestuff, object.someotherstuff
       or object[key] and pass object to another function that will 
       understand itcCs
||_dS(N(t_GenericHolder__iter(RGtiter((s,/usr/lib/python2.6/site-packages/yum/misc.pyRMRscCs&|idj	ot||iSdS(N(R|RR}(RG((s,/usr/lib/python2.6/site-packages/yum/misc.pyt__iter__UscCs+t||ot||St|dS(N(thasattrR_tKeyError(RGtitem((s,/usr/lib/python2.6/site-packages/yum/misc.pyt__getitem__YsN(RRR\RRMR~R(((s,/usr/lib/python2.6/site-packages/yum/misc.pyR{Ls	cCstidid|}t}d}d}x|idD]}|ido
d}q@|o|idjo
d}q@|o|idoPq@|o|idoPq@|o|i|dq@q@Wti	|i
S(	s-Convert ASCII armoured GPG key to binary
    s(
|
|
)s
is$-----BEGIN PGP PUBLIC KEY BLOCK-----its"-----END PGP PUBLIC KEY BLOCK-----t=(RR tsubRtsplitR'tstriptwritetbase64tdecodestringtgetvalue(trawkeytblocktinblocktpastheaderstline((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
procgpgkey_s"	

c
Csg}yti|}Wn'tj
o}tt|nXt|djotdnx
|D]}|ii}h|id6t	i
d|dd6|iid6|iid6|i
d6}x|idD]}t|tipqn|i|joPt|d	o<|iti}	|	djot|	d
|d<PqZq^qqW|i|qmW|o|S|dSdS(sReturn a dict of info for the given ASCII armoured key text

    Returned dict will have the following keys: 'userid', 'keyid', 'timestamp'

    Will raise ValueError if there was a problem decoding the key.
    isNo key found in given key datatuserids>Qtkeyidt	timestamptfingerprinttraw_keythashed_subpaksiN(tpgpmsgtdecode_multiple_keyst	ExceptionR	tstrR2t
public_keytkey_idtuser_idtstructtunpackRRRtuser_idsRt	signatureRtget_hashed_subpaktSIG_SUB_TYPE_CREATE_TIMERtintR7(
Rtmultiplet
key_info_objstkeysRltkeyt
keyid_blobtinfoRttspkt((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
getgpgkeyinfo|s<




cCsd|d@S(s[Convert an integer representing a GPG key ID to the hex version string
    used by RPM
    s%08xl((R((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
keyIdToRPMVerscCs}t|}xj|iddD]V}|d|jo?t|dd}||jodS||jodSdSqqWd	S(
sd
    Return if the GPG key described by the given keyid and timestamp are
    installed in the rpmdb.  

    The keyid and timestamp should both be passed as integers.
    The ts is an rpm transaction set object

    Return values:
        - -1      key is not installed
        - 0       key with matching ID and timestamp is installed
        - 1       key with matching ID is installed but has a older timestamp
        - 2       key with matching ID is installed but has a newer timestamp

    No effort is made to handle duplicates. The first matching keyid is used to 
    calculate the return result.
    tnames
gpg-pubkeytversiontreleaseiiiii(RtdbMatchR(ttsRRthdrtinstalledts((s,/usr/lib/python2.6/site-packages/yum/misc.pytkeyInstalleds

cCstdjotS|pd|}ntii|pti|nt|}|tid<ti	}t
tii|dd}|id|i
|i||i
|i|}tii||titS(Ns	%s/gpgdirt	GNUPGHOMEsgpg.conftwbR(tgpgmeRR(RnRptexiststmakedirsRtenvirontContextRdtjoinRRftimport_tget_keyteditutilt
edit_trusttVALIDITY_ULTIMATER&(RRtcachedirtgpgdirtkey_fotctxtfptk((s,/usr/lib/python2.6/site-packages/yum/misc.pytimport_key_to_pubrings"





cCstdjptii|ogS|tid<ti}g}xF|iD]8}x/|iD]$}|i	o|i
|iqbqbWqRW|S(NR(RRRnRpRRRtkeylisttsubkeystcan_signR7R(RRtkeyidsRtsubkey((s,/usr/lib/python2.6/site-packages/yum/misc.pytreturn_keyids_from_pubrings!



c
CstdjotS|o$tii|o|tid<nt|d}t|d}d}ti}y|i	|||}Wnti
j
o
}tSX|d}	|	ptS|	ititi
tifjotStS(sAtakes signature , file that was signed and an optional gpghomedirRRbiN(RRR(RnRpRRRdRtverifyt
GpgmeErrortvalidityt
VALIDITY_FULLtVALIDITY_MARGINALRR&(
tsig_filetsigned_filetgpghometsigtsigned_textt	plaintextRtsigsRltthissig((s,/usr/lib/python2.6/site-packages/yum/misc.pytvalid_detached_sigs&

s/var/tmpc
Csti}yti|}|d}Wntj
od	SXd}|od|}d||f}tti|}x_|D]S}ti|}	t	|	do-t
|	ddjo|	d|jo|SqWntid|d|}
|
S(
sqreturn a path to a valid and safe cachedir - only used when not running
       as root or when --tempcache is setisyum-syum-%s-s%s/%s*iitprefixtdirN(
RntgeteuidtpwdtgetpwuidRRtsortedtglobtlstattS_ISDIRtS_IMODEttempfiletmkdtemp(ttmpdirtreusetuidtusertuptusernameRtdirpatht	cachedirstthisdirtstatsR((s,/usr/lib/python2.6/site-packages/yum/misc.pytgetCacheDirs$
9
cCs8|i|ijodS|i|ijodSdSdS(s+sorts a list of yum package objects by nameiiiN(R(tpkg1tpkg2((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
sortPkgObj4s
cCsr|ig}|d}xR|D]J}|i|o|g}|}q |i|o|i|q q W|S(s, Return the newest in the list of packages. i(tpoptverGTtverEQR7(tpkgsRVtnewesttpkg((s,/usr/lib/python2.6/site-packages/yum/misc.pytnewestInList=s
	
cCsv|\}}}d}|djo|d|7}n|dj	o|d|7}n|dj	o|d|7}n|S(	s
    Convert a tuple representing a package version to a string.

    @param evrTuple: A 3-tuple of epoch, version, and release.

    Return the string representation of evrTuple.
    Rit0s%s:s%ss-%sN(iRN(R(tevrTupleRltvRbR"((s,/usr/lib/python2.6/site-packages/yum/misc.pytversion_tuple_to_stringIs


cCse|\}}}hdd6dd6dd6dd6d	d
6}|djo|Sd|||t|fS(
s7returns a text string of the prco from the tuple formatt>tGTs>=tGERtEQt<tLTs<=tLEs%s %s %sN(RR(t	prcoTupleRtflagtevrtflags((s,/usr/lib/python2.6/site-packages/yum/misc.pytprco_tuple_to_string\s
)
cCs9tid|oti|}nti|}|S(smTakes a search string from the cli for Search or Provides
       and cleans it up so it doesn't make us vomits.*[\*,\[,\],\{,\},\?,\+].*(RR!tfnmatcht	translatetescape(targtrestring((s,/usr/lib/python2.6/site-packages/yum/misc.pytrefineSearchPatternfsc	Csti|d}t|d}xtoy|id}Wntj
oPnX|pPny|i|Wq$ttfj
o+}d|t|f}t	i
|q$Xq$W|i|idS(s1 Extract the bzipped contents of source to dest. RbtwisError writing to file %s: %sN(tbz2tBZ2FileRdR&RQRgRRhRtErrorsRRf(tsourcetdestts_fntdestinationRPRltmsg((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
bunzipFileqs"
cCsptid}ttid|}x@|D]8}|id|}x|D]}|d|dfSWq0WdS(sgThis takes the output of uname and figures out the (version, release)
    tuple for the running kernel.is/boot/vmlinuz*%s*t	basenamesRRN(NN(RntunameRRRR(Rtvertfnstfntmith((s,/usr/lib/python2.6/site-packages/yum/misc.pyt"get_running_kernel_version_releasess/var/lib/yumc	Csg}d|df}d|df}ti|}ti|}x?|D]7}tii|}|idd}|i|qKW|i|S(sreturns a list of the timestamps from the filenames of the unfinished 
       transactions remaining in the yumlibpath specified.
    s%s/%sstransaction-all*stransaction-done*stransaction-all.R(RRnRptbasenametreplaceR7R6(	t
yumlibpatht
timestampsttsallgttsdonegttsallsttsdonesR#ttransR((s,/usr/lib/python2.6/site-packages/yum/misc.pytfind_unfinished_transactionss
cCs=g}d|d|f}d|d|f}g}tii|p|Stii|o)t|d}|i}|int|d}|i}|ix/|D]'}	|	|joqn|i|	qWxY|D]Q}	|	idd}	|	djoqn|	i\}
}|i	|
|fqW|S(sthis function takes the timestamp of the transaction to look at and 
       the path to the yum lib dir (defaults to /var/lib/yum)
       returns a list of tuples(action, pkgspec) for the unfinished transaction
       elements. Returns an empty list if none.

    s%s/%s.%sstransaction-allstransaction-doneRbs
R(
RnRpRRdt	readlinesRftremoveR(RR7(RR)tto_complete_itemst	tsallpatht
tsdonepathttsdone_itemst	tsdone_fottsall_fottsall_itemsRtactiontpkgspec((s,/usr/lib/python2.6/site-packages/yum/misc.pytfind_ts_remainings4


cCsg}t|}t|}d}xD||jo6||}|i|||!||7}||8}q'W|i|||S(sE Given a seq, split into a list of lists of length max_entries each. i(R2R5R7(tseqtmax_entriesRVtnumtbegtend((s,/usr/lib/python2.6/site-packages/yum/misc.pyt
seq_max_splits


cCsw|djodSt|to|St}yt|d}t}Wntj
oddddg}x|D]s}yt||}Wntj
oqpX|i||jo.|djod||fGHn|idSqpWnXd}tdd	d
dgtdd
}xX|D]P}t||joq|o!t|djo|d}q||}qW|S(shands back a unicoded stringRtasciisutf-8s
iso-8859-1siso-8859-15s
iso-8859-2s
%s encoding on %s
iiiiii it?N(	RRRR(R&tUnicodeErrortencodetrangetord(RtduR>t	encodingstenctnewitemtbad_small_bytestchar((s,/usr/lib/python2.6/site-packages/yum/misc.pyt_ugly_utf8_string_hacks<


&cCsvddk}t|}t|}|i}|o&|iii|dhdd6}n|iii|}|S(Nitentitiess&quot;t"(txml.sax.saxutilsRORtrstriptsaxtsaxutilsR(Rtattribtxml((s,/usr/lib/python2.6/site-packages/yum/misc.pytto_xmls&cCsGyti|Wn/tj
o#}|itijoqCnXdS(s| Call os.unlink, but don't die if the file isn't there. This is the main
        difference between "rm -f" and plain "rm". N(RntunlinkRhterrnotENOENT(R)Rl((s,/usr/lib/python2.6/site-packages/yum/misc.pytunlink_fs
cCs\ytd}Wntj
odSX|i}yt|SWntj
odSXdS(s Get the audit-uid/login-uid, if available. None is returned if there
        was a problem. Note that no caching is done here. s/proc/self/loginuidN(RdRgRRQRR	(RRRP((s,/usr/lib/python2.6/site-packages/yum/misc.pytgetloginuid$scCsy5titid|otitidnWnEtij
o6}tidIJdtid<titidnX|o=ddk	}|i
titit_dti_
ndS(NRtCs%Failed to set locale, defaulting to CtLC_ALLiR((tlocalet	setlocaleR_tLC_TIMEtErrortsyststderrRnRtcodecst	getwritertgetpreferredencodingtstdoutterrors(toverride_codecst
override_timeRlRf((s,/usr/lib/python2.6/site-packages/yum/misc.pytsetup_locale6s

!cCs<titi}|djo
d}ndi|}|S(NR^t.(NN(R`t	getlocaletLC_MESSAGESRR(tmylang((s,/usr/lib/python2.6/site-packages/yum/misc.pytget_my_lang_codeJs


(((i((NR\RRntos.patht	cStringIORRRRRZRRRRRRRtstatRtgpgme.editutiltImportErrorRRR3RERARRRti18nRRRRRRRR#R$R%R*R,R-R1R?R@R]RYRrR{RR(RRRRRRR&RRRRRRRR&R0R<RBRORXR\R]R`RdRmRr(((s,/usr/lib/python2.6/site-packages/yum/misc.pyt<module>s

	
								BF		0		!						
			*		/			

Youez - 2016 - github.com/yon3zu
LinuXploit