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_transaction.pyo
�
�c�`c@s�dZddgZddlmZddlmZddlmZddlm	Z	de
fd	��YZdefd
��YZdefd��YZ
dS(
s!Transaction classes for firewalldtFirewallTransactiontFirewallZoneTransactioni����(tlog(terrors(t
FirewallError(tLastUpdatedOrderedDicttSimpleFirewallTransactioncBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zddd
�Z
d�Zd�Zd
�ZRS(s>Base class for FirewallTransaction and FirewallZoneTransactioncCs1||_i|_g|_g|_g|_dS(N(tfwtrulest	pre_funcst
post_funcst
fail_funcs(tselfR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt__init__"s
				cCs&|jj�|j2|j2|j2dS(N(RtclearR	R
R(R((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR)s
cCs#|jj|jg�j|�dS(N(Rt
setdefaulttnametappend(Rtbackendtrule((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytadd_rule/scCs%x|D]}|j||�qWdS(N(R(RRRR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt	add_rules2s
cCs&|j|jko%||j|jkS(N(RR(RRR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt
query_rule6scCsF|j|jkrB||j|jkrB|j|jj|�ndS(N(RRtremove(RRR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytremove_rule9s(cGs|jj||f�dS(N(R	R(Rtfunctargs((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytadd_pre=scGs|jj||f�dS(N(R
R(RRR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytadd_post@scGs|jj||f�dS(N(RR(RRR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytadd_failCscCs�tjdt|�|df�|dkr5i}n|dkrJg}n|s�x�|jD]R}xIt|j|�D]4}|j|g�j|jj	|�j
|��qtWqZWn4x1|jD]&}|j|g�j|j|�q�W||fS(Ns%s.prepare(%s, %s)s...(Rtdebug4ttypetNoneRtreversedRRRtget_backend_by_nametreverse_ruletextend(RtenableRtmodulestbackend_nameR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytprepareFs 		'$cCs1tjdt|�|f�|j|�\}}|j�t}d}g}xe|D]]}y|jj|||�Wn,tk
r�}t	}|}tj
|�qUX|j|�qUW|s�|jj||�}	|	r�|	\}
}|
r�tj
|�q�q�n|r#i}xY|D]Q}g||<x>t||�D],}||j|jj|�j|��q3WqWxL|D]D}y|jj|||�Wqntk
r�}tj
|�qnXqnWxU|jD]J\}
}y|
|�Wq�tk
r	}tj
d|
||f�q�Xq�Wttj|��n|j�dS(Ns%s.execute(%s)ts#Calling fail func %s(%s) failed: %s(RRRR(tpretFalseRRt	ExceptiontTrueterrorRthandle_modulestdebug1R!R"R#RRRtCOMMAND_FAILEDtpost(RR%RR&R.terrorMsgtdoneR'tmsgt
module_returntstatust
undo_rulesRRR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytexecuteZsP




$
	cCsstjdt|��xU|jD]J\}}y||�Wq!tk
rj}tjd|||f�q!Xq!WdS(Ns%s.pre()s"Calling pre func %s(%s) failed: %s(RRRR	R,R.(RRRR5((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR*�s	cCsstjdt|��xU|jD]J\}}y||�Wq!tk
rj}tjd|||f�q!Xq!WdS(Ns	%s.post()s#Calling post func %s(%s) failed: %s(RRRR
R,R.(RRRR5((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR2�s	N(t__name__t
__module__t__doc__R
RRRRRRRRR R(R9R*R2(((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyRs										=	
cBsJeZdZd�Zd�Zd�Zddd�Zd�Zd�Z	RS(s<General FirewallTransaction, contains also zone transactionscCs&tt|�j|�t�|_dS(N(tsuperRR
Rtzone_transactions(RR((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR
�scCs$tt|�j�|jj�dS(N(R=RRR>(R((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR�scCs9||jkr.t|j||�|j|<n|j|S(N(R>RR(Rtzone((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytzone_transaction�scCs�tjdt|�|df�tt|�j|||�\}}x�|jD]�}yR|j|j||�x4|j|jD]"}||kr|j|�qqWWqNt	k
r�}tj
dt|��qNXqNW||fS(Ns%s.prepare(%s, %s)s...s1Failed to prepare transaction rules for zone '%s'(RRRR=RR(R>R&RRR.tstr(RR%RR&R?tmoduleR5((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR(�s 	cCsStjdt|��tt|�j�x"|jD]}|j|j�q4WdS(Ns%s.pre()(RRRR=RR*R>(RR?((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR*�scCsStjdt|��tt|�j�x"|jD]}|j|j�q4WdS(Ns	%s.post()(RRRR=RR2R>(RR?((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR2�sN(
R:R;R<R
RR@R R(R*R2(((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR�s				cBs�eZdZd
d�Zd�Zd
d
d�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�ZRS(s;Zone transaction with additional chain and module interfacecCs>tt|�j|�||_||_g|_g|_dS(N(R=RR
R?tfw_transactiontchainsR&(RRR?RC((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR
�s
			cCs�|jr~tt|j�j�x}|jjj�D]E}tt|jj|�j�|jj|j2|jj|j2q2Wn!tt|�j�|j2|j2dS(N(	RCR=RRR>tkeysRRDR&(RR?((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR�s	cCs~tjdt|�|df�tt|�j|||�\}}x-|jD]"}||krN|j|�qNqNW||fS(Ns%s.prepare(%s, %s)s...(RRRR=RR(R&R(RR%RR&RB((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR(�s cCs6|jr|jj|�ntt|�j|�dS(N(RCR9R=R(RR%((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR9s	cCsT||f}||jkrP|jjj|jt|g|�|jj|�ndS(N(RDRR?tgen_chain_rulesR-R(Rttabletchainttable_chain((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt	add_chains"cCs2||f}||jkr.|jj|�ndS(N(RDR(RRGRHRI((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytremove_chainscCs?x8|D]0}||jkr|j|d|d�qqWdS(Nii(RDRJ(RRDRI((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt
add_chainss
cCs7x0|D](}||jkr|jj|�qqWdS(N(RDR(RRDRI((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt
remove_chains s
cCs&||jkr"|jj|�ndS(N(R&R(RRB((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt
add_module%scCs&||jkr"|jj|�ndS(N(R&R(RRB((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt
remove_module)scCs"x|D]}|j|�qWdS(N(RN(RR&RB((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytadd_modules-s
cCs"x|D]}|j|�qWdS(N(RO(RR&RB((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pytremove_modules1s
N(R:R;R<R R
RR(R9RJRKRLRMRNRORPRQ(((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyR�s										N(R<t__all__tfirewall.core.loggerRtfirewallRtfirewall.errorsRtfirewall.fw_typesRtobjectRRR(((s@/usr/lib/python2.7/site-packages/firewall/core/fw_transaction.pyt<module>s�5

ZeroDay Forums Mini