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/sos/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/sos/plugintools.pyo
}hJc@sdZddkTddklZlZddkZddkZddkZddkZddk	Z	ddk
Z
ddkZddkZddk
TddklZdefdYZdd
d	YZdS(s.
This is the base class for sosreport plugins
i(t*(tThreadtactiveCountN(ttimetPluginExceptioncBseZRS((t__name__t
__module__(((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyR&st
PluginBasecBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd(d
ZdZdZd(d(ddZdZdZdZd(eddZdZdZdZdZdZdZd(dZed(dZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*RS()s 
    Base class for plugins
    cCsLt|dtp
g|_ng|_g|_g|_g|_g|_d|_g|_	g|_
||_||_g|_
g|_g|_d|_d|_d|_d|_d|_g|_g|_t|_tid|_xV|iD]K}|i	i|d|i
ih|dd6|dd6|d	d
6qWdS(Nt
optionListtitsositdescitspeeditenabled(tgetattrtFalseRtcopiedFilest
copiedDirstexecutedCommandst
diagnose_msgstalertst
customTexttoptNamestoptParmstpiNametcInfotforbiddenPathst	copyPathstcollectProgstNonetthreadtpidt
eta_weightt
time_startt	time_stoptpackagestfilest	must_exittloggingt	getLoggertsoslogtappend(tselft
pluginnametcommonstopt((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt__init__,s8
																					
cCs|idS(Ntpolicy(R(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyR/OscCs|ii|hjS(s0Is the package $package_name installed?
        (R/t	pkgByName(R*tpackage_name((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytisInstalledRsc
CsKt|io7x4|iD]%}|d|jotii|id|itii}yvt|d}t	i
|||i\}}|i|djo+t|d}|i
||i|SWq?tj
o
tq?tj
o
tq?tj
o*}	|iitid||	fPq?XqqWntS(sEApply a regexp substitution to a file archived by sosreport.
        tsrcpathtdstroottritwsproblem at path %s (%s)(tlenRtostpathtjoinRtlstriptseptopentretsubntreadtclosetwritet
SystemExittKeyboardInterruptt	ExceptionR(tlogR&tVERBOSER(
R*R3tregexptsubsttafiletabspathtfpttmpouttoccurste((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt
doRegexSubXs,
+!



	

 cCs8y)ti|t|ditiSWngSXdS(sG Return a list of all non overlapping matches in the string(s)
        R5N(R>tfindallR=R@t	MULTILINE(R*tregextfname((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytdoRegexFindAllqs)cCswd}x1|iD]&}|i|djo
d}qqW|odStii|p|iid|dStii|otii|odSti	|}tii
|id|itii
}tii|oDttii|tii
|id|itii
}n|}tii|o|iitid|dStiitii|otiitii|ptitii|n|iitid||fti|||iih|d	6|d
6dd6|d
6|i|dStii|oRxJti|D]9}|djp
|djoqR|i|d|qRWdS|iitid|y|i|\}}	Wntj
o*}
|iitid||
fdStj
o"|iitid|dS|iitid|dSX|iih|d	6|d
6dd6|	S(s Copy file or directory to the destination tree. If a directory, then everything
        below it is recursively copied. A list of copied files are saved for use later
        in preparing a report
        iiR	s#file or directory %s does not existNR4s.skipping symlink creation: already exists (%s)screating symlink %s -> %sR3tdstpathtyestsymlinktpointstot.s..t/scopying file %ss%s:  %sserror copying file %s (IOError)s*error copying file %s (SOMETHING HAPPENED)tno(RtcountR8R9texistsR(tdebugtislinktisdirtreadlinkR:RR;R<tisabst
sosRelPathtdirnameRFR&tDEBUGtmakedirstVERBOSE3RXRR)tdoCopyFileOrDirtlistdirt_PluginBase__copyFileRtIOErrortVERBOSE2(R*R3tcopyProhibitedR9tlinkt	dstslnametrpthRJttdstpathRKRO((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyRizsb
+D> ,
 %cCs6tii|itii}tii|id|}tii|tii|}tii|pntii	|pti
|ntii|o#ti|}ti
||qti||n
tdtii|id|itii}t|id|}||fS(sn call cp to copy a file, collect return status and output. Returns the
        destination file name.
        R4s"Error copying file: already existstrptdir(R8R9ReR;R<R:RtbasenameR^RaRgR`RbRXtshutiltcopy2RRd(R*tsrctrel_dirtnew_dirt	new_fnametlinktoRKtrelpath((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt
__copyFiles!!+cCs.x'ti|D]}|ii|qWdS(sNSpecify a path to not copy, even if it's part of a copyPaths[] entry.
        N(tglobRR)(R*t
forbiddenPathtfilespec((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytaddForbiddenPathscCs|i|ifS(s7
        return a list of all options selected
        (RR(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt
getAllOptionsscCsJxCt|i|iD](\}}||jo||d<tSqWtSdS(s( set the named option to value.
        R
N(tzipRRtTrueR(R*t
optionnametvaluetnametparms((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt	setOptions

	cCs
|i|S(s- Deprecated, use getOption() instead
        (t	getOption(R*R((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytisOptionEnabledscCs@x9t|i|iD]"\}}||jo	|dSqWdS(s2 see whether the named option is enabled.
        R
i(RRR(R*RRR((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyRs


cCs|o
t|p|iidtSti|}|id}xS|D]K}|ti|t7}|o|dd|joPn|i	|qOWdS(s/Add a file specification (with limits)
        sinvalid file pathiiN(
R7R(twarningRR~tsortR8tstattST_SIZEtaddCopySpec(R*RTt	sizelimitR$tcursizetflog((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytaddCopySpecLimit
s
cCsW|o
t|p|iidtSx'ti|D]}|ii|q9WdS(sz Add a file specification (can be file, dir,or shell glob) to be
        copied into the sosreport by this module
        sinvalid file pathN(R7R(RRR~RR)(R*tcopyspecR((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyRscCst|\}}}|S(s[ Execute a command independantly of the output gathering part of
        sosreport
        (tsosGetCommandOutput(R*tprogtstatustshouttruntime((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytcallExtProg$si,cCs |ii||||fdS(s6
        Run a program and collect the output
        N(RR)(R*texetsuggest_filenametroot_symlinkttimeout((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytcollectExtOutput,scCsUyFg}t|iD]$}ti||o||qq~SWngSXdS(N(R=t	readlinesR>tmatch(R*RHRTt_[1]tl((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytfileGrep2sFcCsStidd|}tidd|}tidd|iddd	!}|S(
Ns^/(usr/|)(bin|sbin)/R	s[^\w\-\.\/]+t_R[RZs ._-ii@(R>tsubtstrip(R*Rtmangledname((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt
mangleCommand8s%cCs|idd|id|i|}tii|oQd}xHto<d||f}tii|p|}Pn|d7}qEWn|S(sA The internal function to build up a filename based on a command tcmddirR[is%s_%di(RRRR8R9R^R(R*Rtoutfntinctnewfn((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytmakeCommandFilename?s)cCst|d|\}}}|o|i|}n|i|}tiitii|ptitii|n|djp
|djpt|d}	t|o|	i	|dn|	i
|omti}
ti|i
dy2ti|t|i
dd|idWnnXti|
n|t|i
d	d}n'|iitid
|d}d}|iih|d6|d6|i
d
id|d|d|d||S(s] Execute a command and save the output to a file for inclusion in
        the report
        RiiR6s
R4is/.Rscould not run command: %sRtfilet	xmlreporttcmdlinetexitcodetf_stdoutRN(RRR8R9RaRetmkdirR=R7RBRAtgetcwdtchdirRRXRR(RFR&RGRRR)tadd_command(R*RRRRRRRRtoutfdtcurdirtoutfn_strip((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytcollectOutputNowPs4

2)cCs|i|}tiitii|ptitii|nt|d}|i||i|i	i
h|d6|d6|S(s
 A function that allows you to write a random text string to the
        command output location referenced by exe; this is useful if you want
        to conditionally collect information, but still want the output file
        to exist so as not to confuse readers R6RR(RR8R9RaReRR=RBRARR)(R*RttextRR((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytwriteTextToCommandys

cCs|ii|dS(s Add a configuration sanity warning for this plugin. These
        will be displayed on-screen before collection and in the report as well.
        N(RR)(R*talertstring((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytaddDiagnosescCs|ii|dS(sq Add an alert to the collection of alerts for this plugin. These
        will be displayed in the report
        N(RR)(R*R((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytaddAlertscCs|i||_dS(sw Append text to the custom text that is included in the report. This
        is freeform and can include html.
        N(R(R*R((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt
addCustomTextscCs|idtS(s This function has been replaced with copyStuff(threaded = True).  Please change your
        module calls.  Calling setup() now.
        tthreaded(t	copyStuffR(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt	doCollectscCs|io|iiSdS(s2
        if threaded, is thread running ?
        N(RtisAliveR(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt	isRunnings
cCs|ii||iiS(sT
        wait for a thread to complete - only called for threaded execution
        (RR:R(R*R((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytwaitsc	Cs	|oS|idjoCtd|id|iddt|g|_|ii|iS|o|in|io|i	dS|i
iti
d|it|_d|_x|iD]}|i
id|y|i|Wqtj
o.|o|i	n|otStqtj
o.|o|i	n|otStqtj
oE}|i
itid||f|i
ititiqXqWx|iD]\}}}}|i
id	|y|i||||Wqtj
o.|o|i	n|otStqtj
o.|o|i	n|otStqtj
o?}|i
itid
||i
ititiqXqWt|_|o|i	n|i
iti
d|idS(s/
        Collect the data for a plugin
        ttargetRs-threadtargsNsstarting threaded plugin %sscopying pathspec %ss7error copying from pathspec %s (%s), traceback follows:scollecting output of '%s's3error collection output of '%s', traceback follows:splugin %s returning(RRRRRRtstarttacquireR%treleaseR(RFR&RGRR!R"RR_RiRCRDRERmt	tracebackt
format_excRR(	R*Rt	semaphoreR9RORRRR((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyRsp.


	


 %


%cCs
t|_dS(s8 This function tells the plugin that it should exit ASAPN(RR%(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytexit_pleasescCs y|iiSWndSXdS(s9 This function will return the description for the plugins<no description available>N(t__doc__R(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytget_descriptionscCs~t|ipt|ioZx)|iD]}tii|otSq*Wx&|iD]}|i|otSqVWtStS(sg This function can be overidden to let the plugin decide whether
        it should run or not.
        (	R7R$R#R8R9R^RR2R(R*RTtpkgname((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytcheckenableds 
	
	cCstS(swThis devices whether a plugin should be automatically loaded or
        only if manually specified in the command line.(R(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytdefaultenabled
scCs|idS(sw This function has been replaced with setup().  Please change your
        module calls.  Calling setup() now.
        N(tsetup(R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytcollectscCsdS(s~This class must be overridden to check the sanity of the system's
        configuration before the collection begins.
        N((R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytdiagnosescCsdS(sThis class must be overridden to add the copyPaths, forbiddenPaths,
        and external programs to be collected at a minimum.
        N((R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyRscCsdS(sM
        perform any analysis. To be replaced by a plugin if desired
        N((R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytanalyze!scCsdS(sS
        perform any postprocessing. To be replaced by a plugin if desired
        N((R*((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytpostproc'sc
Cs`d|i}|d|id}t|ioy|d}x^|iD]S}|d|d|df}|dd	jo|d
|d}n|d}qFW|d
}nt|ioy|d}x^|iD]S}|d|d|df}|dd	jo|d
|d}n|d}qW|d
}nt|io|d}x|iD]y}|doVt|doEt|id|idd|d}|d||df}qX|d|d}qXW|d
}nt|io:|d}x|iD]}|d|}qW|d
}n|idjo|d}||id}n|S(sm Present all information that was gathered in an html file that allows browsing
        the results.
        s<hr/><a name="%s"></a>
s<h2> Plugin <em>s</em></h2>
s<p>Files copied:<br><ul>
s<li><a href="%s">%s</a>RVR3RXRWs (symlink to %s)RYs</li>
s
</ul></p>
s<p>Directories Copied:<br><ul>
s<li><a href="%s">%s</a>
s<p>Commands Executed:<br><ul>
RRsRR[s<li><a href="%s">%s</a></li>
Rs<li>%s</li>
s<p>Alerts:<br><ul>
R	s<p>Additional Information:<br>
s</p>
(	RR7RRRRdRRR(R*thtmlRJtadirtcmdt
cmdOutRelPathtalert((s3/usr/lib/python2.6/site-packages/sos/plugintools.pytreport-sN






)


N(+RRRR.R/R2RPRURiRkRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR(((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyR(sN	#						R				
								)						8									((Rtsos.helperst	threadingRRR8tos.pathtsyststringR~R>RRuRRRERR(((s3/usr/lib/python2.6/site-packages/sos/plugintools.pyt<module>s
T


Youez - 2016 - github.com/yon3zu
LinuXploit