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_test.pyo
�
�c�`c@s�dgZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddl m!Z!ddl"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddlm+Z+ddl,m-Z-de.fd��YZ/dS(t
Firewall_testi����N(tconfig(t	functions(tFirewallIcmpType(tFirewallService(tFirewallZone(tFirewallDirect(tFirewallConfig(tFirewallPolicies(t
FirewallIPSet(tFirewallHelper(tlog(tfirewalld_conf(tDirect(tservice_reader(ticmptype_reader(tzone_readertZone(tipset_reader(tIPSET_TYPES(t
helper_reader(terrors(t
FirewallErrorcBs+eZd�Zd�Zd�Zd�Zeed�Zd�Zed�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zed�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!RS(cCs�ttj�|_t|_t|_t|_t|_t	|_
t|�|_t
|�|_t|�|_t|�|_t|�|_t�|_t|�|_t|�|_|j�dS(N(RRtFIREWALLD_CONFt_firewalld_conftFalsetip4tables_enabledtip6tables_enabledtebtables_enabledt
ipset_enabledRtipset_supported_typesRticmptypeRtserviceRtzoneRtdirectRRtpoliciesR	tipsetR
thelpert_Firewall_test__init_vars(tself((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt__init__8s					cCshd|j|j|j|j|j|j|j|j|j|j	|j
|j|j|j
|j|jfS(Ns>%s(%r, %r, %r, %r, %r, %r, %r, %r, %r, %r, %r, %r, %r, %r, %r)(t	__class__RRRt_statet_panict
_default_zonet_module_refcountt_markst	_min_marktcleanup_on_exittipv6_rpfilter_enabledRt_individual_callst_log_deniedt_automatic_helpers(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt__repr__LscCsyd|_t|_d|_i|_g|_tj|_tj	|_
tj|_tj
|_tj|_tj|_dS(NtINITt(R*RR+R,R-R.RtFALLBACK_MINIMAL_MARKR/tFALLBACK_CLEANUP_ON_EXITR0tFALLBACK_IPV6_RPFILTERR1tFALLBACK_INDIVIDUAL_CALLSR2tFALLBACK_LOG_DENIEDR3tFALLBACK_AUTOMATIC_HELPERSR4(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt__init_varsUs					cCs|jS(N(R2(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytindividual_callscsc
	Cstj}tjdtj�y|jj�Wntk
rMtjd�n X|jj	d�ru|jj	d�}n|jj	d�r�t
|jj	d��|_n|jj	d�r�|jj	d�}|dk	r�|j
�d-kr�t|_q�n|jj	d�rp|jj	d�}|dk	rp|j
�d.krptjd�y|jj�Wqmtk
riqmXqpn|jj	d�r�|jj	d�}|dk	r�|j
�d/kr�t|_n|j
�d0kr�t|_q�q�n|jr�tjd
�n
tjd�|jj	d�rf|jj	d�}|dk	rf|j
�d1krftjd�t|_qfn|jj	d�r�|jj	d�}|dks�|j
�dkr�d|_q�|j
�|_tjd|j�n|jj	d�rm|jj	d�}|dk	rm|j
�d2kr'd|_n-|j
�d3krEd	|_n|j
�|_tjd|j�qmn|jjtj|j��tjd�y|jjj�Wn]tk
r	}|jj�r�tjd|jjj|�q
tjd|jjj|�nX|jjtj|j��|j tj!d�|j tj"d�|j tj#d�|j tj$d�t%|j&j'��dkr�tjd�n|j tj(d�|j tj)d�|j tj*d�|j tj+d�t%|j,j-��dkrtjd�n|j tj.d�|j tj/d�t%|j0j1��dkrrtj2d �t3j4d!�nt}xEd"d#d$gD]4}||j0j1�kr�tj2d%|�t}q�q�W|r�t3j4d!�n||j0j1�krId&|j0j1�kr	d&}n$d'|j0j1�kr'd'}nd"}tjd(||�|}ntjd)|�t5tj6�}	t7j8j9tj6�r�tjd*tj6�y|	j�Wq�tk
r�}tjd+tj6|�q�Xn|jj:tj|	��|j;|�|_<d,|_=dS(4Ns"Loading firewalld config file '%s's0Using fallback firewalld configuration settings.tDefaultZonetMinimalMarkt
CleanupOnExittnotfalsetLockdowntyesttruesLockdown is enabledt
IPv6_rpfiltersIPv6 rpfilter is enabledsIPV6 rpfilter is disabledtIndividualCallssIndividualCalls is enabledt	LogDeniedtoffsLogDenied is set to '%s'tAutomaticHelperssAutomaticHelpers is set to '%s'sLoading lockdown whitelists*Failed to load lockdown whitelist '%s': %sR$RisNo icmptypes found.R%R sNo services found.R!sNo zones found.itblocktdropttrustedsZone '%s' is not available.tpublictexternals+Default zone '%s' is not valid. Using '%s'.sUsing default zone '%s'sLoading direct rules file '%s's)Failed to load direct rules file '%s': %stRUNNING(RCRD(syesRG(RCRD(syesRG(syesRG(RCRD(syesRG(>Rt
FALLBACK_ZONERtdebug1RRtreadt	ExceptiontwarningtgettintR/tNonetlowerRR0R#tenable_lockdownRR1tTrueR2R3R4tset_firewalld_conftcopytdeepcopytlockdown_whitelisttquery_lockdownterrortfilenametset_policiest_loadertFIREWALLD_IPSETStETC_FIREWALLD_IPSETStFIREWALLD_ICMPTYPEStETC_FIREWALLD_ICMPTYPEStlenRt
get_icmptypestFIREWALLD_HELPERStETC_FIREWALLD_HELPERStFIREWALLD_SERVICEStETC_FIREWALLD_SERVICESR tget_servicestFIREWALLD_ZONEStETC_FIREWALLD_ZONESR!t	get_zonestfataltsystexitR
tFIREWALLD_DIRECTtostpathtexistst
set_directt
check_zoneR,R*(
R'treloadtcomplete_reloadtdefault_zonetvaluetmsgRctzR!tobj((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt_startfs�	



	

	
		

			
			cCs|j�dS(N(R�(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytstartsc	Cstjj|�sdS|r�|jtj�r}|dkr}t�}tjj|�|_|j	|j�||_t
|_q�t
}nx�ttj
|��D]�}|jd�s|jtj�r�|dkr�tjjd||f�r�|jd||f|dt�q�q�nd||f}tjd||�y�|dkrt||�}|j|jj�kr�|jj|j�}tjd||j|j|j�|jj|j�n!|jjtj�r�t|_n|jj|�|jjtj|��n|dkr�t||�}|j|jj�kr�|jj|j�}tjd||j|j|j�|jj |j�n!|jjtj�r�t|_n|jj!|�|jj!tj|��n>|dkrht"||d	|�}|r@dtjj|�tjj|�d
d!f|_|j	|j�ntj|�}	|j|j#j$�kr�|j#j%|j�}|j#j&|j�|j'r�tjd||j||�|j(|�qtjd||j|j|j�n*|jjtj�rt|_t|	_n|jj)|	�|rUtjd||j||�|j(|�q|j#j)|�n�|d
kr5t*||�}|j|j+j,�kr�|j+j-|j�}tjd||j|j|j�|j+j.|j�n!|jjtj�r	t|_n|j+j/|�|jj/tj|��n�|dkrt0||�}|j|j1j2�kr�|j1j3|j�}tjd||j|j|j�|j1j4|j�n!|jjtj�r�t|_n|j1j5|�|jj5tj|��ntj6d|�Wq�t7k
r>}
tj8d|||
�q�t9k
rktj8d||�tj:�q�Xq�W|r|j'r|j|j#j$�kr|j#j%|j�}tjd||j|j|j�y|j#j&|j�WnnX|jj;|j�n|j#j)|�ndS(NR!s.xmls%s/%stcombinesLoading %s file '%s'Rs  Overloads %s '%s' ('%s/%s')R t
no_check_nameii����s  Combining %s '%s' ('%s/%s')R$R%sUnknown reader type %ssFailed to load %s file '%s': %ssFailed to load %s file '%s':s0  Overloading and deactivating %s '%s' ('%s/%s')(<RyRztisdirt
startswithRt
ETC_FIREWALLDRtbasenametnamet
check_nameRtdefaulttsortedtlistdirtendswithRfR]RRTRRRltget_icmptypeRdtremove_icmptypetadd_icmptypeR_R`RR Rqtget_servicetremove_servicetadd_serviceRR!Rttget_zonetremove_zonetcombinedR�tadd_zoneRR$t
get_ipsetst	get_ipsettremove_ipsett	add_ipsetRR%tget_helperst
get_helpert
remove_helpert
add_helperRuRRcRVt	exceptiontforget_zone(R'Rztreader_typeR�t
combined_zoneRdR�R�torig_objt
config_objR�((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyRfs�			


 			
	
			




	
cCs�|jj�|jj�|jj�|jj�|jj�|jj�|jj�|jj�|j	j�|j
�dS(N(RtcleanupR R!R$R%RR"R#RR&(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR��s








cCs|j�dS(N(R�(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytstop�scCsdS(N((R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytcheck_panic�scCsV|}|s|dkr(|j�}n||jj�krRttj|��n|S(NR7(tget_default_zoneR!RtRRtINVALID_ZONE(R'R!t_zone((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR}�scCs(tj|�s$ttj|��ndS(N(RtcheckInterfaceRRtINVALID_INTERFACE(R't	interface((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytcheck_interface�scCs|jj|�dS(N(R t
check_service(R'R ((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR��scCstj|�}|dksY|dksY|dksYt|�dkr|d|dkr|dkrytjd|�nz|dkr�tjd|�nZ|dkr�tjd|�n:t|�dkr�|d|dkr�tjd	|�nttj|��ndS(
Ni����i����iiis'%s': port > 65535s'%s': port is invalids'%s': port is ambiguouss'%s': range start >= end(	RtgetPortRangeRZRkRRTRRtINVALID_PORT(R'tporttrange((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt
check_port�s$&&cCsA|sttj��n|dkr=ttjd|��ndS(Nttcptudptsctptdccps''%s' not in {'tcp'|'udp'|'sctp'|'dccp'}(R�R�R�R�(RRtMISSING_PROTOCOLtINVALID_PROTOCOL(R'tprotocol((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytcheck_tcpudp�s	cCs(tj|�s$ttj|��ndS(N(RtcheckIPRRtINVALID_ADDR(R'tip((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytcheck_ip�scCs||dkr3tj|�sxttj|��qxnE|dkrftj|�sxttj|��qxnttjd��dS(Ntipv4tipv6s'%s' not in {'ipv4'|'ipv6'}(RtcheckIPnMaskRRR�t
checkIP6nMasktINVALID_IPV(R'tipvtsource((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt
check_address�s	cCs|jj|�dS(N(Rtcheck_icmptype(R'ticmp((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR��scCsdS(N((R'R�((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR~�scCs|jS(N(R*(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt	get_state�scCsdS(N((R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytenable_panic_mode�scCsdS(N((R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytdisable_panic_mode�scCs|jS(N(R+(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytquery_panic_mode�scCs|jS(N(R3(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytget_log_denied�scCs�|tjkr:ttjd|djtj�f��n||j�kr�||_|jj	d|�|jj
�|j�nttj|��dS(Ns'%s', choose from '%s's','RJ(
RtLOG_DENIED_VALUESRRt
INVALID_VALUEtjoinR�R3RtsettwriteR~tALREADY_SET(R'R�((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytset_log_denied�s		

cCs|jS(N(R4(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytget_automatic_helpersscCs�|tjkr:ttjd|djtj�f��n||j�kr�||_|jj	d|�|jj
�|j�nttj|��dS(Ns'%s', choose from '%s's','RL(
RtAUTOMATIC_HELPERS_VALUESRRR�R�R�R4RR�R�R~R�(R'R�((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytset_automatic_helperss		

cCs|jS(N(R,(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR�scCs`|j|�}||jkrJ||_|jjd|�|jj�nttj|��dS(NR@(R}R,RR�R�RRtZONE_ALREADY_SET(R'R!R�((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytset_default_zones	cCs$|jjdd�|jj�dS(NRERF(RR�R�(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR\(scCs$|jjdd�|jj�dS(NRERC(RR�R�(R'((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pytdisable_lockdown,s("t__name__t
__module__R(R5R&R?RR�R�RfR�R�R�R}R�R�R�R�R�R�R�R~R�R�R�R�R�R�R�R�R�R�R\R�(((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyR7s>					�	�																						(0t__all__tos.pathRyRvR_tfirewallRRtfirewall.core.fw_icmptypeRtfirewall.core.fw_serviceRtfirewall.core.fw_zoneRtfirewall.core.fw_directRtfirewall.core.fw_configRtfirewall.core.fw_policiesRtfirewall.core.fw_ipsetR	tfirewall.core.fw_helperR
tfirewall.core.loggerRtfirewall.core.io.firewalld_confRtfirewall.core.io.directR
tfirewall.core.io.serviceRtfirewall.core.io.icmptypeRtfirewall.core.io.zoneRRtfirewall.core.io.ipsetRtfirewall.core.ipsetRtfirewall.core.io.helperRRtfirewall.errorsRtobjectR(((s9/usr/lib/python2.7/site-packages/firewall/core/fw_test.pyt<module>s2	

ZeroDay Forums Mini