__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

x[h<���SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
J
r
Jr SSKJr SSK
Jr SSKJrJrJr SSKJr \R*"\5r"SS\5r"S	S
\R4S9r"SS
\5r"SS\5r"SS\5r"SS\5r\\\\\\4r \"5r!\!RES\5 \!RES\5 \!RES\5 \!RES\5 g)�N)�datetime�timezone)�Event)�Union)�performance�
url_helper�util)�DictRegistryc��\rSrSrSrg)�ReportException��N)�__name__�
__module__�__qualname__�__firstlineno__�__static_attributes__r��>/usr/lib/python3/dist-packages/cloudinit/reporting/handlers.pyrrs��rrc�B�\rSrSrSr\RS5rSrSr	g)�ReportingHandler�zwBase class for report handlers.

Implement :meth:`~publish_event` for controlling what
the handler does with an event.
c��g)zPublish an event.Nr��self�events  r�
publish_event�ReportingHandler.publish_event"��rc��g)z0Ensure ReportingHandler has published all eventsNr�rs r�flush�ReportingHandler.flush&rrrN)
rrrr�__doc__�abc�abstractmethodrr"rrrrrrs&���	��� �� �?rr)�	metaclassc�6^�\rSrSrSrSU4SjjrSrSrU=r$)�
LogHandler�*zBPublishes events to the cloud-init log at the ``DEBUG`` log level.c�>�[[U]5 [U[5(aO!Un[[UR55nXlg![a) [RSU5 [RnN9f=f)Nzinvalid level '%s', using WARN)
�superr)�__init__�
isinstance�int�getattr�logging�upper�	Exception�LOG�warning�WARN�level)rr7�input_level�	__class__s   �rr-�LogHandler.__init__-sl���
�j�$�(�*��e�S�!�!���K�
%�������7���
���
%����<�k�J�����
%�s�A�0B�Bc���[R"SRSSURUR/55nURURUR55 g)N�.�	cloudinit�	reporting)r1�	getLogger�join�
event_type�name�logr7�	as_string)rr�loggers   rr�LogHandler.publish_event:sL���"�"��H�H�k�;��0@�0@�%�*�*�M�N�
��	�
�
�4�:�:�u���0�1r)r7)�DEBUG)	rrrrr$r-rr�
__classcell__�r9s@rr)r)*s���L��2�2rr)c��\rSrSrSrSrSrg)�PrintHandler�AzPrint the event as a string.c�6�[UR55 g�N)�printrDrs  rr�PrintHandler.publish_eventDs��
�e�o�o�� rrN)rrrrr$rrrrrrKrKAs
��&�!rrKc�J^�\rSrSrSU4SjjrSrSrSrSrU=r	$)�WebHookHandler�Hc�>�[[U]5 [X#XE/5(a)[R
"UUUUS9nURUlO[RUlXlX`lXpl	[R"5Ul[5Ul[R "5Ul["R$"UR&S9UlSUR(lUR(R-5 g)N)�consumer_key�	token_key�token_secret�consumer_secret��targetT)r,rRr-�anyr�OauthUrlHelper�readurl�endpoint�timeout�retriesr	�fetch_ssl_details�ssl_detailsr�flush_requested�queue�Queue�	threading�Thread�process_requests�event_processor�daemon�start)
rr^rUrVrWrXr_r`�oauth_helperr9s
         �rr-�WebHookHandler.__init__Is����	�n�d�,�.����G�H�H�%�4�4�)�#�)� /�	�L�(�/�/�D�L�%�-�-�D�L� �
������1�1�3���$�w���"'�+�+�-��
�(�/�/�t�7L�7L�M���&*����#����"�"�$rc	���SnURR5(a�US:�a�[RS5 URR5(dUURR
5 URR5 URR5(dMUSnURRSS9nURUSUSUSUSUSS	S
9 SnURR5 GM![a)n[RSUSU5 US-
nSnANKSnAff=f!URR5 f=f)NrT�zNMultiple consecutive failures in WebHookHandler. Cancelling all queued events.��block���F)�datar_r`rb�log_req_respz0Failed posting event: %s. This was caused by: %s)rc�is_setr4r5rd�empty�
get_nowait�	task_done�getr]r3)r�consecutive_failed�args�es    rrh�WebHookHandler.process_requestsjsH������#�#�*�*�,�,�1C�a�1G����4���*�*�*�*�,�,��J�J�)�)�+��J�J�(�(�*��*�*�*�*�,�,�&'�"��:�:�>�>��>�-�D�
'������G��a�� ��G� ��G� $�Q��!&�
��&'�"��
�
�$�$�&�E��4�
(����F���G���
#�a�'�"��

(���
�
�$�$�&�s*�%D�
E�D>�9E�>E�E�E"c��UR5n[RSURU5 URRUR[R"U5URURUR45 g)NzQueuing POST to %s, data: %s)�as_dictr4�debugr^rd�put�json�dumpsr_r`rb)rr�
event_datas   rr�WebHookHandler.publish_event�sg���]�]�_�
��	�	�*��M�M��	
�
	
�
�
����
�
��
�
�:�&�������� � �
�	
rc���URR5 [RS5 URR5 URR
5 g)Nz(WebHookHandler flushing remaining events)rc�setr4r�rdr@�clearr!s rr"�WebHookHandler.flush�sA����� � �"��	�	�<�=��
�
�������"�"�$r)r^rircrdr]r`rbr_)NNNNNN)
rrrrr-rhrr"rrHrIs@rrRrRHs2���������%�B$'�L
�"%�%rrRc��^�\rSrSrSrSrSrSr\\-rSr	Sr
SrS	rS
r
SrSr\S
4U4Sjjr\S5rSrSrSrSrSrSrSrS\S\SS
4SjrSrSrSrSrSr U=r!$) �HyperVKvpReportingHandler�a
Reports events to a Hyper-V host using Key-Value-Pair exchange protocol
and can be used to obtain high level diagnostic information from the host.

To use this facility, the KVP user-space daemon (hv_kvp_daemon) has to be
running. It reads the kvp_file when the host requests the guest to
enumerate the KVP's.

This reporter collates all events for a module (origin|name) in a single
json string in the dictionary.

For more information, see
https://technet.microsoft.com/en-us/library/dn798287.aspx#Linux%20guests
iii�
CLOUD_INIT�msg�result�msg_i)�,�:z/var/lib/hyperv/.kvp_pool_1FNc��>�[[U]5 Xl[R	UR5 X l[R"5UlUR5Ul
SRURUR5Ul
[R"UR S9UlSUR"lUR"R'5 g)Nz{0}|{1}rYT)r,r�r-�_kvp_file_path�_truncate_guest_pool_file�_event_typesrdre�q�_get_incarnation_no�incarnation_no�format�EVENT_PREFIX�event_key_prefixrfrg�_publish_event_routine�publish_threadrjrk)r�
kvp_file_path�event_typesr9s   �rr-�"HyperVKvpReportingHandler.__init__�s����
�'��7�9�+��!�;�;����	
�(��#�k�k�m���"�6�6�8��� )� 0� 0����t�2�2�!
���(�.�.��.�.�
���&*����"����!�!�#rc��UR(ag[R"5[[R"55-
n[
RRU5U:a[US5 SSS5 OSUlg!,(df   N=f![[4a n[RSU5 SnANDSnAff=f!SUlf=f)a�
Truncate the pool file if it has not been truncated since boot.
This should be done exactly once for the file indicated by
KVP_POOL_FILE_GUEST constant above. This method takes a filename
so that we can use an arbitrary file during unit testing.
Since KVP is a best-effort telemetry channel we only attempt to
truncate the file once and only if the file has not been modified
since boot. Additional truncation can lead to loss of existing
KVPs.
N�wz$failed to truncate kvp pool file, %sT)
�_already_truncated_pool_file�time�floatr	�uptime�os�path�getmtime�open�OSError�IOErrorr4r5)�cls�kvp_file�	boot_timer~s    rr��3HyperVKvpReportingHandler._truncate_guest_pool_file�s����+�+���I�I�K�%����
�"6�6�	�	4��w�w����)�I�5��(�C�(��)�(�6�04�C�,�)�(����!�	C��K�K�>��B�B��	C��04�C�,�sT�/B�7B�9B�C�
B�B�C�B�C�,C�C�C�C�	Cc���[R"5n[[R"5[	U5-
5$![
a [RSU5 gf=f)z�
use the time passed as the incarnation number.
the incarnation number is the number which are used to
distinguish the old data stored in kvp and the new data.
z"uptime '%s' not in correct format.r)r	r�r/r�r��
ValueErrorr4r5)r�
uptime_strs  rr��-HyperVKvpReportingHandler._get_incarnation_no�sP���[�[�]�
�	��t�y�y�{�U�:�%6�6�7�7���	��K�K�<�j�I��	�s�)A� A$�#A$c#� # �[URS5n[R"U[R5 URU5 UR
UR5n[U5UR:XaKURU5nUv� UR
UR5n[U5UR:XaMK[R"U[R5 SSS5 g!,(df   g=f7f)z-iterate the kvp file from the current offset.�rbN)r�r��fcntl�flock�LOCK_EX�seek�read�HV_KVP_RECORD_SIZE�len�_decode_kvp_item�LOCK_UN)r�offset�f�record_data�kvp_items     r�
_iterate_kvps�'HyperVKvpReportingHandler._iterate_kvps�s����
�$�%�%�t�
,���K�K��5�=�=�)�
�F�F�6�N��&�&��!8�!8�9�K��k�"�d�&=�&=�=��0�0��=�����f�f�T�%<�%<�=���k�"�d�&=�&=�=�
�K�K��5�=�=�)�-�
,�
,�s#�D�B4C=�%C=�4	D�=
D�Dc��SRURURUR[R
"55$)zm
the event key format is:
CLOUD_INIT|<incarnation number>|<event_type>|<event_name>|<uuid>
[|subevent_index]
z{0}|{1}|{2}|{3})r�r�rArB�uuid�uuid4rs  r�
_event_key�$HyperVKvpReportingHandler._event_keys6��!�'�'��!�!�5�#3�#3�U�Z�Z�����
�	
rc��[R"SURUR4-UR	S5UR	S55nU$)Nz%ds%ds�utf-8)�struct�pack�HV_KVP_EXCHANGE_MAX_KEY_SIZE�HV_KVP_EXCHANGE_MAX_VALUE_SIZE�encode�r�key�valuerus    r�_encode_kvp_item�*HyperVKvpReportingHandler._encode_kvp_itemsP���{�{���1�1��3�3��
�

�J�J�w���L�L��!�
���rc�N�[U5nX R:wa$[SRX R55eUSURRS5R
S5nUURURRS5R
S5nX4S.$)Nz$record_data len not correct {0} {1}.rr��)r�r�)r�r�rr�r��decode�strip)rr��record_data_len�k�vs     rr��*HyperVKvpReportingHandler._decode_kvp_item!s����k�*���5�5�5�!�6�=�=�#�%<�%<���
�
��D�=�=�>�
�V�G�_�
�U�6�]�	
�
��1�1�D�4K�4K�
��V�G�_�
�U�6�]�	
��%�%rc���[R"SUR35 [URS5n[R
"U[R5 UHnURU5 M UR5 [R
"U[R5 SSS5 SSS5 g!,(df   N=f!,(df   g=f)Nz
Appending �ab)
r�Timedr�r�r�r�r��writer"r�)rr�r�rus    r�_append_kvp_item�*HyperVKvpReportingHandler._append_kvp_item8s���
�
�
��D�,?�,?�+@�A�
B�D�����E
�
��K�K��5�=�=�)�#������
�$�
�G�G�I��K�K��5�=�=�)�E
�
B�
B�E
�E
��
B�
B�s#�C�A5C�0C�
C	�C�
C c	�&�X R	[R"U5nUS[U5S-
nSn/nSUR-S-nXRUR'SX R'[R"X R
S9nUR[U5-
S-
n	URUSRURUSU	S	95n
S
RX5nURURX�55 US-
nXISnU(dU$M�)Nrrr�"z":""���
separators�z"{key}":"{desc}")r��descz{}|{})�MSG_KEYr�r�r��DESC_IDX_KEY�JSON_SEPARATORS�HV_KVP_AZURE_MAX_VALUE_SIZE�replacer��appendr�)rr��	meta_data�description�des_in_json�i�result_array�message_place_holder�data_without_desc�
room_for_descr��subkeys            r�_break_down�%HyperVKvpReportingHandler._break_downBs(���l�l�#��j�j��-��!�!�s�;�'7�!�';�=��
����"�T�\�\�1�F�:���+,�d�'�'�(�&(�I�l�l�#� $�
�
��&:�&:�!���0�0�3�7H�3I�I�A�M�
�&�-�-�$�"�)�)����;�~�
�+F�*���E��^�^�C�+�F����� 5� 5�f� D�E�
��F�A�%�n�5�K�����+rr�r��returnc��[U5UR:�aUSURS-
nURX5/nURU5 g![[
4a [RSX5 gf=f)z:Write KVP key-value.

Values will be truncated as needed.
rrrzfailed posting kvp=%s value=%sN)r�r�r�r�r�r�r4r5r�s    r�	write_key�#HyperVKvpReportingHandler.write_key`sy��
�u�:��9�9�9��!�d�>�>��B�C�E��%�%�c�1�2��	F��!�!�$�'����!�	F��K�K�8�#�E�	F�s�A�&A:�9A:c�0�URU5nURUR[R"UR
[R5R5S.n[XR5(aURX0R'URX0R'[R"X0R S9n[#U5UR$:�aUR'X#UR5$UR)X$5nU/$)z�
encode the event into kvp data bytes.
if the event content reaches the maximum length of kvp value.
then it would be cut to multiple slices.
)rB�type�tsr�)r�rBrAr�
fromtimestamp�	timestampr�utc�	isoformat�hasattr�
RESULT_KEYr�r�r�r�r�r�r�r�r�r�)rrr�r�r�rus      r�
_encode_event�'HyperVKvpReportingHandler._encode_eventos����o�o�e�$���J�J��$�$��&�&��O�O�X�\�\���)�+�

�	��5�/�/�*�*�).���I�o�o�&�"'�"3�"3�	�,�,���
�
�9�1E�1E�F���u�:��8�8�8��#�#�C�E�4E�4E�F�F��(�(��4�D��6�Mrc�^�SnURRSS9nUS-
n/nUb7X0RU5-
nURRSS9nUS-
nUbM7URU5 [U5HnURR5 M M�![Ra SnN]f=f![[4a n[RSU5 SnANuSnAff=f![U5HnURR5 M f=f![a gf=f)NTrrprrFz failed posting events to kvp, %s)
r�r{r
rd�Emptyr�r�r�r4r5�rangerz�EOFError)r�items_from_queuer�encoded_datar~�_s      rr��0HyperVKvpReportingHandler._publish_event_routine�s-��� ��
����
�
��
�.�� �A�%� �!���'� �$6�$6�u�$=�=�L�%� $���
�
��
� 7��(�A�-�(��'�+��)�)�,�7�#�#3�4�����(�(�*�5�'��!�;�;�%� $��%�� ��)�G��K�K� B�A�F�F��G��#�#3�4�����(�(�*�5���
��
�sj�6D�B�D� B;�1,D�B8�5D�7B8�8D�;C+�C&�!C.�&C+�+C.�..D�D�
D,�+D,c��UR(aURUR;aURRU5 ggrN)r�rAr�r�rs  rr�'HyperVKvpReportingHandler.publish_event�s4��� � �E�$4�$4��8I�8I�$I��F�F�J�J�u��%Jrc�b�[RS5 URR5 g)Nz0HyperVReportingHandler flushing remaining events)r4r�r�r@r!s rr"�HyperVKvpReportingHandler.flush�s���	�	�D�E������
r)r�r�r�r�r�r�)"rrrrr$r�r�r�r�r�r�rr�r��KVP_POOL_FILE_GUESTr�r-�classmethodr�r�r�r�r�r�r�r��strrr
r�rr"rrHrIs@rr�r��s����
�&*�"�"&��#&� �$�'E�E�� �L��G��J��L� �O�7��#(� �%8�d�$�&�4��4�.�
*�
�
�&�.*��<
F�S�
F��
F��
F��:�<��rr�rCrO�webhook�hyperv)#r%r�r�r1r�rdr�rfr�r�rrr�typingrr=rrr	�cloudinit.registryr
r?rr4r3r�ABCMetarr)rKrRr��HandlerType�available_handlers�
register_itemrrr�<module>r&s������	��
����'���3�3�+�
����!��	�i�	�?����?�2�!�2�.!�#�!�]%�%�]%�@H� 0�H�Z������	���"�^��� � ��
�3�� � ��,�7�� � ��N�;�� � ��+D�Er

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 1.82 KB 0644
events.cpython-313.pyc File 12.19 KB 0644
handlers.cpython-313.pyc File 20.75 KB 0644
Filemanager