403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/landscape/package/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/landscape/package/reporter.pyc
ó
}9Rc@slddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlm
Z
mZddlmZddlmZddlmZddlmZmZmZdd	lmZmZd
ZdZdefd
„ƒYZdefd„ƒYZdefd„ƒYZ defd„ƒYZ!d„Z"d„Z#dS(iÿÿÿÿN(tDeferredtsucceed(tsequence_to_ranges(tgather_resultst
spawn_process(tfetch_async(t
touch_file(tbpickle(tPackageTaskHandlerConfigurationtPackageTaskHandlertrun_task_handler(tUnknownHashIDRequesttFakePackageStorei iôtPackageReporterConfigurationcBseZdZd„ZRS(s=Specialized configuration for the Landscape package-reporter.cCs8tt|ƒjƒ}|jddtddddƒ|S(sl
        Specialize L{Configuration.make_parser}, adding options
        reporter-specific options.
        s--force-apt-updatetdefaulttactiont
store_truethelpsForce running apt-update.(tsuperR
tmake_parsert
add_optiontFalse(tselftparser((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRs
(t__name__t
__module__t__doc__R(((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR
stPackageReportercBsÝeZdZeZdZdZdZdZe	Z
d„Zd„Zd„Z
d„Zd	„Zd
„Zd„Zd„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(stReport information about the system packages.

    @cvar queue_name: Name of the task queue to pick tasks from.
    treporters/usr/lib/landscape/apt-updates/etc/apt/sources.lists/etc/apt/sources.list.dcs½tˆ_tƒ}|j‡fd†ƒ|j‡fd†ƒ|j‡fd†ƒ|j‡fd†ƒ|j‡fd†ƒ|j‡fd†ƒ|j‡fd†ƒ|jdƒ|S(Ncs
ˆjƒS(N(trun_apt_update(tx(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyt<lambda><scs
ˆjƒS(N(tfetch_hash_id_db(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR?scs
ˆjƒS(N(tuse_hash_id_db(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRBscs
ˆjƒS(N(thandle_tasks(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyREscs
ˆjƒS(N(tremove_expired_hash_id_requests(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRHscs
ˆjƒS(N(trequest_unknown_hashes(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRKscs
ˆjƒS(N(tdetect_changes(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRNs(Rt	_got_taskRtaddCallbacktcallbacktNone(Rtresult((Rs>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytrun7s		
cCs|jj|tƒS(N(t_brokertsend_messagetTrue(Rtmessage((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR-Sscs,‡fd†}ˆjƒ}|j|ƒ|S(sî
        Fetch the appropriate pre-canned database of hash=>id mappings
        from the server. If the database is already present, it won't
        be downloaded twice.

        The format of the database filename is <uuid>_<codename>_<arch>,
        and it will be downloaded from the HTTP directory set in
        config.package_hash_id_url, or config.url/hash-id-databases if
        the former is not set.

        Fetch failures are handled gracefully and logged as appropriate.
        cs¼ˆdkrdStjjˆƒr&dSˆjƒ}|sItjdƒdSt|tjjˆƒƒ‰‡‡fd†}d„}t	ˆdˆj
jdƒƒ}|j|ƒ|j
|ƒ|S(Ns)Can't determine the hash=>id database urlcs;tˆdƒ}|j|ƒ|jƒtjdˆƒdS(Ntws$Downloaded hash=>id database from %s(topentwritetclosetloggingtinfo(tdatat
hash_id_db_fd(turlthash_id_db_filename(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytfetch_okws

cSs$|j}tjdt|ƒƒdS(Ns'Couldn't download hash=>id database: %s(tvalueR4twarningtstr(tfailuret	exception((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytfetch_error}s		tcainfotssl_public_key(R)tostpathtexistst_get_hash_id_db_base_urlR4R<R=tbasenameRt_configtgetR't
addErrback(R9tbase_urlR:R@R*(R(R8R9s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytfetch_itds 
		

(t_determine_hash_id_db_filenameR'(RRLR*((Rs>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR Vs%
cCsc|jjdƒ}|sR|jjdƒs.dStj|jjjdƒdƒ}n|jdƒdS(Ntpackage_hash_id_urlR8t/shash-id-databases(RHRIR)turlparseturljoinR8trstrip(RRK((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRFscCsØddlm}g}tjj|jƒr>|j|jƒntjj|jƒr”|jgtj	|jƒD]}tjj
|j|ƒ^qlƒnx=|D]5}tjƒtjj|ƒ}||j
kr›tSq›WtS(s=Return a boolean indicating if the APT sources were modified.iÿÿÿÿ(tPackageMonitor(t landscape.monitor.packagemonitorRSRCRDREtsources_list_filenametappendtsources_list_directorytextendtlistdirtjointtimetgetmtimetrun_intervalR.R(RRSt	filenamestfilenametseconds_since_last_change((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyt_apt_sources_have_changedžs8
cCsrtjj|jƒr!|j}n+tjj|jjƒrH|jj}ntStj|ƒj}||t	j	ƒkS(s+Check if the apt-update timeout has passed.(
RCRDREtupdate_notifier_stampRHtupdate_stamp_filenameR.tstattst_mtimeR[(Rtintervaltstamptlast_update((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyt_apt_update_timeout_expired´scszˆjjs-ˆjƒs-ˆjˆjjƒrXtˆjƒ}‡fd†}|j|ƒStj	dˆjƒt
dƒSdS(s€Run apt-update and log a warning in case of non-zero exit code.

        @return: a deferred returning (out, err, code)
        cs
|\‰‰‰d}tˆjjƒtjdˆjˆˆˆfƒˆdkr¡tjdˆjˆˆfƒx^|D]%}|ˆkrud\‰‰‰PququWn.ˆjjƒsÏd‰dˆj	ˆj
f‰nˆjjd	ˆj
ˆˆƒ}|j‡‡‡fd
†ƒ|S(
Ns8Problem renaming the file /var/cache/apt/srcpkgcache.bins5Problem renaming the file /var/cache/apt/pkgcache.bins/'%s' exited with status %d (out='%s', err='%s')is'%s' exited with status %d (%s)tis0There are no APT sources configured in %s or %s.spackage-reporter-resultcs
ˆˆˆfS(N((tignore(tcodeterrtout(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRês(s8Problem renaming the file /var/cache/apt/srcpkgcache.bins5Problem renaming the file /var/cache/apt/pkgcache.bin(RjRji(RRHRcR4tdebugtapt_update_filenameR<t_facadetget_channelsRURWR,tcall_if_acceptedtsend_resultR'(t.0RnRmRltaccepted_apt_errorsR/tdeferred(R(RlRmRns>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR(Ës.	
	s/'%s' didn't run, update interval has not passedRjiN(RjRji(RHtforce_apt_updateRaRitapt_update_intervalRRpR'R4RoR(RR*R(((Rs>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRÀs"
	cCs(idd6|d6|d6}|j|ƒS(sP
        Report the package reporter result to the server in a message.
        spackage-reporter-resultttypeRlRm(R-(RRlRmR/((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRtôs

cCsV|j}|ddkr/t|_|j|ƒS|ddkrRt|_|jƒSdS(NRzspackage-idst
resynchronize(R6R.R&t_handle_package_idst_handle_resynchronize(RttaskR/((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pythandle_taskþs		
	csÿg}y|jj|dƒ‰Wntk
r:tdƒSXi}xJtˆj|dƒD]2\}}|dkr€|j|ƒqX|||<qXW|jj|ƒt	j
dt|ƒt|ƒfƒ|rÙ|j|ƒ}ntdƒ}|j
‡fd†ƒ|S(Ns
request-idtidssCReceived %d package hash => id translations, %d hashes are unknown.cs
ˆjƒS(N(tremove(R(trequest(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR#s(t_storetget_hash_id_requestRRR)tzipthashesRVtset_hash_idsR4R5tlent_handle_unknown_packagesR'(RR/tunknown_hashesthash_idsthashtidR*((R‚s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR|s$
#	cCs>|jjƒ|jjƒ|jjƒ|jjƒtdƒS(N(Rƒtclear_availabletclear_available_upgradestclear_installedtclear_lockedRR)(R((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR}'s




c	Cs<|jjƒt|ƒ}g}g}x¾|jjƒD]­}|jj|ƒ}||kr5|j|ƒ|jj|ƒ}|ji	|jd6|jd6|j	d6|j
d6|jd6|jd6|j
d6|jd6|jd	6ƒq5q5W|r,tjd
t|ƒƒidd6|d6}|j||ƒ}ntdƒ}|S(
NRztnametversiontsectiontsummarytdescriptiontsizesinstalled-sizet	relationss@Queuing messages with data for %d packages to exchange urgently.sadd-packagestpackages(Rqtensure_channels_reloadedtsettget_packagestget_package_hashRVtget_package_skeletonRzR’R“R”R•R–R—tinstalled_sizeR˜R4R5Rˆt"_send_message_with_hash_id_requestRR)(	RR†tadded_hashesR™tpackageRŒtskeletonR/R*((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR‰=s4








		cs tjƒ‰ˆt‰‡‡fd†}g}xe|jjƒD]T}|jdkr`|jƒq>|jj|jƒ}|j	||ƒ|j
|ƒq>Wt|ƒS(Ncs2|rˆ|_n|jˆkr.|jƒndS(N(t	timestampR(t
is_pendingR‚(tnowttimeout(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytupdate_or_removeds(R[tHASH_ID_REQUEST_TIMEOUTRƒtiter_hash_id_requestst
message_idR)RR,tis_message_pendingR'RVR(RR¨tresultsR‚R*((R§R¦s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR#`s

cCs|jjƒtƒ}x]|jjƒD]L}|jj|ƒ}|jj|ƒdkr&|j|jj|ƒƒq&q&Wx*|jj	ƒD]}|t|j
ƒ8}q†W|s¸tdƒ}nSt|ƒ}|t
 }tjdt|ƒƒidd6|d6}|j||ƒ}|S(s¸Detect available packages for which we have no hash=>id mappings.

        This method will verify if there are packages that APT knows
        about but for which we don't have an id yet (no hash => id
        translation), and deliver a message (unknown-package-hashes)
        to request them.

        Hashes previously requested won't be requested again, unless they
        have already expired and removed from the database.
        sBQueuing request for package hash => id translation on %d hash(es).sunknown-package-hashesRzR†N(RqRšR›RœRRƒtget_hash_idR)taddRªR†RtsortedtMAX_UNKNOWN_HASHES_PER_REQUESTR4R5RˆR (RRŠR¢RŒR‚R*R/((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR$zs&
	 
	

		cs\|jj|ƒ‰ˆj|d<|j|ƒ}‡fd†}‡fd†}|j||ƒS(s<Create a hash_id_request and send message with "request-id".s
request-idcs
|ˆ_dS(N(R«(R«(R‚(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytset_message_id©scsˆjƒ|S(N(R(R>(R‚(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytsend_message_failed¬s
(Rƒtadd_hash_id_requestRR-taddCallbacks(RR/RŠR*R²R³((R‚s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR £s
cs(‡fd†}ˆjƒ}|j|ƒS(s×Detect all changes concerning packages.

        If some changes were detected with respect to our last run, then an
        event of type 'package-data-changed' will be fired in the broker
        reactor.
        cs|rˆjjdƒSdS(Nspackage-data-changed(R,t
fire_event(R*(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytchanges_detectedºs(tdetect_packages_changesR'(RR·Rw((Rs>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR%²scCs-|js|jƒr|jƒStdƒSdS(s„
        Check if any information regarding packages have changed, and if so
        compute the changes and send a signal.
        N(R&t_package_state_has_changedt_compute_packages_changesRR)(R((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR¸Âs
cCsµ|jj}tjj|ƒs"tStjjdƒ}tjj	dƒ}||g}|j
tjd|ƒƒtj|ƒj
}x0|D](}tj|ƒj
}||kr…tSq…WtS(sE
        Detect changes in the universe of known packages.

        This uses the state of packages in /var/lib/dpkg/state and other files
        and simply checks whether they have changed using their "last changed"
        timestamp on the filesystem.

        @return True if the status changed, False otherwise.
        sdir::state::statussdir::state::listss%s/*Packages(RHtdetect_package_changes_stampRCRDRER.tapt_pkgtconfigt	find_filetfind_dirRXtglobRdReR(Rt
stamp_filetstatus_filet	lists_dirtfilestlast_checkedtftlast_changed((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR¹Ìs

cs׈jjƒtˆjjƒƒ}tˆjjƒƒ}tˆjjƒƒ}tˆjjƒƒ}tƒ}tƒ}tƒ}tƒ}x½ˆjjƒD]¬}	ˆjj	|	ƒ}
ˆjj
|
ƒ}|d
k	r•ˆjj|	ƒr|j
|ƒˆjj|	ƒr|j
|ƒqn
|j
|ƒˆjj|	ƒrA|j
|ƒqAq•q•WxWˆjjƒD]F}	ˆjj	|	ƒ}
ˆjj
|
ƒ}|d
k	rU|j
|ƒqUqUW||‰||‰||‰||‰||‰||‰||‰||‰i}ˆrtttˆƒƒƒ|d<nˆr?tttˆƒƒƒ|d<nˆrdtttˆƒƒƒ|d<nˆr‰tttˆƒƒƒ|d<nˆr®tttˆƒƒƒ|d<nˆrÓtttˆƒƒƒ|d<nˆrøtttˆƒƒƒ|d<nˆrtttˆƒƒƒ|d<n|s-ttƒSd	|d
<ˆj|ƒ}
tjdtˆƒtˆƒtˆƒtˆƒtˆƒtˆƒtˆƒtˆƒfƒ‡‡‡‡‡‡‡‡‡f	d†}|
j|ƒ|
S(s/Analyse changes in the universe of known packages.

        This method will verify if there are packages that:

        - are now installed, and were not;
        - are now available, and were not;
        - are now locked, and were not;
        - were previously available but are not anymore;
        - were previously installed but are not anymore;
        - were previously locked but are not anymore;

        Additionally it will report package locks that:

        - are now set, and were not;
        - were previously set but are not anymore;

        In all cases, the server is notified of the new situation
        with a "packages" message.

        @return: A deferred resulting in C{True} if package changes were
            detected with respect to the previous run, or C{False} otherwise.
        t	installedt	availablesavailable-upgradestlockeds
not-installeds
not-availablesnot-available-upgradess
not-lockedR™Rzs»Queuing message with changes in known packages: %d installed, %d available, %d available upgrades, %d locked, %d not installed, %d not available, %d not available upgrades, %d not locked.csâˆrˆjjˆƒnˆr2ˆjjˆƒnˆrKˆjjˆƒnˆrdˆjjˆƒnˆr}ˆjjˆƒnˆr–ˆjjˆƒnˆr¯ˆjjˆƒnˆrȈjjˆƒnˆj	j
}t|ƒtS(N(
Rƒt
add_installedtremove_installedt
add_availablet
add_lockedtremove_availabletadd_available_upgradestremove_available_upgradest
remove_lockedRHR»RR.(R*RÁ(	t
not_lockedt
new_availablet
new_lockedtnew_upgradesRtnot_upgradest
not_availablet
new_installedt
not_installed(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytupdate_currently_knownRs&
N(RqRšR›Rƒt
get_installedt
get_availabletget_available_upgradest
get_lockedRœRR®R)tis_package_installedR¯tis_package_availabletis_package_upgradetget_locked_packagestlistRR°RRR-R4R5RˆR'(Rt
old_installedt
old_availabletold_upgradest
old_lockedtcurrent_installedtcurrent_availabletcurrent_upgradestcurrent_lockedR¢RŒRR/R*RÛ((	RÓRÔRÕRR×RØRÙRÖRÚs>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRºæs|
				











	'
(RRRR
tconfig_factoryt
queue_nameRpRURWRR&R+R-R RFRaRiRRtRR|R}R‰R#R$R R%R¸R¹Rº(((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR)s4			7				4	
			 		#		)			
	tFakeGlobalReportercBseZdZeZd„ZRS(sb
    A standard reporter, which additionally stores messages sent into its
    package store.
    cCs&|jj|ƒtt|ƒj|ƒS(N(Rƒtsave_messageRRïR-(RR/((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR-vs(RRRRtpackage_store_classR-(((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRïnstFakeReportercBs,eZdZeZdZd„Zd„ZRS(se
    A fake reporter which only sends messages previously stored by a
    L{FakeGlobalReporter}.
    csRtdƒ}|j‡fd†ƒ|j‡fd†ƒ|j‡fd†ƒ|S(Ncs
ˆjƒS(N(R (R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRˆscs
ˆjjƒS(N(Rƒtclear_tasks(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRŠscs
ˆjƒS(N(tsend_pending_messages(R(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRs(RR)R'(RR*((Rs>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR+„s
cs>ˆjdkr"tjdˆ_ntjjˆjƒsAtdƒStˆjj	ƒƒ}t
ˆjƒ}t|j	ƒƒ}||}tdƒ}tƒ}|r:|j|ƒ}g}xs|D]k\}	}
tj
t|
ƒƒ}
|
d|kr¸|j|
dƒ|j|	ƒ|j|
‡fd†ƒq¸q¸Wˆjj|ƒn|S(sT
        As the last callback of L{PackageReporter}, sends messages stored.
        tFAKE_PACKAGE_STORERzcs
ˆj|ƒS(N(R-(RR/(R(s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyR¨sN(tglobal_store_filenameR)RCtenvironRDRERR›Rƒtget_message_idsRtget_messages_by_idsRtloadsR=R¯RVR'tsave_message_ids(Rtmessage_senttglobal_storetall_message_idstnot_sentRwtgot_typetmessagestsentR«R/((Rs>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRô‘s,

	
N(	RRRRRñR)RöR+Rô(((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyRò{s
	
cCsIdtjkrtt|ƒSdtjkr8tt|ƒStt|ƒSdS(NtFAKE_GLOBAL_PACKAGE_STORERõ(RCR÷R
RïRòR(targs((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytmain­s


cCs8tjjtjjtjdƒƒ}tjj|dƒS(Nislandscape-package-reporter(RCRDtdirnametabspathtsystargvRZ(R((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pytfind_reporter_command¶s%($RPR4R[RRCRÀR¼ttwisted.internet.deferRRtlandscape.lib.sequencerangesRtlandscape.lib.twisted_utilRRtlandscape.lib.fetchRtlandscape.lib.fsRt
landscape.libRtlandscape.package.taskhandlerRR	R
tlandscape.package.storeRRR©R±R
RRïRòRR
(((s>/usr/lib/python2.7/dist-packages/landscape/package/reporter.pyt<module>s0ÿÿG
2		

Youez - 2016 - github.com/yon3zu
LinuXploit