%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/ufw/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/ufw/__pycache__/parser.cpython-312.pyc

�

��e�|�� �ddlZddlZddlZddlmZddlmZGd�d�ZGd�de�ZGd�d	e�Z	Gd
�de�Z
Gd�d
e�ZGd�de�ZGd�de�Z
Gd�de�ZGd�de�ZGd�d�ZGd�d�Zy)�N��UFWError)�debugc�"�eZdZdZd�Zd�Zd�Zy)�
UFWCommandz"Generic class for parser commands.c��||_g|_||jvr|jj|�||_y�N)�command�types�append�type)�selfr
r
s   �,/usr/lib/python3/dist-packages/ufw/parser.py�__init__zUFWCommand.__init__.s5�������
��t�z�z�!��J�J���d�#���	�c�n�t|�dkr
t��t|dj��}|S)N�r)�len�
ValueError�UFWParserResponse�lower�r�argv�rs   r�parsezUFWCommand.parse5s.���t�9�q�=��,���d�1�g�m�m�o�.���rc��td��)Nz!UFWCommand.help: need to overrider)r�argss  r�helpzUFWCommand.help=s���:�;�;rN)�__name__�
__module__�__qualname__�__doc__rrr�rrrr,s��,���<rrc�2�eZdZdZd�Zd�Zd�Zee�Zy)�UFWCommandRulez#Class for parsing ufw rule commandsc�6�d}tj|||�y)N�rule�rr�rr
r
s   rrzUFWCommandRule.__init__C��������D�$��0rc	�<�d}d}d}d}d}d}d}d}	d}
d}t|�dkDr*|dj�dk(r|j|d�t|�dkDr�|dj�dk(rGt|�dkDr9d}|j|d�d}	t|d�}|��td	|z�}
|
S|dj�d
k(rGt|�dkr
t
��|d}	|	dk(s|	d
k(rtd�|	z}t|��|d=|d=n|dj�dk(rd}	|d=|d}|dk7r|dk7r|dk7r|dk7r
t
��t|�}|dkr
t
��d}|dkDr?|dj�dk(s|dj�dk(r|dj�}|dkDrU|ddk7rM|dj�dk(s|dj�dk(r!|dj�}|d=t|�}d}|dkDr�|jd�dkDs|jd�dkDrxtd�}|dj�dk7r!|dj�dk7rt|��|dks|dj�dk7rt|��|d=t|�}d}d}|r4|dkDr/|dj�dk(s|dj�dk(rd}n3|dkDr.|dj�dk(s|dj�dk(rd}|dkDr!||j�}
||=t|�}d|vrtd�}t|��d|vrtd�}t|��d}d|vrn|jd�}|t|�dz
k(rtd �}t|��||dz}d!|vrtd"�}t
|��||dz=||=t|�}|dks|d#kDr
t
��|}|
dk7r|d$|
zz
}tjj|dd|tjj|��%�}|r||_n|	dk7r	|j!|	�|dk(r�tj"j%|d�r#	tjj'|d�|j(dk(�rr	tjj-|d�\}}t/j0d(|�s d)|vsd*|vrtd+�}t|��|}	|j3|�|j+|d'�d&}�n�|dzdzdk7rtd-�}t|��d.|vr"d/|vrd|vrd|vrtd0�}t|��gd1�}|jd/�dkDs�|jd.�dkDs�|jd2�dkDsx|jd3�dkDsd|jd�dkDsP|jd�dkDs<|jd4�dkDs(|jd4�dkDr*|jd2�dkDrtd5�}t|��d}d}|D�]�}|dzdk7r#|||vrtd6�||z}t|��|d2k(r8|dz|kr	|j3||dz��n4td7�}t|��|dk(s|dk(r_|dz|kr>	|dk(r|j5d||dz�n|dk(r|j5d||dz��n�td8�|z}t|��|d.k(ry|dz|kr[	||dzj�}|dk(rd9}d}n%tjj7|d:�rd;}nd<}|j9|�d=}�nMtd>�}t|��|d/k(rx|dz|krZ	||dzj�}|dk(rd9}d}n%tjj7|d:�rd;}nd<}|j;|�d'}n�td?�}t|��|d3k(s|d4k(r�|dz|kr�|dk(rtd@�|z}t|��||dz}|d4k(r|d=k(r||_nF||_n>t/j0d(|�s(d)|vsd*|vrtd+�}t|��|d=k(r|}n|}	|j+||�ntdA�}t|��|dz
}���|dk(r|dk(rd&}n4|dk7r |dk7r||k7rtdB�}t|��|dk7r|}n|dk7r|}|dk7s|dk7r�d}|dk7r 	tjj'|�}|dk7rt|dk(s|dk(r!	tjj'|�}nI	tjj'|�}|dk(s||k(r|}n|dk(rntdD�}t|��|j>dk(r|j3|�n7|dk7r2|j>|k7r#tdE�|j>z}t|��|rV|j>tjj@vr|d&k(rtCdF|j>z�d<}|jE|�t|�}
|jF|
jHdG<||
jHd<||
jHdH<|
S#t$r	|d}Y�
�GwxYw#t$r�wxYw#t$r%d&}|d|_|j+|dd'�Y��pwxYw#t$r}t|��d}~wwxYw#t$rtd,�}t|��wxYw#t$r�wxYw#t$r�wxYw#t$r�wxYw#t$r�wxYw#t$r�wxYw#t$rtdC�}t|��wxYw#t$rtdC�}t|��wxYw#t$rtdC�}t|��wxYw)IN��anyFrr'�deleterTz	delete-%d�insert��0z-1z#Cannot insert rule at position '%s'�prepend����allow�deny�reject�limit��in�out�onzInvalid interface clause��logzlog-allzOption 'log' not allowed herez!Option 'log-all' not allowed here�commentz*Option 'comment' missing required argument�'zComment may not contain "'"�
�_)�	directionr>�both�dstz^\d([0-9,:]*\d+)*$�,�:zPort ranges must be numericzBad portzWrong number of arguments�from�tozNeed 'to' or 'from' clause)�protorGrH�port�appr9r:rIrJrKzImproper rule syntaxzInvalid token '%s'zInvalid 'proto' clausezInvalid '%s' clause�	0.0.0.0/0�6�v6�v4�srczInvalid 'from' clausezInvalid 'to' clausezNeed 'from' or 'to' with '%s'zInvalid 'port' clausez%Mixed IP versions for 'from' and 'to'zCould not find protocolzProtocol mismatch (from/to)z,Protocol mismatch with specified protocol %sz*Adjusting iptype to 'v4' for protocol '%s'r
�iptype)%rr�remove�int�	ExceptionrrrAr�count�index�ufw�common�UFWRule�util�
hex_encode�set_position�applications�valid_profile_name�get_services_proto�dapp�set_port�parse_port_proto�re�match�set_protocol�
set_interface�
valid_address�set_src�set_dst�sapp�protocol�ipv4_only_protocolsr�verifyr
�data) rr�actionr'r
�	from_type�to_type�from_service�
to_service�
insert_pos�logtyperR�rule_numr�err_msg�nargs�rule_direction�
has_interface�log_idxr>�comment_idx�rule_actionrJrI�e�keys�i�loc�arg�faddr�saddr�tmps                                 rrzUFWCommandRule.parseGs����������	������
��
������t�9�q�=�T�!�W�]�]�_��6��K�K��Q�� ��t�9�q�=��A�w�}�}��(�*�s�4�y�1�}������D��G�$���%�"�4��7�|�H�
�'�)�+��*@�A�A��H��a�����H�,��t�9�q�=�$�,�&�!�!�W�
���$�
�d�(:�� E�F�!+�-�G�"�7�+�+���G���G��a�����I�-��
���G��!�W�F��W���6�!1�f��6H��W���,���D�	���1�9��,�����1�9�$�q�'�-�-�/�T�1��q�'�-�-�/�U�2�!�!�W�]�]�_�N��1�9��a��D��d�1�g�m�m�o��.E�.2�1�g�m�m�o��.F�!�!�W�]�]�_�N��Q����I�E��
��1�9�$�*�*�T�*�Q�.�$�*�*�U�2C�a�2G��2�3�G��A�w�}�}��$�&�4��7�=�=�?�e�+C��w�'�'��q�y�D��G�M�M�O�t�3��w�'�'��Q����I�E� �M����U�Q�Y�D��G�M�M�O�u�,D�,0��G�M�M�O�y�,H��G�
�Q�Y�D��G�M�M�O�u�4���7�=�=�?�i�7��G��Q�;��7�m�)�)�+�G��W�
���I�E��D�=��7�8�G��7�#�#�����;�<�G��7�#�#�������*�*�Y�/�K��c�$�i�!�m�+��H�I���w�'�'��;�q�=�)�G��g�~��;�<�� ��)�)��[��]�#��[�!���I�E��1�9���
��,�����b�=��3��=�(�K��z�z�!�!�+�u�e�,:�*-�(�(�*=�*=�g�*F�"�H��� �D�K�
�2�
�
��!�!�*�-��A�:����2�2�4��7�;�2��H�H�/�/��Q��8�
�y�y�B��&�$'�H�H�$=�$=�d�1�g�$F�M�T�5��x�x� 5�t�<��d�{�c�T�k�"#�$A�"B��&�w�/�/�!%�J�,��%�%�e�,��M�M�$��.�!�D��a�i�1�_��
!��3�4�G��7�#�#�
�4�
�D��$4��T�9I�
�$�
��4�5�G��7�#�#�I�D��z�z�$��!�#��z�z�&�!�A�%��z�z�'�"�Q�&��z�z�&�!�A�%��z�z�$��!�#��z�z�%� �1�$��z�z�%� �1�$��z�z�%� �1�$����G�)<�q�)@��2�3���w�'�'��A��C��k
���q�5�A�:�$�q�'��"5�� 4�5��a��A�G�"�7�+�+��'�>���s�U�{�"� �-�-�d�1�Q�3�i�8�#$�$<�"=��&�w�/�/��D�[�C�5�L���s�U�{�"�"�d�{� $� 2� 2�4��a��c�� C�!$��� $� 2� 2�5�$�q��s�)� D��#$�$9�":�c�"B��&�w�/�/��F�]���s�U�{�"�$(��1��I�O�O�$5�E�$��~�(3��,1�	�#&�8�8�#9�#9�%��#E�04�I�04�I� �L�L��/�$��
#$�$;�"<��&�w�/�/��D�[���s�U�{�"�$(��1��I�O�O�$5�E�$��~�(3��*/��#&�8�8�#9�#9�%��#E�.2�G�.2�G� �L�L��/�$��
#$�$9�":��&�w�/�/��F�]�c�U�l���s�U�{��"�9�&'�(G�&H�),�'.�G�"*�7�"3�3�"�1�Q�3�i���%�<�"�e�|�,/��	�,/��	�!#���*?��!E�"�c�z�S�C�Z�*+�,I�*J��&.�w�&7� 7�"�e�|�/2��-0�
�"� �M�M�#�s�3�#$�$;�"<��&�w�/�/��Q���Wk
�\�E�!�g��&6����e�#��5�(8��g�%��C�D���w�'�'��e�#� ���E�!������|�r�1��E��R��,��H�H�7�7�
�C�E��r�!��E�>�U�b�[�0� #��� ;� ;�L� I��0�!�h�h�9�9�,�G����~��#�� #������"#�$A�"B��&�w�/�/��}�}��%��!�!�%�(��%��D�M�M�U�$:��J�K�!�]�]�,���w�'�'���}�}���� <� <�<��v�~��B��}�}�&�'���
�K�K����f�%��������v������v������x�����O!�%�!�!�W�F�%��l�
��
��!�2�!�D� $�Q��D�I��M�M�$�q�'�5�1�2��"�&�"�1�+�%��&�� �,��
�m�G�"�7�+�+�,��H )�"�!�"�� )�"�!�"��* )�"�!�"��, )�"�!�"��B )�"�!�"��8!�,� � 9�:�G�"�7�+�+�,��%�0�#$�$=�">��&�w�/�/�0��%�0�#$�$=�">��&�w�/�/�0�s��k�!k1�"k?�
%l0�)%m�(m/�*;m=�An�An�n'�n5�?o� o;�k.�-k.�1k<�?*l-�,l-�0	m	�9m�m	� m,�/m:�=n�n�n$�'n2�5 o� o8�; pc�l�|j}|jdk(s|jdk(�rK|jdk(s|jdk(�r,|jdk(�r|jdk(�r|j
dk(r�|jdk(r�|jdk7r�|jdk(r|d|jzz
}|jdk7r|d|jzz
}|jdk7r4d|jvr|d|jzz
}nF|d|jzz
}n3|d|jzz
}|jdk7r|d	|jzz
}|jdk7r|d
|j�zz
}|S|j
dk7r|d|j
zz
}|jdk7r|d|jzz
}n!|jdk(r|d|jzz
}|jdk7r|d|jzz
}d
D]�}|dk(r'|j}|j}|j}d}n&|j}|j}|j}d}|dk(s|dk(rd}|dk7s|dk7s|dk7s�q|d|�d|��z
}|dk7rd|vr	|d|zz
}��|d|zz
}��|dk7s��|d|zz
}��d|vr'd|vr#|j
dk(r|jdk(r|dz
}|jdk7r0|jdk(r!|jdk(r|d|jzz
}|jdk7r|d
|j�zz
}|S)zGet command string for rulerLz::/0r-r,r:z %s� z '%s'z/%sz
 comment '%s'z	 in on %sz
 out on %s)rPrDrPrGrHz	 app '%s'z app %sz port %sz to z from z to anyz	 proto %s)rorDrP�sportrj�interface_in�
interface_out�dportrBrur`rkr>�get_comment)r�resr�r�rJrK�dirs       r�get_commandzUFWCommandRule.get_command�s���h�h��
�E�E�[� �A�E�E�V�O�
�E�E�[� �A�E�E�V�O��7�7�e���6�6�R�<��>�>�R���?�?�b� ��7�7�e���{�{�e�#��u�q�{�{�*�*���y�y�B���u�q�y�y�(�(���v�v��|��!�&�&�=��7�Q�V�V�+�+�C��5�1�6�6�>�)�C��u�q�w�w��&���:�:��&��5�1�:�:�-�-�C��y�y�B��������8�8��d�
�_�~�~��#��{�Q�^�^�3�3�����"�$��|�a�o�o�5�5������%��u�q�{�{�*�*���y�y�B���u�q�y�y�(�(��#�
1����:��%�%�C��7�7�D��&�&�C� �C��%�%�C��7�7�D��&�&�C��C��+�%�����C��%�<�4�5�=�C�2�I��s�C�0�0�C��b�y��#�:��;��#4�4�C��9�s�?�2�C�����z�D�0�0��/
1�8�S� �X�S�%8��N�N�b�(�Q�_�_��-B��y� ���z�z�U�"�q�v�v��|����"���{�Q�Z�Z�/�/���y�y�B��������8�8���
rN)rr r!r"rrr��staticmethodr#rrr%r%As$��-�1�~�@L�Z�{�+�Krr%c��eZdZdZd�Zd�Zy)�UFWCommandRouteRulez)Class for parsing ufw route rule commandsc�>�tj||�d|_y)N�route)r%rr
)rr
s  rrzUFWCommandRouteRule.__init__s������g�.���	rc�@�|ddk(sJ�d|vrI|jd�}d}t|�|kDr(	t||dz�td�}t	|��d}d}d}dj
|�}d|vrod	|vrkd
}|jd�|jd
�kDrd}||j|�dz}|d|j|�||j|�d
zdz}nLtjd|�s4tjd|�sd|vsd|vrtd�}t	|��|}d|d<tj||�}d|jvr7d|jd_|r!|r|jdj||�|S#t
$rY��DwxYw)Nrr�r.r,rz9'route delete NUM' unsupported. Use 'delete NUM' instead.r�z in on z out on r:r9r8r<z
 (in|out) on z app (in|out) z in z out z'Invalid interface clause for route ruler'T)rVrrSrArr�joinrc�searchr%rrn�forwardrf)	rr�idxrw�	rule_argv�	interface�strip�srs	         rrzUFWCommandRouteRule.parses����A�w�'�!�"�!��t���*�*�X�&�C��G��4�y�3�����S�1�W�
�&�� [�\�G�"�7�+�+��	��	���
�H�H�T�N����>�j�A�o��E��z�z�$��$�*�*�U�"3�3���
�T�Z�Z��.��2�3�I��Q�t�z�z�%�0�1�D����E�9J�1�9L�9M�4N�N�I����+�Q�/����,�a�0���k�W��\��A�B�G��7�#�#��I��	�!��� � ��y�1���Q�V�V��%)�A�F�F�6�N�"������v��,�,�U�I�>����W"����s�'F�	F�FN�rr r!r"rrr#rrr�r�s��3��8rr�c��eZdZdZd�Zd�Zy)�
UFWCommandAppz*Class for parsing ufw application commandsc�6�d}tj|||�y)NrKr(r)s   rrzUFWCommandApp.__init__Zs�������D�$��0rc���d}d}d}|ddk7r
t��|d=t|�}|dj�}|dk(s|dk(r^|dk\r&|dd	k(rd
}|jd	�t|�}|dkr
t��t	|d�jd�}|r|d
z
}|dk(r|dk7r
t��|dk(r}|dkr
t��|dj�dk(rd}nU|dj�dk(rd}n<|dj�dk(rd}n#|dj�dk(rd}n
t��t
|�}|j|jd<||jd<|S)zParse applications command.r,FrrK�info�updater<rz	--add-newTr8z[']z	-with-new�list�defaultr4�
default-allowr5�default-denyr6�default-reject�skipzdefault-skipr
�name)	rrrrR�strr�rr
rn)rrr�ro�addnewrxrs       rrzUFWCommandApp.parse^ss����������7�e���,����G��D�	���a�������V��v��1���z�d�1�g��4������K�(��D�	���q�y� �l�"��t�A�w�<�%�%�e�,�D���+�%���V����
��,���Y���q�y� �l�"��A�w�}�}��'�)�(���a�����F�*�'���a�����H�,�)���a�����F�*�'�� �l�"��f�%��������v������v���rNr�r#rrr�r�Xs��4�1�2rr�c��eZdZdZd�Zd�Zy)�UFWCommandBasicz$Class for parsing ufw basic commandsc�6�d}tj|||�y)N�basicr(r)s   rrzUFWCommandBasic.__init__�s�������D�$��0rc�^�t|�dk7r
t��tj||�S)Nr)rrrr)rrs  rrzUFWCommandBasic.parse�s(���t�9��>��,������d�+�+rNr�r#rrr�r��s��.�1�,rr�c��eZdZdZd�Zd�Zy)�UFWCommandDefaultz&Class for parsing ufw default commandsc�6�d}tj|||�y)Nr�r(r)s   rrzUFWCommandDefault.__init__���������D�$��0rc�\�t|�dkr
t��d}d}t|�dkD�r|dj�dk7rx|dj�dk7rb|dj�dk7rL|dj�dk7r6|dj�dk7r |dj�dk7r
t��|dj�jd	�rd}ng|dj�jd
�rd}nB|dj�dk(s|dj�dk(rd}n|dj�}|dj�dk(rd
}n<|dj�dk(rd}n#|dj�dk(rd}n
t��|d|zz
}t	|�S)Nr8r,�incoming�input�routedr��output�outgoingr9r:rr5r�r4r�r6r�z-%s)rrr�
startswithr)rrrorBs    rrzUFWCommandDefault.parse�sz���t�9�q�=��,�����	��t�9�q�=��A�w�}�}��*�,��A�w�}�}��'�)��A�w�}�}��(�*��A�w�}�}��)�+��A�w�}�}��(�*��A�w�}�}��*�,� �l�"��A�w�}�}��)�)�$�/�&�	��a�����+�+�E�2�&�	��a�����H�,��Q��
�
��9�0L�$�	� ��G�M�M�O�	���7�=�=�?�f�$�#�F�
�!�W�]�]�_��
'�$�F�
�!�W�]�]�_��
(�%�F��,���%�9�%�%�� ��(�(rNr�r#rrr�r��s��0�1�%)rr�c��eZdZdZd�Zd�Zy)�UFWCommandLoggingz&Class for parsing ufw logging commandsc�6�d}tj|||�y)N�loggingr(r)s   rrzUFWCommandLogging.__init__�r�rc��d}t|�dkr
t��|dj�dk(r
d}t|�S|dj�dk(sX|dj�dk(sB|dj�dk(s,|dj�d	k(s|dj�d
k(r<d}|dj�dk7r.|d|dj�zz
}t|�St��t|�S)
Nr,r8r�offzlogging-offr;�low�medium�high�fullz
logging-onrA�rrrr�rrros   rrzUFWCommandLogging.parse�s������t�9�q�=��,��
�!�W�]�]�_��
%�"�F�!��(�(��!�W�]�]�_��
$��Q��
�
��5�(@�
�!�W�]�]�_��
(�D��G�M�M�O�v�,E�
�!�W�]�]�_��
&�!�F��A�w�}�}��$�&��#��Q��
�
��/�/��!��(�(��,�� ��(�(rNr�r#rrr�r��s��0�1�)rr�c��eZdZdZd�Zd�Zy)�UFWCommandStatusz%Class for parsing ufw status commandsc�6�d}tj|||�y)N�statusr(r)s   rrzUFWCommandStatus.__init__�s�������D�$��0rc��tj||�}t|�dk(r	d|_|St|�dkDrH|dj	�dk(r	d|_|S|dj	�dk(r	d|_|St��|S)Nrr��verbosezstatus-verbose�numberedzstatus-numbered)rrrrorrrs   rrzUFWCommandStatus.parse�s������T�4�(���t�9��>��A�H�����Y��]��A�w�}�}��)�+�+���
��	�a�����J�.�,�����!�l�"��rNr�r#rrr�r��s��/�1�rr�c��eZdZdZd�Zd�Zy)�UFWCommandShowz#Class for parsing ufw show commandsc�6�d}tj|||�y)N�showr(r)s   rrzUFWCommandShow.__init__�r*rc�z�d}t|�dk(r
t��|dj�dk(r
d}t|�S|dj�dk(r
d}t|�S|dj�dk(r
d}t|�S|dj�d	k(r
d
}t|�S|dj�dk(r
d}t|�S|dj�d
k(r
d}t|�S|dj�dk(r
d}t|�S|dj�dk(r
d}t|�St��)Nr,r�rawzshow-rawzbefore-ruleszshow-beforez
user-rulesz	show-userzafter-rulesz
show-afterz
logging-ruleszshow-logging�builtinsz
show-builtins�	listeningzshow-listening�addedz
show-addedr�r�s   rrzUFWCommandShow.parse�sR�����t�9��>��,��
�!�W�]�]�_��
%��F�$!��(�(�#�!�W�]�]�_��
.�"�F� !��(�(��!�W�]�]�_��
,� �F�!��(�(��!�W�]�]�_�
�
-�!�F�!��(�(��!�W�]�]�_��
/�#�F�!��(�(��!�W�]�]�_�
�
*�$�F�!��(�(��!�W�]�]�_��
+�%�F�!��(�(��!�W�]�]�_��
'�!�F�!��(�(��,�rNr�r#rrr�r��s��-�1�)rr�c��eZdZdZd�Zd�Zy)rzClass for ufw parser responsec�X�|j�|_d|_d|_i|_y)NF)rro�dryrun�forcern)rros  rrzUFWParserResponse.__init__s$���l�l�n��������
���	rc���d|jz}t|jj��}|j	�|D]}|d|�d|j|�d�z
}�|dz
}t|�S)Nzaction='%s'rEz='r?�
)ror�rnr�sort�repr)rr�rr�s    r�__str__zUFWParserResponse.__str__!sf���T�[�[�)���D�I�I�N�N�$�%���	�	���	0�A�
�q�$�)�)�A�,�/�/�A�	0�	�T�	���A�w�rN)rr r!r"rr�r#rrrrs��'��rrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�	UFWParserzClass for ufw parserc��i|_yr	)�commands)rs rrzUFWParser.__init__.s	����
rc��|j�t|jj��vr
t	��|j�t|j|j��vr
t	��|j�S)z=Return command if it is allowed, otherwise raise an exception)rr�r�rr)rr
�cmds   r�allowed_commandzUFWParser.allowed_command1sc���:�:�<�t�D�M�M�$6�$6�$8�9�9��,���9�9�;�d�4�=�=��#6�#;�#;�#=�>�>��,���y�y�{�rc���d}t|�dkDr,|dj�dk(rd}|j|d�d}t|�dkDrB|dj�dk(s|dj�dk(rd}|j|d�d}d}|dj�}t|�dkDrt|t|jj��vrO|dj�t|j|j��vr|}|dj�}n�|}t|jj��D]W}||j|vs�t
|j||t�r t|j||d	�d
k7r�U|}n|dk(rd
}|j||�}|j||}|j|�}	||	_||	_|	S)z(Parse command. Returns a UFWParserActionFrz	--dry-runTz--forcez-fr,rr
r')
rrrRr�r�r�
isinstancer%�getattrr�rr�r�)
rrr�r�r�r
r�r�ro�responses
          r�
parse_commandzUFWParser.parse_command;s������t�9�q�=�T�!�W�]�]�_��;��F��K�K��Q�� ����t�9�q�=�d�1�g�m�m�o��:�"�1�g�m�m�o��5��E��K�K��Q�� ������1�g�m�m�o���t�9�q�=�S�D����);�);�)=�$>�>��Q��
�
��4��
�
�c�(:�(?�(?�(A�#B�B��D��q�'�-�-�/�C��C��$�-�-�,�,�.�/�	
���$�-�-��*�*�"�$�-�-��"2�3�"7��H��t�}�}�Q�/��4�f�=��G� ��D��	
��r�z����%�%�d�C�0���m�m�D�!�&�)���9�9�T�?�� �������rc�z�|j�|jdk(rd|jz}nd|jz}|j|jvri|j|j<||j|jvrtd�|z}t	|��||j|j|<y)z"Register a command with the parserNr,z%szCommand '%s' already exists)r
r
r�rAr)r�c�keyrws    r�register_commandzUFWParser.register_commandis����9�9���	�	�R���!�&�&�/�C��!�)�)�$�C��6�6����&�$&�D�M�M�!�&�&�!��$�-�-����'�'��5�6�#�>�G��7�#�#�%&��
�
�a�f�f��c�"rN)rr r!r"rr�r�r�r#rrr�r�,s�����,�\
'rr�)rc�ufw.utilrW�ufw.applications�
ufw.commonrrrr%r�r�r�r�r�r�r�rr�r#rr�<module>r�s���J
�����<�<�*S,�Z�S,�l>�.�>�B8�J�8�v	,�j�	,�+)�
�+)�\)�
�)�0�z��()�Z�)�@��&J'�J'r

Zerion Mini Shell 1.0