CasperSecurity

Current Path : /lib/python3/dist-packages/landscape/sysinfo/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/landscape/sysinfo/__pycache__/deployment.cpython-310.pyc

o

���cm�@s�dZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZmZddl
mZddlmZdd	lmZmZgd
�ZGdd�de�Zdd
d�Zddd�Zddd�ZdS)z%Deployment code for the sysinfo tool.�N)�	getLogger�	Formatter)�RotatingFileHandler)�
namedClass)�Deferred�
maybeDeferred)�VERSION)�BaseConfiguration)�SysInfoPluginRegistry�format_sysinfo)�Load�Disk�Memory�Temperature�	Processes�
LoggedInUsers�NetworkcsjeZdZdZeZdZe��dkreej	�
d�f7ZdZdZ�fdd�Z
�fd	d
�Zdd�Zd
d�Z�ZS)�SysInfoConfigurationz9Specialized configuration for the Landscape sysinfo tool.)z/etc/landscape/client.confrz~/.landscape/sysinfo.confz/var/lib/landscape/client/�sysinfocstt|���d|jd<dS)N�config)�superr�__init__�_command_line_defaults)�self��	__class__��>/usr/lib/python3/dist-packages/landscape/sysinfo/deployment.pyr szSysInfoConfiguration.__init__csBtt|���}|jdddd�|jdddd�dd�t�|_|S)	zg
        Specialize L{Configuration.make_parser}, adding any
        sysinfo-specific options.
        z--sysinfo-plugins�PLUGIN_LISTzNComma-delimited list of sysinfo plugins to use. Default is to use all plugins.)�metavar�helpz--exclude-sysinfo-pluginszhComma-delimited list of sysinfo plugins to NOT use. This always take precedence over plugins to include.zDefault plugins: %sz, )rr�make_parser�
add_option�join�ALL_PLUGINS�epilog)r�parserrrrr!%s��z SysInfoConfiguration.make_parsercCsdd�|�d�D�S)NcSsg|]}|���qSr)�strip��.0�xrrr�
<listcomp>9sz9SysInfoConfiguration.get_plugin_names.<locals>.<listcomp>�,)�split)r�plugin_specrrr�get_plugin_names8sz%SysInfoConfiguration.get_plugin_namescsX|jdurt}n|�|j�}|jdurg�n|�|j���fdd�|D�}dd�|D�S)Ncsg|]}|�vr|�qSrrr(��excluderrr+Dsz4SysInfoConfiguration.get_plugins.<locals>.<listcomp>cSs"g|]
}td|��|f���qS)zlandscape.sysinfo.%s.%s)r�lower)r)�plugin_namerrrr+Es
�
�)�sysinfo_pluginsr$r/�exclude_sysinfo_plugins)r�include�pluginsrr0r�get_plugins;s

�z SysInfoConfiguration.get_plugins)�__name__�
__module__�__qualname__�__doc__r�version�default_config_filenames�os�getuid�path�
expanduser�default_data_dir�config_sectionrr!r/r8�
__classcell__rrrrrs
�rcCs,|durt��dkrd}|Stj�d�}|S)zs
    Work out the correct path to store logs in depending on the effective
    user id of the current process.
    Nrz/var/log/landscapez~/.landscape)r?r@rArB)�
landscape_dirrrr�get_landscape_log_directoryJs�rGcCsdt|�}td�}d|_tj�|�st�|�tj�|d�}t|ddd�}|�	|�|�
td��dS)Nzlandscape-sysinfoFzsysinfo.logi��)�maxBytes�backupCountz'%(asctime)s %(levelname)-8s %(message)s)rGr�	propagater?rA�isdir�mkdirr#r�
addHandler�setFormatterr)rF�logger�log_filename�handlerrrr�
setup_loggingWs
�
rSc
s�zt�Wnty}z
t�d|�WYd}~nd}~ww�dur&t��t�}|j|dd�|��D]}��|�q4�fdd����fdd���durkt	����
��fd	d
���fdd�}��|�����S����S)
zQ
    @param reactor: The reactor to (optionally) run the sysinfo plugins in.
    zUnable to setup logging. %sNT)�!accept_nonexistent_default_configcs$tt���������dd��dS)Nz  )�indent)�printr�get_headers�	get_notes�
get_footnotes��result)rrr�show_outputvs�zrun.<locals>.show_outputcs������S�N)�run�addCallbackr)r\rrr�run_sysinfozszrun.<locals>.run_sysinfocst�����Sr])r�
chainDeferredr)�doner`rr�<lambda>�szrun.<locals>.<lambda>cs��d�j�|S)Nr)�	callLater�stoprZ)�reactorrr�stop_reactor�szrun.<locals>.stop_reactor)
rS�IOError�sys�exitr
r�loadr8�addr�callWhenRunning�addBothr^)�argsrfr�er�pluginrgr)rbrfr`r\rrr^ds2
���
�r^r])NN)r<r?ri�loggingrr�logging.handlersr�twisted.python.reflectr�twisted.internet.deferrr�	landscaper�landscape.lib.configr	�landscape.sysinfo.sysinfor
rr$rrGrSr^rrrr�<module>s
7


Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY