
    6mg|                         S SK r S SKrS SKrS SKJr  S SKJr   " S S5      r " S S\5      r " S S	\5      r	 " S
 S\5      r
 " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S5      r " S S5      rg)    NUFWError)debugc                   *    \ rS rSrSrS rS rS rSrg)
UFWCommand,   z"Generic class for parser commands.c                 ~    X l         / U l        XR                  ;  a  U R                  R                  U5        Xl        g N)commandtypesappendtype)selfr   r   s      ,/usr/lib/python3/dist-packages/ufw/parser.py__init__UFWCommand.__init__.   s/    
zz!JJd#	    c                 p    [        U5      S:  a
  [        5       e[        US   R                  5       5      nU$ )N   r   )len
ValueErrorUFWParserResponselowerr   argvrs      r   parseUFWCommand.parse5   s.    t9q=,d1gmmo.r   c                     [        S5      e)Nz!UFWCommand.help: need to overrider   )r   argss     r   helpUFWCommand.help=   s    :;;r   )r   r   r   N)	__name__
__module____qualname____firstlineno____doc__r   r   r!   __static_attributes__ r   r   r   r   ,   s    ,<r   r   c                   :    \ rS rSrSrS rS rS r\" \5      rSr	g)UFWCommandRuleA   z#Class for parsing ufw rule commandsc                 4    Sn[         R                  XU5        g )Nruler   r   r   r   r   s      r   r   UFWCommandRule.__init__C       D0r   c           	         SnSnSnSnSnSnSnSn	Sn
Sn[        U5      S:  a+  US   R                  5       S:X  a  UR                  US   5        [        U5      S:  a  US   R                  5       S:X  aJ  [        U5      S:  a;  SnUR                  US   5        S n [        US   5      nUb  [        S	U-  5      nU$ O}US   R                  5       S
:X  aJ  [        U5      S:  a
  [        5       eUS   n	U	S:X  d  U	S:X  a  [        S5      U	-  n[        U5      eUS	 US	 OUS   R                  5       S:X  a  Sn	US	 US   nUS:w  a  US:w  a  US:w  a  US:w  a
  [        5       e[        U5      nUS:  a
  [        5       eSnUS:  aA  US   R                  5       S:X  d  US   R                  5       S:X  a  US   R                  5       nUS:  aX  US   S:w  aO  US   R                  5       S:X  d  US   R                  5       S:X  a!  US   R                  5       nUS	 [        U5      nSnUS:  a  UR                  S5      S:  d  UR                  S5      S:  a|  [        S5      nUS   R                  5       S:w  a"  US   R                  5       S:w  a  [        U5      eUS:  d  US   R                  5       S:w  a  [        U5      eUS	 [        U5      nSnSnU(       a7  US:  a1  US   R                  5       S:X  d  US   R                  5       S:X  a  SnO6US:  a0  US   R                  5       S:X  d  US   R                  5       S:X  a  SnUS:  a!  UU   R                  5       n
UU	 [        U5      nSU;   a  [        S5      n[        U5      eSU;   a  [        S5      n[        U5      eSnSU;   aq  UR                  S5      nU[        U5      S-
  :X  a  [        S 5      n[        U5      eUUS-      nS!U;   a  [        S"5      n[        U5      eUUS-   	 UU	 [        U5      nUS:  d  US#:  a
  [        5       eUnU
S:w  a  US$U
-   -  n[        R                  R                  USSU[        R                  R                  U5      S%9nU(       a  Xl        OU	S:w  a   UR!                  U	5        US:X  a  [        R"                  R%                  US   5      (       a#   [        R                  R'                  US   5        UR(                  S:X  a   [        R                  R-                  US   5      u  nn[.        R0                  " S(U5      (       d$  S)U;   d  S*U;   a  [        S+5      n[        U5      eUn UR3                  U5        UR+                  US'5        S&nGO6GO4US-   S-  S:w  a  [        S-5      n[        U5      eS.U;  a(  S/U;  a"  SU;  a  SU;  a  [        S05      n[        U5      e/ S1QnUR                  S/5      S:  d  UR                  S.5      S:  d  UR                  S25      S:  d~  UR                  S35      S:  di  UR                  S5      S:  dT  UR                  S5      S:  d?  UR                  S45      S:  d*  UR                  S45      S:  a+  UR                  S25      S:  a  [        S55      n[        U5      eSnSnU GH  nUS-  S:w  a%  UU   U;  a  [        S65      UU   -  n[        U5      eUS2:X  a9  US-   U:  a   UR3                  UUS-      5        GO[[        S75      n[        U5      eUS:X  d  US:X  ac  US-   U:  aA   US:X  a  UR5                  SUUS-      5        GOUS:X  a  UR5                  SUUS-      5        GO[        S85      U-  n[        U5      eUS.:X  a  US-   U:  aa   UUS-      R                  5       nUS:X  a  S9nSnO*[        R                  R7                  US:5      (       a  S;nOS<nUR9                  U5        S=nGOf[        S>5      n[        U5      eUS/:X  a  US-   U:  a`   UUS-      R                  5       nUS:X  a  S9nSnO*[        R                  R7                  US:5      (       a  S;nOS<nUR;                  U5        S'nO[        S?5      n[        U5      eUS3:X  d  US4:X  a  US-   U:  a  US:X  a  [        S@5      U-  n[        U5      eUUS-      nUS4:X  a  US=:X  a  UUl        OQUUl        OI[.        R0                  " S(U5      (       d-  S)U;   d  S*U;   a  [        S+5      n[        U5      eUS=:X  a  UnOUn UR+                  UU5        O[        SA5      n[        U5      eUS-  nGM     US:X  a	  US:X  a  S&nO8US:w  a!  US:w  a  XV:w  a  [        SB5      n[        U5      eUS:w  a  UnOUS:w  a  UnUS:w  d  US:w  Ga  SnUS:w  a    [        R                  R'                  U5      nUS:w  ay  US:X  d  US:X  a!   [        R                  R'                  U5      nOL [        R                  R'                  U5      nUS:X  d  UU:X  a  UnOUS:X  a  O[        SD5      n[        U5      eUR>                  S:X  a  UR3                  U5        O9US:w  a3  UR>                  U:w  a#  [        SE5      UR>                  -  n[        U5      eU(       aY  UR>                  [        R                  R@                  ;   a   US&:X  a  [C        SFUR>                  -  5        S<nURE                  U5        [        U5      nU RF                  URH                  SG'   X=RH                  S'   XMRH                  SH'   U$ ! [         a	    US   n G
Nf = f! [         a    e f = f! [         a%    S&nUS   Ul        UR+                  US   S'5         GNf = f! [         a  n[        U5      eS nAff = f! [         a    [        S,5      n[        U5      ef = f! [         a    e f = f! [         a    e f = f! [         a    e f = f! [         a    e f = f! [         a    e f = f! [         a    [        SC5      n[        U5      ef = f! [         a    [        SC5      n[        U5      ef = f! [         a    [        SC5      n[        U5      ef = f)IN anyFr   r.   deleter   Tz	delete-%dinsert   0z-1z#Cannot insert rule at position '%s'prependallowdenyrejectlimit   inoutonzInvalid interface clause   logzlog-allzOption 'log' not allowed herez!Option 'log-all' not allowed herecommentz*Option 'comment' missing required argument'zComment may not contain "'"   _)	directionrF   bothdstz^\d([0-9,:]*\d+)*$,:zPort ranges must be numericzBad portzWrong number of argumentsfromtozNeed 'to' or 'from' clause)protorO   rP   portapprA   rB   rQ   rR   rS   zImproper rule syntaxzInvalid token '%s'zInvalid 'proto' clausezInvalid '%s' clause	0.0.0.0/06v6v4srczInvalid 'from' clausezInvalid 'to' clausezNeed 'from' or 'to' with '%s'zInvalid 'port' clausez%Mixed IP versions for 'from' and 'to'zCould not find protocolzProtocol mismatch (from/to)z,Protocol mismatch with specified protocol %sz*Adjusting iptype to 'v4' for protocol '%s'r   iptype)%r   r   removeint	Exceptionr   r   rI   r   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) r   r   actionr.   r   	from_typeto_typefrom_service
to_service
insert_poslogtyperZ   rule_numr   err_msgnargsrule_directionhas_interfacelog_idxrF   comment_idxrule_actionrR   rQ   ekeysilocargfaddrsaddrtmps                                    r   r   UFWCommandRule.parseG   s   	

t9q=T!W]]_6KKQ  t9q=Aw}}(*s4y1}DG$%"47|H
 ')+*@AAH ( aH,t9q=$,&!!W
 $
d(: EF!+-G"7++ GGaI-
G!WFW6!1f6HW,D	19, 19$q'--/T1q'--/U2!!W]]_N 19aDd1gmmo.E.21gmmo.F!!W]]_NQIE 19$**T*Q.$**U2Ca2G23GAw}}$&47==?e+Cw''qyDGMMOt3w''QIE MUQYDGMMOu,D,0GMMOy,HGQYDGMMOu47==?i7GQ;7m))+GWIED=78G7##;<G7##**Y/Kc$i!m+HIw'';q=)G g~;< ))[]#[!IE19
,b=3=(Kzz!!+ue,:*-((*=*=g*F " H  K2!!*- A:2247;;2HH//Q8
 yyB&$'HH$=$=d1g$FMT5 xx 5t<<d{cTk"#$A"B&w//!%J,%%e,MM$.!D & ai1_!34G7##4D$4T9I$45G7## ID zz$!#zz&!A%zz'"Q&zz&!A%zz$!#zz% 1$zz% 1$zz% 1$G)<q)@23w''ACq5A:$q'"5 45aAG"7++'>sU{" --d1Q3i8 #$$<"=&w//D[C5LsU{""d{ $ 2 24ac C!$ $ 2 25$qs) D #$$9":c"B&w//F]sU{"$(1IOO$5E$~(3,1	#&88#9#9%#E#E04I04I LL/ $
 #$$;"<&w//D[sU{"$(1IOO$5E$~(3*/#&88#9#9%#E#E.2G.2G LL/ $
 #$$9":&w//F]cUlsU{"9&'(G&H),'.G"*7"33"1Q3i%<"e|,/	,/	!#*?!E!E"czSCZ*+,I*J&.w&7 7"e|/2-0
" MM#s3 #$$;"<&w//QW \ E!g&6e#5(8%CDw''e# E! |r1ER,HH77
CE r!E>Ub[0 # ; ;L I0!hh99,G ~# #"#$A"B&w// }}%!!%(%DMMU$:JK!]],w'' }} < <<v~B}}& ' KKf%vvxO ! %!!WF%l   ! 2!D $QDIMM$q'512 " &"1+%&   ,
mG"7++,H  ) "!"  ) "!"*  ) "!",  ) "!"B  ) "!"8 ! ,   9:G"7++, % 0 #$$=">&w//0 % 0 #$$=">&w//0s   n  n "n% %o 2%o4 
pp'/p'8Ap6>Aqq%q# r 8r+  nnn"%+oo
o1!o,,o14!pp$'p36qqq #!r!r(+!sc                    U R                   nU R                  S:X  d  U R                  S:X  GaZ  U R                  S:X  d  U R                  S:X  Ga9  U R                  S:X  Ga(  U R                  S:X  Ga  U R
                  S:X  Ga  U R                  S:X  a  U R                  S:w  a  U R                  S:X  a  USU R                  -  -  nU R                  S:w  a  USU R                  -  -  nU R                  S:w  a6  SU R                  ;   a  USU R                  -  -  nOGUSU R                  -  -  nO4USU R                  -  -  nU R                  S:w  a  US	U R                  -  -  nU R                  S:w  a  US
U R                  5       -  -  nU$ U R
                  S:w  a  USU R
                  -  -  nU R                  S:w  a  USU R                  -  -  nO"U R                  S:X  a  USU R                  -  -  nU R                  S:w  a  USU R                  -  -  nS H  nUS:X  a'  U R                  nU R                  nU R                  nSnO&U R                  nU R                  nU R                  nSnUS:X  d  US:X  a  SnUS:w  d  US:w  d  US:w  d  Mx  USU< SU< 3-  nUS:w  a  SU;   a
  USU-  -  nM  USU-  -  nM  US:w  d  M  USU-  -  nM     SU;  a+  SU;  a%  U R
                  S:X  a  U R                  S:X  a  US-  nU R                  S:w  a2  U R                  S:X  a"  U R                  S:X  a  USU R                  -  -  nU R                  S:w  a  US
U R                  5       -  -  nU$ )zGet command string for rulerT   z::/0r5   r4   rB   z %s z '%s'z/%sz comment '%s'z	 in on %sz
 out on %s)rX   rL   rX   rO   rP   z	 app '%s'z app %sz port %sz to z from z to anyz	 proto %s)rw   rL   rX   sportrr   interface_ininterface_outdportrJ   r}   rh   rs   rF   get_comment)r   resr   r   rR   rS   dirs          r   get_commandUFWCommandRule.get_command  s   hhEE[ AEEVOEE[ AEEVO77e66R<>>R??b 77e{{e#uq{{**yyBuqyy((vv|!&&=7QVV++C5166>)Cuqww&::&51::--CyyB88d 
_ ~~#{Q^^33"$|aoo55%uq{{**yyBuqyy((#:%%C77D&&C C%%C77D&&CC+%C%<45=C2IsC00Cby#:;#44C9s?2CzD00/ $8 S XS%8NNb(Q__-By zzU"qvv|"{QZZ//yyB88
r   r)   N)
r#   r$   r%   r&   r'   r   r   r   staticmethodr(   r)   r   r   r+   r+   A   s$    -1~@LZ {+Kr   r+   c                   $    \ rS rSrSrS rS rSrg)UFWCommandRouteRulei  z)Class for parsing ufw route rule commandsc                 <    [         R                  X5        SU l        g )Nroute)r+   r   r   )r   r   s     r   r   UFWCommandRouteRule.__init__  s    .	r   c                    US   S:X  d   eSU;   aI  UR                  S5      nSn[        U5      U:  a'   [        XS-      5        [        S5      n[	        U5      eS nS nS nSR                  U5      nSU;   ap  S	U;   aj  S
nUR                  S5      UR                  S
5      :  a  SnXR                  U5      S-      nUSUR                  U5       XR                  U5      S-   S  -   nO\[        R                  " SU5      (       d>  [        R                  " SU5      (       d"  SU;   d  SU;   a  [        S5      n[	        U5      eUnSUS'   [        R                  X5      nSUR                  ;   a@  SUR                  S   l        U(       a%  U(       a  UR                  S   R                  Xe5        U$ ! [
         a     GNbf = f)Nr   r   r6   r4   r   z9'route delete NUM' unsupported. Use 'delete NUM' instead.r   z in on z out on rB   rA   r@   rD   z (in|out) on z app (in|out) z in z out z'Invalid interface clause for route ruler.   T)r^   r   r[   rI   r   r   joinrk   searchr+   r   rv   forwardrn   )	r   r   idxr   	rule_argv	interfacestripsr   s	            r   r   UFWCommandRouteRule.parse  s   Aw'!"! t**X&CG4y31W& [\G"7++ 		 HHTN>jAoEzz$$**U"33
 ZZ.23IQtzz%01DE9J19L9M4NNI+Q//,a00kW\ ABG7##I	!  1QVV%)AFF6N"v,,U>W " s   &F0 0
F>=F>)r   Nr#   r$   r%   r&   r'   r   r   r(   r)   r   r   r   r     s    38r   r   c                   $    \ rS rSrSrS rS rSrg)UFWCommandAppiX  z*Class for parsing ufw application commandsc                 4    Sn[         R                  XU5        g )NrS   r/   r0   s      r   r   UFWCommandApp.__init__Z  s    D0r   c                    SnSnSnUS   S:w  a
  [        5       eUS	 [        U5      nUS   R                  5       nUS:X  d  US:X  af  US:  a'  US   S	:X  a  S
nUR                  S	5        [        U5      nUS:  a
  [        5       e[	        US   5      R                  S5      nU(       a  US-  nUS:X  a  US:w  a
  [        5       eUS:X  a  US:  a
  [        5       eUS   R                  5       S:X  a  SnOXUS   R                  5       S:X  a  SnO>US   R                  5       S:X  a  SnO$US   R                  5       S:X  a  SnO
[        5       e[        U5      nU R                  UR                  S'   X&R                  S'   U$ )zParse applications command.r4   Fr   rS   infoupdaterD   r   z	--add-newTr@   z[']z	-with-newlistdefaultr<   default-allowr=   default-denyr>   default-rejectskipzdefault-skipr   name)	r   r   r   rZ   strr   r   r   rv   )r   r   r   rw   addnewr   r   s          r   r   UFWCommandApp.parse^  sq   7e,GD	aVv1zd1g4K(D	qy l" tAw<%%e,D+%V
,Yqy l"Aw}}')(aF*'aH,)aF*' l"f%vvr   r)   Nr   r)   r   r   r   r   X  s    412r   r   c                   $    \ rS rSrSrS rS rSrg)UFWCommandBasici  z$Class for parsing ufw basic commandsc                 4    Sn[         R                  XU5        g )Nbasicr/   r0   s      r   r   UFWCommandBasic.__init__  s    D0r   c                 ^    [        U5      S:w  a
  [        5       e[        R                  X5      $ )Nr   )r   r   r   r   )r   r   s     r   r   UFWCommandBasic.parse  s&    t9>,++r   r)   Nr   r)   r   r   r   r     s    .1,r   r   c                   $    \ rS rSrSrS rS rSrg)UFWCommandDefaulti  z&Class for parsing ufw default commandsc                 4    Sn[         R                  XU5        g )Nr   r/   r0   s      r   r   UFWCommandDefault.__init__      D0r   c                    [        U5      S:  a
  [        5       eSnSn[        U5      S:  Ga,  US   R                  5       S:w  a}  US   R                  5       S:w  af  US   R                  5       S:w  aO  US   R                  5       S:w  a8  US   R                  5       S:w  a!  US   R                  5       S:w  a
  [        5       eUS   R                  5       R                  S	5      (       a  SnOnUS   R                  5       R                  S
5      (       a  SnODUS   R                  5       S:X  d  US   R                  5       S:X  a  SnOUS   R                  5       nUS   R                  5       S:X  a  SnO>US   R                  5       S:X  a  SnO$US   R                  5       S:X  a  SnO
[        5       eUSU-  -  n[	        U5      $ )Nr@   r4   incominginputroutedr   outputoutgoingrA   rB   r   r=   r   r<   r   r>   r   z-%s)r   r   r   
startswithr   )r   r   rw   rJ   s       r   r   UFWCommandDefault.parse  s   t9q=, 	t9q=Aw}}*,Aw}}')Aw}}(*Aw}})+Aw}}(*Aw}}*, l"Aw}}))$//&	a++E22&	aH,Q90L$	 GMMO	 7==?f$#F!W]]_'$F!W]]_(%F,%9%% ((r   r)   Nr   r)   r   r   r   r     s    01%)r   r   c                   $    \ rS rSrSrS rS rSrg)UFWCommandLoggingi  z&Class for parsing ufw logging commandsc                 4    Sn[         R                  XU5        g )Nloggingr/   r0   s      r   r   UFWCommandLogging.__init__  r   r   c                    Sn[        U5      S:  a
  [        5       eUS   R                  5       S:X  a  SnOUS   R                  5       S:X  d\  US   R                  5       S:X  dE  US   R                  5       S:X  d.  US   R                  5       S	:X  d  US   R                  5       S
:X  a3  SnUS   R                  5       S:w  a  USUS   R                  5       -   -  nO
[        5       e[        U5      $ )Nr4   r@   r   offzlogging-offrC   lowmediumhighfullz
logging-onrI   r   r   r   r   r   r   rw   s      r   r   UFWCommandLogging.parse  s    t9q=,!W]]_%"F!W]]_$Q5(@!W]]_(DGMMOv,E!W]]_&!FAw}}$&#Q//, ((r   r)   Nr   r)   r   r   r   r     s    01)r   r   c                   $    \ rS rSrSrS rS rSrg)UFWCommandStatusi  z%Class for parsing ufw status commandsc                 4    Sn[         R                  XU5        g )Nstatusr/   r0   s      r   r   UFWCommandStatus.__init__  s    D0r   c                    [         R                  X5      n[        U5      S:X  a	  SUl        U$ [        U5      S:  aJ  US   R	                  5       S:X  a	  SUl        U$ US   R	                  5       S:X  a	  SUl        U$ [        5       eU$ )Nr   r   verbosezstatus-verbosenumberedzstatus-numbered)r   r   r   rw   r   r   r   s      r   r   UFWCommandStatus.parse  s    T(t9>AH  Y]Aw}})++
 	 aJ.,  !l"r   r)   Nr   r)   r   r   r   r     s    /1r   r   c                   $    \ rS rSrSrS rS rSrg)UFWCommandShowi  z#Class for parsing ufw show commandsc                 4    Sn[         R                  XU5        g )Nshowr/   r0   s      r   r   UFWCommandShow.__init__  r2   r   c                    Sn[        U5      S:X  a
  [        5       eUS   R                  5       S:X  a  SnOUS   R                  5       S:X  a  SnOUS   R                  5       S:X  a  SnOUS   R                  5       S	:X  a  S
nOrUS   R                  5       S:X  a  SnOXUS   R                  5       S:X  a  SnO>US   R                  5       S:X  a  SnO$US   R                  5       S:X  a  SnO
[        5       e[        U5      $ )Nr4   r   rawzshow-rawzbefore-ruleszshow-beforez
user-rulesz	show-userzafter-rulesz
show-afterzlogging-ruleszshow-loggingbuiltinszshow-builtins	listeningzshow-listeningaddedz
show-addedr   r   s      r   r   UFWCommandShow.parse  s    t9>,!W]]_%F!W]]_."F!W]]_, F!W]]_-!F!W]]_/#F!W]]_
*$F!W]]_+%F!W]]_'!F, ((r   r)   Nr   r)   r   r   r   r     s    -1)r   r   c                   $    \ rS rSrSrS rS rSrg)r   i  zClass for ufw parser responsec                 X    UR                  5       U l        SU l        SU l        0 U l        g )NF)r   rw   dryrunforcerv   )r   rw   s     r   r   UFWParserResponse.__init__  s$    lln
	r   c                     SU R                   -  n[        U R                  R                  5       5      nUR	                  5         U H  nUSU< SU R                  U   < S3-  nM      US-  n[        U5      $ )Nzaction='%s'rM   z='rG   
)rw   r   rv   r   sortrepr)r   r   r   r   s       r   __str__UFWParserResponse.__str__!  sa    T[[)DIINN$%		Aq$))A,//A 	T	Awr   )rw   rv   r   r   N)r#   r$   r%   r&   r'   r   r   r(   r)   r   r   r   r     s    'r   r   c                   0    \ rS rSrSrS rS rS rS rSr	g)		UFWParseri,  zClass for ufw parserc                     0 U l         g r
   commands)r   s    r   r   UFWParser.__init__.  s	    r   c                 $   UR                  5       [        U R                  R                  5       5      ;  a
  [	        5       eUR                  5       [        U R                  U   R                  5       5      ;  a
  [	        5       eUR                  5       $ )z=Return command if it is allowed, otherwise raise an exception)r   r   r  r   r   )r   r   cmds      r   allowed_commandUFWParser.allowed_command1  sc    ::<tDMM$6$6$899,99;d4==#6#;#;#=>>,yy{r   c                 
   Sn[        U5      S:  a-  US   R                  5       S:X  a  SnUR                  US   5        Sn[        U5      S:  aD  US   R                  5       S:X  d  US   R                  5       S:X  a  SnUR                  US   5        SnSnUS   R                  5       n[        U5      S:  ax  U[        U R                  R                  5       5      ;   aQ  US   R                  5       [        U R                  U   R                  5       5      ;   a  UnUS   R                  5       nOUn[        U R                  R                  5       5       H`  nX@R                  U   ;   d  M  [        U R                  U   U   [        5      (       a"  [        U R                  U   U   S	5      S
:w  a  M^  Un  O   US:X  a  S
nU R                  XT5      nU R                  U   U   nUR                  U5      n	X)l        X9l        U	$ )z(Parse command. Returns a UFWParserActionFr   z	--dry-runTz--forcez-fr4   r   r   r.   )r   r   rZ   r   r  r   
isinstancer+   getattrr  r   r   r   )
r   r    r   r   r  r   r   r   rw   responses
             r   parse_commandUFWParser.parse_command;  s   t9q=T!W]]_;FKKQ t9q=d1gmmo:"1gmmo5EKKQ 1gmmot9q=SD););)=$>>Q4c(:(?(?(A#BBDq'--/C C$--,,./--** "$--"23"7HHt}}Q/4f=G D 0 rz%%d0mmD!&)99T? r   c                    UR                   b  UR                   S:X  a  SUR                  -  nOSUR                   -  nUR                  U R                  ;  a  0 U R                  UR                  '   X R                  UR                     ;   a  [        S5      U-  n[	        U5      eXR                  UR                     U'   g)z"Register a command with the parserNr4   z%szCommand '%s' already exists)r   r   r  rI   r   )r   ckeyr   s       r   register_commandUFWParser.register_commandi  s    99		R!&&/C!))$C66&$&DMM!&&!--''56#>G7##%&affc"r   r   N)
r#   r$   r%   r&   r'   r   r  r  r  r(   r)   r   r   r   r   ,  s    ,\'r   r   )rk   ufw.utilr_   ufw.applications
ufw.commonr   r   r   r+   r   r   r   r   r   r   r   r   r   r)   r   r   <module>r     s   J 
    < <*S,Z S,l>. >B8J 8v	,j 	,+)
 +)\)
 )0z ()Z )@ &J' J'r   