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/helper.pyo
�
�c�`c@sdddgZddljZddlZddlZddlZddlmZddlm	Z	ddl
mZmZm
Z
mZmZmZddlmZdd	lmZdd
lmZdefd��YZde
fd
��YZd�Zdd�ZdS(tHelpert
helper_readert
helper_writeri����N(tconfig(t
u2b_if_py2(tPY2t	IO_ObjecttIO_Object_ContentHandlertIO_Object_XMLGeneratort
check_porttcheck_tcpudp(tlog(terrors(t
FirewallErrorcBs�eZdddddddgffZdZdd	gZidd6dd6dgd
6Zidddgd
6dd
gd6Zd�Zd�Z	d�Z
d�Zd�ZRS(tversionttshorttdescriptiontfamilytmoduletportss(sssssa(ss))t-t.thelpertnametporttprotocolcCsMtt|�j�d|_d|_d|_d|_d|_g|_dS(NR(	tsuperRt__init__RRRRRR(tself((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyR;s					cCs8d|_d|_d|_d|_d|_|j2dS(NR(RRRRRR(R((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pytcleanupDs					cCs�t|j�|_t|j�|_t|j�|_t|j�|_t|j�|_g|jD]$\}}t|�t|�f^qd|_dS(s� HACK. I haven't been able to make sax parser return
            strings encoded (because of python 2) instead of in unicode.
            Get rid of it once we throw out python 2 support.N(RRRRRRR(Rtpotpr((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pytencode_stringsLscCs;ddg}||kr7ttjd||f��ndS(Ntipv4tipv6s'%s' not in '%s'(R
RtINVALID_IPV(Rtipvtipvs((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyt	check_ipvWs	cCs�|dkr<x�|D]"}t|d�t|d�qWnn|dkr�|jd�spttjd|��nt|jdd��dkr�ttjd|��q�ndS(	NRiiRt
nf_conntrack_s('%s' does not start with 'nf_conntrack_'RsModule name '%s' too short(R	R
t
startswithR
RtINVALID_MODULEtlentreplace(RRtitemR((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyt
_check_config]s
	(sversionR(sshortR(sdescriptionR(sfamilyR(smoduleR(RRN(
t__name__t
__module__tIMPORT_EXPORT_STRUCTUREtDBUS_SIGNATUREtADDITIONAL_ALNUM_CHARStNonetPARSER_REQUIRED_ELEMENT_ATTRStPARSER_OPTIONAL_ELEMENT_ATTRSRRR!R'R.(((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyR&s(
					thelper_ContentHandlercBseZd�ZRS(cCs�tj|||�|jj||�|dkrd|krQ|d|j_nd|kr�|jj|d�|d|j_nd|kr�|djd�s�tt	j
d|d��nt|djdd��dkr�tt	j
d	|d��n|d|j_
q�n�|d
kr$n�|dkr3n�|dkr�t|d�t|d
�|d|d
f}||jjkr�|jjj|�q�tjd|d|d
�ndS(NRRRRR(s('%s' does not start with 'nf_conntrack_'RisModule name '%s' too shortRRRRs#Port '%s/%s' already set, ignoring.(RtstartElementR-tparser_check_element_attrsRR'RR)R
RR*R+R,RR	R
RtappendRtwarning(RRtattrstentry((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyR8ns>"	(R/R0R8(((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyR7msc		CsYt�}|jd�s1ttjd|��n|d |_|j|j�||_||_|j	t
j�rxtnt
|_|j|_t|�}tj�}|j|�d||f}t|d��i}tjd�}|j|�y|j|�Wn2tjk
r5}ttjd|j���nXWdQX~~trU|j�n|S(Ns.xmls'%s' is missing .xml suffixi����s%s/%strbsnot a valid helper file: %s(RtendswithR
RtINVALID_NAMERt
check_nametfilenametpathR)Rt
ETC_FIREWALLDtFalsetTruetbuiltintdefaultR7tsaxtmake_parsertsetContentHandlertopentInputSourceR4t
setByteStreamtparsetSAXParseExceptiontINVALID_HELPERtgetExceptionRR!(	RBRCRthandlertparserRtftsourcetmsg((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyR�s8		
		!

	
c
Cs|r|n|j}|jr4d||jf}nd||jf}tjj|�r�ytj|d|�Wq�tk
r�}tj	d||�q�Xntjj
|�}|jtj
�rtjj|�rtjjtj
�s�tjtj
d�ntj|d�ntj|dddd	�}t|�}|j�i}|j|d
<|jr~|jdkr~|j|d<n|jr�|jdkr�|j|d
<n|jd|�|jd�|jr%|jdkr%|jd�|jdi�|j|j�|jd�|jd�n|jr�|jdkr�|jd�|jdi�|j|j�|jd�|jd�nxQ|jD]F}	|jd�|jdi|	dd6|	dd6�|jd�q�W|jd�|jd�|j�|j�~dS(Ns%s/%ss	%s/%s.xmls%s.oldsBackup of file '%s' failed: %si�tmodetwttencodingsUTF-8RRRRRs
s  RRRiiR( RCRBRtostexiststshutiltcopy2t	ExceptionRterrortdirnameR)RRDtmkdirtioRLRt
startDocumentRRRR8tignorableWhitespaceRt
characterst
endElementRRt
simpleElementtendDocumenttclose(
RRCt_pathRRWtdirpathRURSR<R((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyR�s\	%







&



(t__all__txml.saxRIR[RcR]tfirewallRtfirewall.functionsRtfirewall.core.io.io_objectRRRRR	R
tfirewall.core.loggerRRtfirewall.errorsR
RR7RR4R(((s;/usr/lib/python2.7/site-packages/firewall/core/io/helper.pyt<module>s.G#	

ZeroDay Forums Mini