JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/firewall/__pycache__/dbus_utils.cpython-39.pyc

a

	�	i�$�@s�gd�ZddlZddlZddlmZddlmZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
ddd�Zdd�Zddd�Zdd�Zdd�ZdS))�command_of_pid�
pid_of_sender�
uid_of_sender�user_of_uid�context_of_sender�command_of_sender�user_of_sender�dbus_to_python�dbus_signature�%dbus_introspection_prepare_properties�!dbus_introspection_add_properties�N)�minidom)�logcCsdzJtd|d��(}|��d�dd���}Wd�n1s>0YWnty^YdS0|S)z  Get command for pid from /proc z/proc/%d/cmdline�rr�� N)�open�	readlines�replace�strip�	Exception)�pid�f�cmd�r�7/usr/lib/python3.9/site-packages/firewall/dbus_utils.pyr"s:rcCsD|�dd�}t�|d�}zt|�|��}Wnty>YdS0|S)zV Get pid from sender string using
    org.freedesktop.DBus.GetConnectionUnixProcessID �org.freedesktop.DBus�/org/freedesktop/DBusN)�
get_object�dbus�	Interface�intZGetConnectionUnixProcessID�
ValueError)�bus�sender�dbus_obj�
dbus_ifacerrrrr+srcCsD|�dd�}t�|d�}zt|�|��}Wnty>YdS0|S)zU Get user id from sender string using
    org.freedesktop.DBus.GetConnectionUnixUser rrN)rrr r!ZGetConnectionUnixUserr")r#r$r%r&�uidrrrr8srcCs,zt�|�}Wnty"YdS0|dS)z Get user for uid from pwd Nr)�pwd�getpwuidr)r'ZpwsrrrrEs
rcCsP|�dd�}t�|d�}z|�|�}Wnty:YdS0d�ttt|���S)zk Get SELinux context from sender string using
    org.freedesktop.DBus.GetConnectionSELinuxSecurityContext rrN�)	rrr Z#GetConnectionSELinuxSecurityContextr�join�map�chrr)r#r$r%r&�contextrrrrNsrcCstt||��S)z  Return command of D-Bus sender )rr�r#r$rrrr\srcCstt||��S)N)rrr/rrrrasrcCs`|dur|}�n�t|tj�r(t|�}�nzt|tj�r@t|�}�nbt|tj�rXt|�}�nJt|tj�s�t|tj�s�t|tj	�s�t|tj
�s�t|tj�s�t|tj�s�t|tj
�r�t|�}n�t|tj�r�t|�}n�t|tj�r�dd�|D�}n�t|tj��r
tdd�|D��}n�t|tj��r,dd�|��D�}nvt|t��s�t|t��s�t|t��s�t|t��s�t|t��s�t|t��s�t|t��s�t|t��r�|}ntdt|���|du�r\|tk�r�t|t��rF|tk�r�t|t��rF|tk�r�t|t��rF|tk�rt|t��rF|tk�rt|t��rF|tk�r0t|t��rF|tk�r\t|t��s\td|t|�|f��|S)NcSsg|]}t|��qSr�r��.0�xrrr�
<listcomp>x�z"dbus_to_python.<locals>.<listcomp>cSsg|]}t|��qSrr0r1rrrr4zr5cSsi|]\}}t|�t|��qSrr0)r2�k�vrrr�
<dictcomp>|r5z"dbus_to_python.<locals>.<dictcomp>�Unhandled %sz%s is %s, expected %s)�
isinstancer�Boolean�bool�String�str�
ObjectPath�Byte�Int16�Int32�Int64�UInt16�UInt32�UInt64r!�Double�float�Array�Struct�tuple�
Dictionary�items�bytes�list�dict�	TypeError�repr�type)�objZ
expected_typeZ
python_objrrrrds�
�
�
�
�
�
�

�������
������������rcCs$t|tj�rdSt|tj�r dSt|tj�r0dSt|tj�r@dSt|tj�rPdSt|tj�r`dSt|tj�rpdSt|tj	�r�dSt|tj
�r�d	St|tj�r�d
St|tj�r�dSt|tj
�r�t|j�dkr�d
|jSd|jSn@t|tj��r�d|jSt|tj��rd|jStdt|���dS)N�b�s�o�y�n�ir3�q�u�t�d�za(%s)za%sz(%s)za{%s}r9)r:rr;r=r?r@rArBrCrDrErFrGrI�lenZ	signaturerJrLrQrR)rTrrrr	�s>


r	cCs�|duri}t|d�s"t|di�t|d�}i||<z|�|�}WntyXi}Yn0|��D]J\}}dt|�i|||<||vr�|||||d<qbd|||d<qbdS)N�_fw_dbus_propertiesrS�access�read)�hasattr�setattr�getattrZGetAllrrMr	)rT�	interfacerb�dip�_dict�key�valuerrrr
�s


r
c
Cs�t�|�}t|d�r�|�d�D]�}|�d�r|�d�|kri}t|d�rRt|d�}||vr||��D]H\}}|�d�}|�	d|�|�	d|d�|�	d|d�|�
|�qfqt�|�
��|�
�}	|��|	S)Nrarg�name�propertyrSrb)r
�parseStringrd�getElementsByTagName�hasAttribute�getAttributerfrM�
createElement�setAttribute�appendChildr�debug10�toxml�unlink)
rT�datarg�doc�noderhrjrkZpropZnew_datarrrr�s(


�


rc
Cs>t�|�}||vr�|�d�D]t}|�d�r|�d�|kr|�d�D]L}|�d�rB|�d�||vrB|�d�}|�dd�|�dd�|�|�qBq||v�r|�d�D]t}|�d�r�|�d�|kr�|�d�D]L}	|	�d�r�|	�d�||vr�|�d�}|�dd�|�dd�|	�|�q�q�t�	|�
��|�
�}|��|S)	Nrgrl�method�
annotationzorg.freedesktop.DBus.Deprecatedrk�true�signal)r
rnrorprqrrrsrtrrurvrw)
rTrxrgZdeprecated_methodsZdeprecated_signalsryrzZmethod_noder|Zsignal_noderrr�!dbus_introspection_add_deprecated�s>

�
�


�
�
r)N)N)�__all__rr(Zxml.domr
Zfirewall.core.loggerrrrrrrrrrr	r
rrrrrr�<module>s 	

	
.#

Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓk yP7U*omQIs,K`)6\G3t?pgjrmۛجwluGtfh9uyP0D;Uڽ"OXlif$)&|ML0Zrm1[HXPlPR0'G=i2N+0e2]]9VTPO׮7h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