Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /usr/lib/python2.7/site-packages/firewall/core/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyo
�
�c�`c@sWdZddddddddgZd	d
lZd	dlmZyejdd
�Wnek
rmeZnAXyd	dlm	Z	e
ZWn#eeejfk
r�eZnXd
ad	dlmZd	dlmZd	dlmZd	d
lZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d
S(s(Functions for NetworkManager interactiontcheck_nm_importedtnm_is_importedtnm_get_zone_of_connectiontnm_set_zone_of_connectiontnm_get_connectionstnm_get_connection_of_interfacetnm_get_bus_nametnm_get_dbus_interfacei����N(tGLibtNMs1.0(R	(terrors(t
FirewallError(tlogcCststtjd��ndS(sNCheck function to raise a MISSING_IMPORT error if the import of NM failed
    sgi.repository.NM = 1.0N(t_nm_importedRR
tMISSING_IMPORT(((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyR0scCstS(snReturns true if NM has been properly imported
    @return True if import was successful, False otherwirse
    (R
(((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyR6scCststjjd�antS(s�Returns the NM client object or None if the import of NM failed
    @return NM.Client instance if import was successful, None otherwise
    N(t
_nm_clientR	tClienttnewtNone(((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyt
nm_get_client<scCs�t�t�j|�}|dkr)dS|j�}|dkrEdSy(|j�tjjtjj	B@rldSWn!t
k
r�|j�r�dSnX|j�}|dkr�d}n|S(s�Get zone of connection from NM
    @param connection name
    @return zone string setting of connection, empty string if not set, None if connection is unknown
    tN(
RRtget_connection_by_uuidRtget_setting_connectiont	get_flagsR	tSettingsConnectionFlagstNM_GENERATEDtNM_VOLATILEtAttributeErrortget_unsavedtget_zone(t
connectiontcontsetting_contzone((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyREs$
	cCszt�t�j|�}|dkr)tS|j�}|dkrEtS|dkrZd}n|jd|�|jtd�S(sSet the zone for a connection
    @param zone name
    @param connection name
    @return True if zone was set, else False
    RR!N(	RRRRtFalseRtset_propertytcommit_changestTrue(R!RRR ((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyRcs	cCs�|j�|j�t�t�j�}xo|D]g}|j�rIq1n|j�}|j�}|j�}|||<x|D]}|||j�<q~Wq1WdS(snGet active connections from NM
    @param connections return dict
    @param connections_name return dict
    N(	tclearRRtget_active_connectionstget_vpntget_idtget_uuidtget_devicest	get_iface(tconnectionstconnections_nametactive_connectionst
active_contnametuuidtdevicestdev((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyRxs




cCs�t�g}x�t�j�D]�}|j�r5qny6|j�}|j�tjjtjj	B@rjwnWn#t
k
r�|j�r�qq�nXx'|j�D]}|j
|j��q�WqW|S(sGGet active interfaces from NM
    @returns list of interface names
    (RRR'R(tget_connectionRR	RRRRRR+tappendR,(tactive_interfacesR0RR4((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pytnm_get_interfaces�s 


cCsLg}x?t�D]4}t|�}|t|�kr|j|�qqW|S(N(R8RRR6(R!t
interfacest	interfacetconn((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pytnm_get_interfaces_in_zone�scCs�t�t�j|�}|dkr)dS|j�}|dkrEdSy*|j�}|j�tjj	@rndSWn!t
k
r�|j�r�dSnX|j�S(s�Get connection from NM that is using the interface
    @param interface name
    @returns connection that is using interface or None
    N(
RRtget_device_by_ifaceRtget_active_connectionR5RR	RRRRR*(R:tdeviceR0R((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyR�s
cCsjts
dSy;tj�}|jtjtj�}|j}~~|SWnt	k
ret
jd�nXdS(Ns(Failed to get bus name of NetworkManager(R
Rtdbust	SystemBust
get_objectR	tDBUS_INTERFACEt	DBUS_PATHtbus_namet	ExceptionRtdebug2(tbustobjR1((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyR�s	
cCsts
dStjS(NR(R
R	RC(((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyR�s(!t__doc__t__all__tgit
gi.repositoryRtrequire_versiont
ValueErrorR"R
R	R%tImportErrortErrorRRtfirewallR
tfirewall.errorsRtfirewall.core.loggerRR@RRRRRRR8R<RRR(((s7/usr/lib/python2.7/site-packages/firewall/core/fw_nm.pyt<module>s>



												

ZeroDay Forums Mini