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/rich.pyo
�
�c�`c@sdddddddddd	d
ddd
ddddgZddlmZddlmZddlmZddlmZddlm	Z	de
fd��YZde
fd��YZde
fd��YZ
de
fd��YZdefd��YZde
fd��YZde
fd��YZde
fd��YZde
fd ��YZd	e
fd!��YZd
e
fd"��YZde
fd#��YZde
fd$��YZd
e
fd%��YZdefd&��YZde
fd'��YZde
fd(��YZde
fd)��YZd*S(+tRich_SourcetRich_DestinationtRich_Servicet	Rich_Portt
Rich_ProtocoltRich_MasqueradetRich_IcmpBlockt
Rich_IcmpTypetRich_SourcePorttRich_ForwardPorttRich_Logt
Rich_AudittRich_AccepttRich_Rejectt	Rich_Dropt	Rich_Markt
Rich_Limitt	Rich_Rulei����(t	functions(tcheck_ipset_name(tREJECT_TYPES(terrors(t
FirewallErrorcBseZed�Zd�ZRS(cCs�||_|jdkr$d|_n||_|jdksK|jdkrWd|_n$|jdk	r{|jj�|_n||_|jdkr�d|_n||_|jdkr�|jdkr�|jdkr�ttjd��ndS(Ntsno address, mac and ipset(	taddrtNonetmactuppertipsettinvertRRtINVALID_RULE(tselfRRRR((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyt__init__$s				-	cCs�d|jrdnd}|jdk	r7|d|jS|jdk	rU|d|jS|jdk	rs|d|jSttjd��dS(Ns	source%s s NOTRsaddress="%s"smac="%s"s
ipset="%s"sno address, mac and ipset(RRRRRRRR(Rtret((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyt__str__5s	(t__name__t
__module__tFalseR R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR#scBseZed�Zd�ZRS(cCs||_||_dS(N(RR(RRR((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR Bs	cCs d|jrdnd|jfS(Nsdestination %saddress="%s"snot R(RR(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"Fs(R#R$R%R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRAscBseZd�Zd�ZRS(cCs
||_dS(N(tname(RR&((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR KscCsd|jS(Nsservice name="%s"(R&(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"Ns(R#R$R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRJs	cBseZd�Zd�ZRS(cCs||_||_dS(N(tporttprotocol(RR'R(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR Rs	cCsd|j|jfS(Nsport port="%s" protocol="%s"(R'R((R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"Vs(R#R$R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRQs	cBseZd�ZRS(cCsd|j|jfS(Ns#source-port port="%s" protocol="%s"(R'R((R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"Zs	(R#R$R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRYscBseZd�Zd�ZRS(cCs
||_dS(N(tvalue(RR)((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR _scCsd|jS(Nsprotocol value="%s"(R)(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"bs(R#R$R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR^s	cBseZd�Zd�ZRS(cCsdS(N((R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR fscCsdS(Nt
masquerade((R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"is(R#R$R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRes	cBseZd�Zd�ZRS(cCs
||_dS(N(R&(RR&((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR mscCsd|jS(Nsicmp-block name="%s"(R&(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"ps(R#R$R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRls	cBseZd�Zd�ZRS(cCs
||_dS(N(R&(RR&((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR tscCsd|jS(Nsicmp-type name="%s"(R&(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"ws(R#R$R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRss	cBseZd�Zd�ZRS(cCs^||_||_||_||_|jdkr?d|_n|jdkrZd|_ndS(NR(R'R(tto_portt
to_addressR(RR'R(R+R,((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR {s				cCsRd|j|j|jdkr+d|jnd|jdkrJd|jndfS(Ns(forward-port port="%s" protocol="%s"%s%sRs
 to-port="%s"s
 to-addr="%s"(R'R(R+R,(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�s(R#R$R R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR	zs	cBs#eZdddd�Zd�ZRS(cCs||_||_||_dS(N(tprefixtleveltlimit(RR-R.R/((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR �s		cCsSd|jrd|jnd|jr2d|jnd|jrKd|jndfS(Ns	log%s%s%ss prefix="%s"Rs level="%s"s %s(R-R.R/(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�sN(R#R$RR R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR
�scBseZdd�Zd�ZRS(cCs
||_dS(N(R/(RR/((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR �scCsd|jrd|jndS(Nsaudit%ss %sR(R/(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�sN(R#R$RR R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR�scBseZdd�Zd�ZRS(cCs
||_dS(N(R/(RR/((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR �scCsd|jrd|jndS(Nsaccept%ss %sR(R/(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�sN(R#R$RR R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR�scBs)eZddd�Zd�Zd�ZRS(cCs||_||_dS(N(ttypeR/(Rt_typeR/((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR �s	cCs:d|jrd|jnd|jr2d|jndfS(Ns
reject%s%ss
 type="%s"Rs %s(R0R/(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�scCs|jr{|s$ttjd��n|dkr{|jt|kr{djt|�}ttjd|j|f��q{ndS(Ns9When using reject type you must specify also rule family.tipv4tipv6s, s%Wrong reject type %s.
Use one of: %s.(R2R3(R0RRRRtjoin(Rtfamilytvalid_types((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pytcheck�s	N(R#R$RR R"R7(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR
�s	cBseZd�ZRS(cCsd|jrd|jndS(Nsdrop%ss %sR(R/(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�s(R#R$R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR�scBs&eZdd�Zd�Zd�ZRS(cCs||_||_dS(N(tsetR/(Rt_setR/((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR �s	cCs'd|j|jrd|jndfS(Ns
mark set=%s%ss %sR(R8R/(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�s	cCs�|jdk	r|j}nttjd��d|kr�|jd�}t|�dkrottj|��ntj|d�s�tj|d�r�ttj|��q�n$tj|�s�ttj|��ndS(Nsno value sett/iii(	R8RRRtINVALID_MARKtsplittlenRtcheckUINT32(Rtxtsplits((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR7�sN(R#R$RR R"R7(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR�s	cBs,eZd�Zd�Zd�Zd�ZRS(cCsu||_d|jkrq|jjd�}t|�dkrq|dd
krqd|d	|dd f|_qqndS(NR:iitsecondtminutethourtdays%s/%si(RARBRCRD(R)R<R=(RR)R@((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR �s	cCs�d}d|jkr*|jjd�}n|sCt|�dkr[ttj|j��n|\}}yt|�}Wnttj|j��nX|dks�|dkr�ttj|j��nd}|dkr�d}n?|dkr�d}n*|dkrd}n|dkr d}nd
||dkrPttjd|j��n|dkr�|dkr�ttjd
|j��ndS(NR:iitstmthtdi<ii'is%s too fasts%s too slow(RERFRGRHii�i�Q(RR)R<R=RRt
INVALID_LIMITtint(RR@tratetdurationtmult((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR7�s6						cCsd|jS(Nslimit value="%s"(R)(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"scCsdS(NR((R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pytcommand	s(R#R$R R7R"RN(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR�s		"	cBs;eZddd�Zd�Zd�Zd�Zd�ZRS(cCsw|dk	rt|�|_n	d|_d|_d|_d|_d|_d|_d|_|rs|j	|�ndS(N(
RtstrR5tsourcetdestinationtelementtlogtaudittactiont_import_from_string(RR5trule_str((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR 
s							cCs�g}x�tj|�D]�}d|kr�|jd�}t|�dks_|ds_|drxttjd|��n|ji|dd6|dd6�q|ji|d6�qW|jid	d6�|S(
s Lexical analysis t=iiisinternal error in _lexer(): %st	attr_namet
attr_valueRRtEOL(Rt	splitArgsR<R=RRRtappend(RRWttokenstrtattr((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyt_lexers(	&cCs�
|sttjd��nd|_d|_d|_d|_d|_d|_	d|_
|j|�}|r�|djd�dkr�ttjd��ni}g}d}x
||jd�dko�|dgks�
||jd�}||jd�}||jd�}|rA|d?kr|ttjd|��q|n;|d@krf|dkrw|jrwttjd)��q||dkr�|jr�ttjd*��q||dAkr�|jr�ttjd+||jf��q||d kr|jrttjd,��q||d!kr,|j	r,ttjd-��q||dBkr||j
r|ttjd.||j
f��q|nttjd/|��t
|�dkr�|t
|�d0nd1}	|	d1kr<|r|r|dkr�ttjd2��q9ttjd3||f��q�
d|kr,ttjd4||f��q�
|jd�nx|	dkr�|dkr�|dCkryttjd7|��n||_q�
|r�|dkr�d8}
nd9||f}
ttj|
��q�
|j|�n�|	dkrs|dDkr�|||<q�
|dEkrt|d<q�
t|jd	�|jd
�|jd�|jdt��|_|j�|j�|d0}nA|	dkr�|dFkr�|||<q�
|dGkr�t|d<q�
t|jd	�|jd��|_|j�|j�|d0}n�|	dkr?|d
kr*t|�|_|j�q�
ttjd:��nu|	dkr�|dkrst|�|_|j�q�
ttjd;��n,|	dkr�|dHkr�|||<q�
t|jd�|jd��|_|j�|j�|d0}n�|	dkr;|dkr&t|�|_|j�q�
ttjd<��ny|	dkr�|dkrot|�|_|j�q�
ttjd=��n0|	dkr�t�|_|j�|j�|d0}n�|	dkr?|dIkr�|||<q�
t|jd�|jd�|jd�|jd��|_|j�|j�|d0}nu|	dkr�|dJkrd|||<q�
t|jd�|jd��|_|j�|j�|d0}n|	d kr;|dKkr�|||<q�
|d&kr�|jd&�q�
t|jd�|jd�|jd&��|_|j�|j�|d0}ny|	d!kr�|d&krc|jd&�q�
t|jd&��|_	|j�|j�|d0}n|	d"kr�|d&kr�|jd&�q�
t|jd&��|_
|j�|j�|d0}n�|	d#kr^	|d&kr%	|jd&�q�
t |jd&��|_
|j�|j�|d0}nV|	d$kr�	|dkr�	|||<q�
|d&kr�	|jd&�q�
t!|jd�|jd&��|_
|j�|j�|d0}n�|	d%krj
|dkr	
|||<q�
|d&kr%
|jd&�q�
t"|jd�|jd&��|_
|j�|j�|d0}nJ|	d&kr�
|d
kr�
t#|�|d&<|j�q�
ttjd>��n|d0}q�W|j$�dS(LNs
empty ruleiRRR[truleRYRZR5taddressRRRR)R'R(sto-portsto-addrR&R-R.R0R8sbad attribute '%s'RPRQtservices
icmp-blocks	icmp-typeR*sforward-portssource-portRSRTtaccepttdroptrejecttmarkR/tnottNOTsmore than one 'source' elements#more than one 'destination' elementsFmore than one element. There cannot be both '%s' and '%s' in one rule.smore than one 'log' elementsmore than one 'audit' elementsOmore than one 'action' element. There cannot be both '%s' and '%s' in one rule.sunknown element %siRs0'family' outside of rule. Use 'rule family=...'.s:'%s' outside of any element. Use 'rule <element> %s= ...'.s,'%s' outside of rule. Use 'rule ... %s ...'.R2R3sH'family' attribute cannot have '%s' value. Use 'ipv4' or 'ipv6' instead.sdwrong 'protocol' usage. Use either 'rule protocol value=...' or  'rule [forward-]port protocol=...'.sDattribute '%s' outside of any element. Use 'rule <element> %s= ...'.sinvalid 'protocol' elementsinvalid 'service' elementsinvalid 'icmp-block' elementsinvalid 'icmp-type' elementsinvalid 'limit' element(sfamilyRcsmacsipsetsinvertsvaluesportsprotocolsto-portsto-addrsnamesprefixslevelstypesset(RbssourcesdestinationsprotocolRdsports
icmp-blocks	icmp-types
masqueradesforward-portssource-portslogsauditReRfRgsmarkslimitRiRjsEOL(sprotocolRdsports
icmp-blocks	icmp-types
masqueradesforward-portssource-port(ReRfRgsmark(sipv4sipv6(Rcsmacsipsetsinvert(RiRj(Rcsinvert(RiRj(sportsprotocol(sportsprotocolsto-portsto-addr(sportsprotocol(sprefixslevel(%RRRRR5RPRQRRRSRTRURatgetR=R]tTrueRR%tpoptclearRRRRRRRR	RR
RRRR
RRR7(RRWR^tattrstin_elementstindexRRRYRZt
in_elementterr_msg((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRV.st							+		"%,
	

?




$





$








<



$



0












$







cCs�	|jdk	r6|jdkr6ttj|j��n|jdkr�|jdk	rf|jjdk	su|jdk	r�ttj��nt	|j
�tkr�ttj��q�n|j
dkr|jdkr�ttj
d��n|jdkr|jdkrttj
d��qnt	|j
�tttgkr}|jdkr}|jdkr}|jdkr}ttj
d��q}n|jdk	r|jjdk	rL|jdkr�ttj��n|jjdk	r�ttj
d��n|jjdk	r
ttj
d��ntj|j|jj�sttjt|jj���qq|jjdk	r�|jjdk	r�ttj
d��ntj|jj�sttjt|jj���qq|jjdk	rt|jj�sttjt|jj���qqttj
d	��n|jdk	r�|jdkrKttj��n|jjdksytj|j|jj�r�ttjt|jj���q�nt	|j
�tkr|j
jdks�t|j
j�d
kr>ttjt|j
j���q>n>t	|j
�t krutj!|j
j"�sEttj#|j
j"��n|j
j$dkr>ttj%|j
j$��q>n�t	|j
�t&kr�tj'|j
j(�s>ttj%|j
j(��q>n�t	|j
�tkr/|jdk	r�ttj
d��n|jdk	r>|jjdk	r>ttj
d��q>nt	|j
�tkr�|j
jdksnt|j
j�d
kr�ttj)t|j
j���n|jr>ttj
d��q>n�t	|j
�t*kr|j
jdks�t|j
j�d
kr>ttj)t|j
j���q>n+t	|j
�tkr�tj!|j
j"�sXttj#|j
j"��n|j
j$dkr�ttj%|j
j$��n|j
j+dkr�|j
j,dkr�ttj#|j
j+��n|j
j+dkrtj!|j
j+�rttj#|j
j+��n|j
j,dkrPtj-|j|j
j,�rPttj|j
j,��n|jdkrqttj��n|jdk	r>ttj
d��q>n�t	|j
�t.kr
tj!|j
j"�s�ttj#|j
j"��n|j
j$d kr>ttj%|j
j$��q>n1|j
dk	r>ttj
dt	|j
���n|jdk	r�|jj/r�|jj/d!kr�ttj0|jj/��n|jj1dk	r�|jj1j2�q�n|jdk	r!	t	|j�t3t4t5gkr�ttj6t	|j���n|jj1dk	r!	|jj1j2�q!	n|jdk	r�	t	|j�t4kr[	|jj2|j�n%t	|j�t7kr�	|jj2�n|jj1dk	r�	|jj1j2�q�	ndS("NR2R3sno element, no actions%no element, no source, no destinationsno action, no log, no auditsaddress and macsaddress and ipsets
mac and ipsetsinvalid sourceittcptudptsctptdccpsmasquerade and actionsmasquerade and mac sourcesicmp-block and actionRsforward-port and actionsUnknown element %stemergtalerttcritterrortwarningtnoticetinfotdebug(sipv4sipv6(RtRuRvRw(RtRuRvRw(RtRuRvRw(RxRyRzserrorR|R}sinfosdebug(8R5RRRtINVALID_FAMILYRPRRQtMISSING_FAMILYR0RRR	RURRRRSRTRRRt
check_addresstINVALID_ADDRROt	check_mactINVALID_MACRt
INVALID_IPSETRR&R=tINVALID_SERVICERt
check_portR'tINVALID_PORTR(tINVALID_PROTOCOLRt
checkProtocolR)tINVALID_ICMPTYPERR+R,tcheck_single_addressRR.tINVALID_LOG_LEVELR/R7RR
RtINVALID_AUDIT_TYPER(R((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR7	s�!$$$$*$!*!	*$$		cCs�d}|jr#|d|j7}n|jr@|d|j7}n|jr]|d|j7}n|jrz|d|j7}n|jr�|d|j7}n|jr�|d|j7}n|jr�|d|j7}ntjr�tj	|�S|S(NRbs family="%s"s %s(
R5RPRQRRRSRTRURtPY2tu2b(RR!((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyR"�s 							N(R#R$RR RaRVR7R"(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyRs
		�	�N(t__all__tfirewallRtfirewall.core.ipsetRtfirewall.core.baseRRtfirewall.errorsRtobjectRRRRRRRRRR	R
RRR
RRRR(((s6/usr/lib/python2.7/site-packages/firewall/core/rich.pyt<module>s8		
1

ZeroDay Forums Mini