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/io/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyc
�
�c�`c@sadZddddddddgZd	d
ljZd	d
ljjZd	d
lZd	d
lZd	dlm	Z	d	dl
mZd	d
lmZd	dl
mZejdkZdefd��YZdefd��YZdefd��YZdefd��YZdejjfd��YZdejfd��YZd�Zd�Zd�Zd�Zd
S(s5Generic io_object handler, io specific check methods.tPY2t	IO_ObjecttIO_Object_ContentHandlertIO_Object_XMLGeneratort
check_porttcheck_tcpudptcheck_protocolt
check_addressi����N(t	functions(tb2u(terrors(t
FirewallErrort3cBsteZdZd
ZdZgZiZiZd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�ZRS(s; Abstract IO_Object as base for icmptype, service and zone s()cCs1d|_d|_d|_t|_t|_dS(Nt(tfilenametpathtnametFalsetdefaulttbuiltin(tself((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt__init__1s
				cCsGg}x4|jD])}|jtjt||d���qWt|�S(Ni(tIMPORT_EXPORT_STRUCTUREtappendtcopytdeepcopytgetattrttuple(Rtrettx((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
export_config8s'cCs�|j|�x�t|j�D]�\}\}}t||t�r�g}t�}x;||D]/}||kr\|j|�|j|�q\q\W~t||t	j
|��qt||t	j
||��qWdS(N(tcheck_configt	enumerateRt
isinstancetlisttsetRtaddtsetattrRR(Rtconftitelementtdummyt_conft_setR((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
import_config>s
"	
cCs�t|t�s=ttjd|td�t|�f��nt|�dkrdttjd��nxI|D]A}|j�rk||j	krkttjd||f��qkqkWdS(Ns'%s' not of type %s, but %sR
isname can't be emptys'%s' is not allowed in '%s'(
R!tstrRR
tINVALID_TYPEttypetlentINVALID_NAMEtisalnumtADDITIONAL_ALNUM_CHARS(RRtchar((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
check_nameNs	
cCs�t|�t|j�krIttjdt|�t|j�f��nxKt|j�D]:\}\}}|j|||�|j|||�qYWdS(Ns structure size mismatch %d != %d(R0RRR
R.R t_check_config_structuret
_check_config(RR&R'R(tvalue((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR[s""cCsdS(N((Rtdummy1tdummy2((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR7esc	Cst|�t|�ksFttjd|t|�t|�f��nt|t�r�t|�dkr�ttjd|��nx||D]}|j||d�q�WnWt|t�r(t|�t|�kr�ttjd|t|�f��nxt	|�D] \}}|j|||�qWn�t|t
�r�t|j��d\}}x�|j�D]�\}}t|�t|�kr�ttjd|t|�t|�f��nt|�t|�kr`ttjd|t|�t|�f��q`q`WndS(Ns'%s' not of type %s, but %sislen('%s') != 1islen('%s') != %d(R/RR
R.R!R"R0R6RR tdicttitems(	RR&t	structureRR'R8tskeytsvaluetkey((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR6is8	"	
		"	cCs,|j�}t}||jkr�t}|j|dk	r�xP|j|D]>}||krj|j|�qHttjd||f��qHWq�n||j	kr�t}x4|j	|D]"}||kr�|j|�q�q�Wn|s�ttjd|��nx*|D]"}ttjd||f��qWdS(NsMissing attribute %s for %ssUnexpected element %ss%s: Unexpected attribute %s(
tgetNamesRtPARSER_REQUIRED_ELEMENT_ATTRStTruetNonetremoveRR
tPARSE_ERRORtPARSER_OPTIONAL_ELEMENT_ATTRS(RRtattrst_attrstfoundR((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pytparser_check_element_attrs�s,	
	((t__name__t
__module__t__doc__RtDBUS_SIGNATURER3RBRGRRR,R5RR7R6RK(((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR(s				
	
		!tUnexpectedElementErrorcBseZd�Zd�ZRS(cCs tt|�j�||_dS(N(tsuperRPRR(RR((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR�scCsd|jS(NsUnexpected element '%s'(R(R((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt__str__�s(RLRMRRR(((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRP�s	tMissingAttributeErrorcBseZd�Zd�ZRS(cCs)tt|�j�||_||_dS(N(RQRSRRt	attribute(RRRT((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR�s	cCsd|j|jfS(Ns$Element '%s': missing '%s' attribute(RRT(R((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRR�s(RLRMRRR(((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRS�s	tUnexpectedAttributeErrorcBseZd�Zd�ZRS(cCs)tt|�j�||_||_dS(N(RQRURRRT(RRRT((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR�s	cCsd|j|jfS(Ns'Element '%s': unexpected attribute '%s'(RRT(R((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRR�s(RLRMRRR(((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRU�s	cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs||_d|_dS(NR
(titemt_element(RRV((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR�s	cCs
d|_dS(NR
(RW(R((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
startDocument�scCs
d|_dS(NR
(RW(RRRH((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pytstartElement�scCs@|dkr|j|j_n|dkr<|j|j_ndS(Ntshorttdescription(RWRVRZR[(RR((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
endElement�scCs|j|jdd�7_dS(Ns
t (RWtreplace(Rtcontent((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
characters�s(RLRMRRXRYR\R`(((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR�s
				cBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsotjjj|�|j|_|j|_ig|_|jd|_	g|_
d|_t|_
t|_dS(Ni����sutf-8(tsaxthandlertContentHandlerRtwritet_writetflusht_flusht_ns_contextst_current_contextt_undeclared_ns_mapst	_encodingRt_pending_start_elementt_short_empty_elements(Rtout((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR�s			cCs9trd�|j�D�}ntjj|||�dS(s saxutils.XMLGenerator.startElement() expects name and attrs to be
            unicode and bad things happen if any of them is (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        cSs+i|]!\}}t|�t|��qS((R	(t.0RR8((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pys
<dictcomp>�s	N(RR<tsaxutilstXMLGeneratorRY(RRRH((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRY�scCs�trv|jdt|��xF|j�D]8\}}|jdt|�tjt|��f�q*W|jd�n[|jd|�x:|j�D],\}}|jd|tj|�f�q�W|jd�dS(s* slightly modified startElement()
        u<u %s=%su/>t<s %s=%ss/>N(RReR	R<Rpt	quoteattr(RRRHR8((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
simpleElement�s$cCstjj|t|��dS(s� saxutils.XMLGenerator.endElement() expects name to be
            unicode and bad things happen if it's (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        N(RpRqR\R	(RR((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR\�scCstjj|t|��dS(s� saxutils.XMLGenerator.characters() expects content to be
            unicode and bad things happen if it's (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        N(RpRqR`R	(RR_((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR`scCstjj|t|��dS(s saxutils.XMLGenerator.ignorableWhitespace() expects content to be
            unicode and bad things happen if it's (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        N(RpRqtignorableWhitespaceR	(RR_((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRus(RLRMRRYRtR\R`Ru(((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR�s		
			cCs�tj|�}|dkr4ttjd|��n�|dkrYttjd|��nd|dkr~ttjd|��n?t|�dkr�|d|dkr�ttjd|��ndS(	Ni����sport number in '%s' is too bigi����s'%s' is invalid port rangesport range '%s' is ambiguousiii(RtgetPortRangeRR
tINVALID_PORTRDR0(tportt
port_range((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRs			&	cCs)|dkr%ttjd|��ndS(Nttcptudptsctptdccps)'%s' not from {'tcp'|'udp'|'sctp'|'dccp'}(RzR{R|R}(RR
tINVALID_PROTOCOL(tprotocol((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR&s	cCs(tj|�s$ttj|��ndS(N(Rt
checkProtocolRR
R~(R((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR,scCs5tj||�s1ttjd||f��ndS(Ns'%s' is not valid %s address(RRRR
tINVALID_ADDR(tipvtaddr((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR0s	( RNt__all__txml.saxRatxml.sax.saxutilsRpRtsystfirewallRtfirewall.functionsR	R
tfirewall.errorsRtversionRtobjectRt	ExceptionRPRSRURbRcRRqRRRRR(((s>/usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt<module>s,			C			

ZeroDay Forums Mini