NineSec Team Shell
Server IP : 184.107.3.203  /  Your IP : 216.73.216.51
Web Server : Apache
System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64
User : adminteladeoro ( 1015)
PHP Version : 8.2.28
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python3.6/site-packages/sos/report/plugins/__pycache__/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python3.6/site-packages/sos/report/plugins/__pycache__/pulpcore.cpython-36.pyc
3

~�g5�@sBddlmZddlmZddlmZmZmZGdd�dee�ZdS)�)�match)�quote)�Plugin�IndependentPlugin�	PluginOptc@sreZdZdZdZdZdZedddd�gZd	Z	d
Z
dZdZdZ
d
ZdZde
iZdd�Zdd�Zddd�Zdd�ZdS)�PulpCorezPulp-3 aka pulpcoreZpulpcore�pulpcore-manager�/etc/pulp/settings.pyz	task-days�zdays of task history)�defaultZdescZ	localhosti8Zpulp�z/var/lib/pulp/assetsz/var/lib/pulp/media/upload�
PGPASSWORDcCs�d}ddd�}�yNtdddd���4}�x*|j�jd	d
�jdd�jd
d�j�D�]}|sL|ddkrfqL|jd�rvd}qLd}|r�t|d|�r�||�|_|r�t|d|�r�||�|_|r�t|d|�r�||�|_|r�t|d|�r�||�|_	|o�t|d|��r||�|_
|�rd
|k�rd}|jd��r6||dd�|_|jd�rL||dd�|_qLWWdQRXWnt
k
�rtYnXd|j
i|_dS) z Parse pulp settings F�:cSsP|j|�dj�jd�}|jd�r,|jd�s@|jd�rL|jd�rL|dd�}|S)N��,�"�'���)�split�lstrip�rstrip�
startswith�endswith)�line�sep�val�r�/usr/lib/python3.6/pulpcore.py�separate_value(s
z6PulpCore.parse_settings_config.<locals>.separate_valuez/etc/pulp/settings.py�rzUTF-8)�encodingrz,
�{z{
�}z
}r�#Z	DATABASESTz\s*['|\"]%s['|\"]\s*:\s*\S+ZHOSTZPORT�NAMEZUSERZPASSWORDzSTATIC_ROOT = �=)rzCHUNKED_UPLOAD_DIR = Nr
)r)�open�read�replace�
splitlinesrr�dbhost�dbport�dbname�dbuser�dbpasswd�
staticroot�	uploaddir�IOError�env)�selfZdatabases_scoper�filer�patternrrr�parse_settings_config$s@
	






 zPulpCore.parse_settings_configc	Cs|j�|jddg�|jd�|jddd�dddd	�}|jd
|d�x|j|jgD]}|j|�qVW|jd�}xzdD]r}d|�d�}|j|j	|�|j
d�}|ddkr�|dnd}d|�d|�d|�d�}|j	|�}|j||j
|d�qxW|j	d�}|j|d|j
d�dS) Nz/etc/pulp/settings.pyz/etc/pki/pulp/*z/etc/pki/pulp/**/*.keyz.curl -ks https://localhost/pulp/api/v3/status/Zpulp_status)�suggest_filenamezen_US.UTF-8zpulpcore.app.settings)�LC_ALLZ
PULP_SETTINGSZDJANGO_SETTINGS_MODULEz
dynaconf list)r2z	task-days�	core_task�core_taskgroup�core_groupprogressreport�core_progressreportz]COPY (SELECT STRING_AGG(column_name, ', ') FROM information_schema.columns WHERE table_name='zl'AND table_schema = 'public' AND column_name NOT IN ('args', 'kwargs', 'enc_args', 'enc_kwargs')) TO STDOUT;Zstatusr�output�*zselect z from z, where pulp_last_updated> NOW() - interval 'z! days' order by pulp_last_updated)r2r7a[SELECT table_name, pg_size_pretty(total_bytes) AS total, pg_size_pretty(index_bytes) AS INDEX , pg_size_pretty(toast_bytes) AS toast, pg_size_pretty(table_bytes) AS TABLE FROM ( SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME, c.reltuples AS row_estimate, pg_total_relation_size(c.oid) AS total_bytes, pg_indexes_size(c.oid) AS index_bytes, pg_total_relation_size(reltoastrelid) AS toast_bytes FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE relkind = 'r') a) a order by total_bytes DESCZpulpcore_db_tables_sizes)r7r2)r9r:r;r<)r6Z
add_copy_specZadd_forbidden_pathZadd_cmd_outputr/r0Zadd_dir_listingZ
get_optionZexec_cmd�build_query_cmdr2)	r3Zdynaconf_envZ_dirZ	task_days�tableZ_queryZcol_out�columnsZ_cmdrrr�setupYs4


zPulpCore.setupFcCs2|rd|�d�}d}||j|j|j|jt|�fS)aI
        Builds the command needed to invoke the pgsql query as the postgres
        user.
        The query requires significant quoting work to satisfy both the
        shell and postgres parsing requirements. Note that this will generate
        a large amount of quoting in sos logs referencing the command being run
        zCOPY (z6) TO STDOUT WITH (FORMAT 'csv', DELIMITER ',', HEADER)z0psql --no-password -h %s -p %s -U %s -d %s -c %s)r*r+r-r,r)r3ZqueryZcsvZ_dbcmdrrrr?�s

zPulpCore.build_query_cmdcCs(d}d}|jd||�|jd||�dS)Nz_((?:SECRET_KEY|AUTH_LDAP_BIND_PASSWORD)(?:\<.+\>)?(\s*=)?|(password|PASSWORD)(\"|'|:)+)\s*(\S*)z\1 ********z/etc/pulp/settings.pyz
dynaconf list)Zdo_path_regex_subZdo_cmd_output_sub)r3Zkey_pass_re�replrrr�postproc�szPulpCore.postprocN)r)r	)F)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZcommands�filesrZoption_listr*r+r,r-r.r/r0r2r6rBr?rDrrrrrs"56
rN)	�rerZshlexrZsos.report.pluginsrrrrrrrr�<module>s

NineSec Team - 2022