+
    4i|                     "   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt  ! R R4      t ! R R]4      t ! R R	]4      t	 ! R
 R]4      t
 ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R4      t ! R R4      tR# )    NUFWError)debugc                   6   a  ] tR t^,t o RtR tR tR tRtV t	R# )
UFWCommandz"Generic class for parser commands.c                    W n         . V n        WP                  9  d   V P                  P                  V4       Wn        R # N)commandtypesappendtype)selfr   r
   s   &&&,/usr/lib/python3/dist-packages/ufw/parser.py__init__UFWCommand.__init__.   s/    
zz!JJd#	    c                z    \        V4      ^8  d   \        4       h\        V^ ,          P                  4       4      pV#    )len
ValueErrorUFWParserResponselowerr   argvrs   && r   parseUFWCommand.parse5   s.    t9q=,d1gmmo.r   c                    \        R 4      h)z!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____classdictcell____classdict__s   @r   r   r   ,   s     ,< <r   r   c                   F   a  ] tR t^At o RtR tR tR t]! ]4      tRt	V t
R# )UFWCommandRulez#Class for parsing ufw rule commandsc                6    R p\         P                  WV4       R# )ruleNr   r   r   r
   r   s   && r   r   UFWCommandRule.__init__C       D0r   c           	        R pR pR pRpRpR pR pR p	R p
Rp\        V4      ^ 8  d5   V^ ,          P                  4       R8X  d   VP                  V^ ,          4       \        V4      ^ 8  Ed   V^ ,          P                  4       R8X  dY   \        V4      ^8  dI   RpVP                  V^ ,          4       Rp \        V^ ,          4      pVe   \        RV,          4      pV# MV^ ,          P                  4       R8X  dV   \        V4      ^8  d   \        4       hV^,          p	V	R	8X  g   V	R
8X  d   \        R4      V	,          p\        V4      hV^ V^  M!V^ ,          P                  4       R8X  d   RAp	V^  V^ ,          pVR8w  d    VR8w  d   VR8w  d   VR8w  d   \        4       h\        V4      pV^8  d   \        4       hRpV^8  dP   V^,          P                  4       R8X  g   V^,          P                  4       R8X  d   V^,          P                  4       pV^8  dl   V^,          R8w  d^   V^,          P                  4       R8X  g   V^,          P                  4       R8X  d&   V^,          P                  4       pV^ \        V4      pRpV^8  d   VP                  R4      ^ 8  g   VP                  R4      ^ 8  d   \        R4      pV^,          P                  4       R8w  d(   V^,          P                  4       R8w  d   \        V4      hV^8  g   V^,          P                  4       R8w  d   \        V4      hV^ \        V4      pRp^ pV'       dC   V^8  d<   V^,          P                  4       R8X  g   V^,          P                  4       R8X  d   ^pMAV^8  d;   V^,          P                  4       R8X  g   V^,          P                  4       R8X  d   ^pV^ 8  d&   VV,          P                  4       p
VV \        V4      pRV9   d   \        R4      p\        V4      hRV9   d   \        R4      p\        V4      hR pRV9   d   VP                  R4      pV\        V4      ^,
          8X  d   \        R4      p\        V4      hVV^,           ,          pRV9   d   \        R4      p\        V4      hVV^,            VV \        V4      pV^8  g   V^8  d   \        4       hTpV
R 8w  d   VRV
,           ,          p\        P                  P                  VRRV\        P                  P                  V4      R7      pV'       d   Wn        MV	R 8w  d    VP!                  V	4       V^8X  d   \        P"                  P%                  V^,          4      '       d(    \        P                  P'                  V^,          4       VP(                  R 8X  d    \        P                  P-                  V^,          4      w  pp\.        P0                  ! R!T4      '       g'   R"T9   g   R#T9   d   \        R$4      p\        T4      hTp TP3                  T4       TP+                  TR 4       RpEMEMV^,           ^,          ^ 8w  d   \        R&4      p\        V4      hR'V9  d,   R(V9  d%   RV9  d   RV9  d   \        R)4      p\        V4      h. RBOpVP                  R(4      ^8  g   VP                  R'4      ^8  g   VP                  R*4      ^8  g   VP                  R+4      ^8  go   VP                  R4      ^8  gY   VP                  R4      ^8  gC   VP                  R,4      ^8  g-   VP                  R,4      ^ 8  d-   VP                  R*4      ^ 8  d   \        R-4      p\        V4      h^ pR pV EF6  pV^,          ^ 8w  d3   VV,          V9  d%   \        R.4      VV,          ,          p\        V4      hVR*8X  dG   V^,           V8  d#    VP3                  VV^,           ,          4       EM\        R/4      p\        V4      hVR8X  g   VR8X  d   V^,           V8  dT    VR8X  d#   VP5                  RVV^,           ,          4       EMVVR8X  d!   VP5                  RVV^,           ,          4       EM-\        R04      V,          p\        V4      hVR'8X  d   V^,           V8  dl    VV^,           ,          P                  4       pVR8X  d   R1pRpM+\        P                  P7                  VR24      '       d   R3pMR4pVP9                  V4       R5pEM\        R64      p\        V4      hVR(8X  d   V^,           V8  dk    VV^,           ,          P                  4       pVR8X  d   R1pRpM+\        P                  P7                  VR24      '       d   R3pMR4pVP;                  V4       R pM\        R74      p\        V4      hVR+8X  g   VR,8X  d   V^,           V8  d   VR 8X  d   \        R84      V,          p\        V4      hVV^,           ,          pVR,8X  d   VR58X  d	   VVn        MUVVn        MM\.        P0                  ! R!V4      '       g1   R"V9   g   R#V9   d   \        R$4      p\        V4      hVR58X  d   TpMTp VP+                  VV4       M\        R94      p\        V4      hV^,          pEK9  	  VR8X  d   VR8X  d   RpM=VR8w  d$   VR8w  d   WV8w  d   \        R:4      p\        V4      hVR8w  d   TpM	VR8w  d   TpVR 8w  g	   VR 8w  Ed   R pVR 8w  d!    \        P                  P'                  V4      pVR 8w  d   VR8X  g   VR 8X  d"    \        P                  P'                  V4      pMO \        P                  P'                  V4      pTR8X  g   TT8X  d   TpMTR8X  d   M\        R<4      p\        T4      hVP>                  R8X  d   VP3                  V4       M?VR8w  d9   VP>                  V8w  d(   \        R=4      VP>                  ,          p\        V4      hV'       d`   VP>                  \        P                  P@                  9   d&   VR8X  d   \C        R>VP>                  ,          4       R4pVPE                  V4       \        V4      pV PF                  VPH                  R?&   W=PH                  R&   WMPH                  R@&   V#   \         d    T^ ,          p ELGi ; i  \         d    h i ; i  \         d.    RpT^,          Tn        TP+                  T^,          R 4        ELi ; i  \         d   p\        T4      hRp?ii ; i  \         d    \        R%4      p\        T4      hi ; i  \         d    h i ; i  \         d    h i ; i  \         d    h i ; i  \         d    h i ; i  \         d    h i ; i  \         d    \        R;4      p\        T4      hi ; i  \         d    \        R;4      p\        T4      hi ; i  \         d    \        R;4      p\        T4      hi ; i)C anyFr/   deleteTNz	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 "'"_)	directionrC   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protoportappz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)rM   rK   rL   rN   rO   r?   r@   )%r   r   removeint	Exceptionr   r   rE   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logtyperW   rule_numr   err_msgnargsrule_directionhas_interfacelog_idxrC   comment_idxrule_actionrN   rM   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   3s5 t &t  )u 8%u9 >v'v.;'v.Av>'v>-Aw=w(ww. ;x x8 5ttt 4uuu6&u11u69"vv+.v;>www+."x"x58"yc                *   V P                   pV P                  R8X  g   V P                  R8X  Ed   V P                  R8X  g   V P                  R8X  Ed   V P                  R8X  Edm   V P                  R8X  Ed[   V P
                  R8X  EdI   V P                  R8X  Ed7   V P                  R8w  Ed%   V P                  R8X  d   VRV P                  ,          ,          pV P                  R8w  d   VRV P                  ,          ,          pV P                  R8w  dH   RV P                  9   d   VRV P                  ,          ,          pM`VRV P                  ,          ,          pMEVRV P                  ,          ,          pV P                  R8w  d   VR	V P                  ,          ,          pV P                  R8w  d   VR
V P                  4       ,          ,          pV# V P
                  R8w  d   VRV P
                  ,          ,          pV P                  R8w  d   VRV P                  ,          ,          pM+V P                  R8X  d   VRV P                  ,          ,          pV P                  R8w  d   VRV P                  ,          ,          pR F  pVR8X  d(   V P                  pV P                  pV P                  pRpM&V P                  pV P                  pV P                  pRpVR8X  g   VR8X  d   RpVR8w  g   VR8w  g
   VR8w  g   K~  VRV: RV: 2,          pVR8w  d,   RV9   d   VRV,          ,          pK  VRV,          ,          pK  VR8w  g   K  VRV,          ,          pK  	  RV9  d3   RV9  d,   V P
                  R8X  d   V P                  R8X  d
   VR,          pV P                  R8w  d=   V P                  R8X  d,   V P                  R8X  d   VRV P                  ,          ,          pV P                  R8w  d   VR
V P                  4       ,          ,          pV# )zGet command string for rulerP   z::/0r6   r5   r@   z %s z '%s'z/%sz comment '%s'z	 in on %sz
 out on %srT   rK   rL   z	 app '%s'z app %sz port %sz to z from z to anyz	 proto %s)rT   rH   )rt   rH   rT   sportro   interface_ininterface_outdportrF   rz   re   rp   rC   get_comment)r   resr   r   rN   rO   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    N)r#   r$   r%   r&   r'   r   r   r   staticmethodr(   r)   r*   s   @r   r-   r-   A   s'     -1~@LZ {+Kr   r-   c                   0   a  ] tR tRt o RtR tR tRtV tR# )UFWCommandRouteRulei  z)Class for parsing ufw route rule commandsc                >    \         P                  W4       R V n        R# )routeN)r-   r   r   )r   r
   s   &&r   r   UFWCommandRouteRule.__init__  s    .	r   c                   V^ ,          R8X  g   Q hRV9   dS   VP                  R4      pRp\        V4      V8  d0    \        W^,           ,          4       \        R4      p\	        V4      hRpRpRpRP                  V4      pRV9   d   RV9   d|   R	pVP                  R
4      VP                  R	4      8  d   R
pWP                  V4      ^,           ,          pV^ VP                  V4       WP                  V4      ^,           R ,           pM`\        P                  ! RV4      '       gB   \        P                  ! RV4      '       g%   RV9   g   RV9   d   \        R4      p\	        V4      hTpRV^ &   \        P                  W4      pRVP                  9   dK   RVP                  R,          n        V'       d+   V'       d#   VP                  R,          P                  We4       V#   \
         d     ELi ; i)r   r   r7   r5   z9'route delete NUM' unsupported. Use 'delete NUM' instead.Nr   z in on z out on r@   r?   z (in|out) on z app (in|out) z in z out z'Invalid interface clause for route ruler/   T)r[   r   rX   rE   r   r   joinrh   searchr-   r   rs   forwardrk   )	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   .G! !G0/G0)r   N	r#   r$   r%   r&   r'   r   r   r(   r)   r*   s   @r   r   r     s     38 8r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )UFWCommandAppiX  z*Class for parsing ufw application commandsc                6    R p\         P                  WV4       R# )rO   Nr0   r1   s   && r   r   UFWCommandApp.__init__Z  s    D0r   c                d   RpRpRpV^ ,          R8w  d   \        4       hV^  \        V4      pV^ ,          P                  4       pVR8X  g   VR8X  dw   V^8  d-   V^,          R8X  d   RpVP                  R4       \        V4      pV^8  d   \        4       h\	        V^,          4      P                  R4      pV'       d
   VR	,          pVR
8X  d   V^8w  d   \        4       hVR8X  d   V^8  d   \        4       hV^,          P                  4       R8X  d   RpMgV^,          P                  4       R8X  d   RpMHV^,          P                  4       R8X  d   RpM)V^,          P                  4       R8X  d   RpM
\        4       h\        V4      pV P                  VP                  R&   W&P                  R&   V# )zParse applications command.r5   FrO   infoupdatez	--add-newTz[']z	-with-newlistdefaultr;   default-allowr<   default-denyr=   default-rejectskipzdefault-skipr   name)	r   r   r   rW   strr   r   r   rs   )r   r   r   rt   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*   s   @r   r   r   X  s     412 2r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )UFWCommandBasici  z$Class for parsing ufw basic commandsc                6    R p\         P                  WV4       R# )basicNr0   r1   s   && r   r   UFWCommandBasic.__init__  s    D0r   c                `    \        V4      ^8w  d   \        4       h\        P                  W4      # r   )r   r   r   r   )r   r   s   &&r   r   UFWCommandBasic.parse  s&    t9>,++r   r   Nr   r*   s   @r   r   r     s     .1, ,r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )UFWCommandDefaulti  z&Class for parsing ufw default commandsc                6    R p\         P                  WV4       R# )r   Nr0   r1   s   && r   r   UFWCommandDefault.__init__      D0r   c                (   \        V4      ^8  d   \        4       hRpRp\        V4      ^8  Edc   V^,          P                  4       R8w  d   V^,          P                  4       R8w  d{   V^,          P                  4       R8w  d_   V^,          P                  4       R8w  dC   V^,          P                  4       R8w  d'   V^,          P                  4       R8w  d   \        4       hV^,          P                  4       P                  R4      '       d   RpMV^,          P                  4       P                  R	4      '       d   RpMRV^,          P                  4       R8X  g   V^,          P                  4       R8X  d   RpMV^,          P                  4       pV^,          P                  4       R
8X  d   RpMHV^,          P                  4       R8X  d   RpM)V^,          P                  4       R8X  d   RpM
\        4       hVRV,          ,          p\	        V4      # )   r5   incominginputroutedr   outputoutgoingr?   r@   r<   r   r;   r   r=   r   z-%s)r   r   r   
startswithr   )r   r   rt   rF   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*   s   @r   r   r     s     01%) %)r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )UFWCommandLoggingi  z&Class for parsing ufw logging commandsc                6    R p\         P                  WV4       R# )loggingNr0   r1   s   && r   r   UFWCommandLogging.__init__  r   r   c                B   R p\        V4      ^8  d   \        4       hV^,          P                  4       R8X  d   RpMV^,          P                  4       R8X  gq   V^,          P                  4       R8X  gU   V^,          P                  4       R8X  g9   V^,          P                  4       R8X  g   V^,          P                  4       R8X  dE   RpV^,          P                  4       R8w  d&   VR	V^,          P                  4       ,           ,          pM
\        4       h\        V4      # )
r5   offzlogging-offrA   lowmediumhighfullz
logging-onrE   r   r   r   r   r   r   rt   s   && r   r   UFWCommandLogging.parse  s    t9q=,!W]]_%"F!W]]_$Q5(@!W]]_(DGMMOv,E!W]]_&!FAw}}$&#Q//, ((r   r   Nr   r*   s   @r   r   r     s     01) )r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )UFWCommandStatusi  z%Class for parsing ufw status commandsc                6    R p\         P                  WV4       R# )statusNr0   r1   s   && r   r   UFWCommandStatus.__init__  s    D0r   c                *   \         P                  W4      p\        V4      ^8X  d
   RVn        V# \        V4      ^8  dU   V^,          P	                  4       R8X  d
   RVn        V# V^,          P	                  4       R8X  d
   RVn        V# \        4       hV# )r   r   verbosezstatus-verbosenumberedzstatus-numbered)r   r   r   rt   r   r   r   s   && r   r   UFWCommandStatus.parse  s    T(t9>AH  Y]Aw}})++
 	 aJ.,  !l"r   r   Nr   r*   s   @r   r   r     s     /1 r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )UFWCommandShowi  z#Class for parsing ufw show commandsc                6    R p\         P                  WV4       R# )showNr0   r1   s   && r   r   UFWCommandShow.__init__  r3   r   c                T   R p\        V4      ^8X  d   \        4       hV^,          P                  4       R8X  d   RpMV^,          P                  4       R8X  d   RpMV^,          P                  4       R8X  d   RpMV^,          P                  4       R8X  d   RpMV^,          P                  4       R	8X  d   R
pMgV^,          P                  4       R8X  d   RpMHV^,          P                  4       R8X  d   RpM)V^,          P                  4       R8X  d   RpM
\        4       h\        V4      # )r5   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*   s   @r   r   r     s     -1) )r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )r   i  zClass for ufw parser responsec                Z    VP                  4       V n        R V n        R V n        / V n        R# )FN)r   rt   dryrunforcers   )r   rt   s   &&r   r   UFWParserResponse.__init__  s$    lln
	r   c                   R V P                   ,          p\        V P                  P                  4       4      pVP	                  4        V F&  pVRV: RV P                  V,          : R2,          pK(  	  VR,          p\        V4      # )zaction='%s'rI   z='rD   
)rt   r   rs   r   sortrepr)r   r   r   r   s   &   r   __str__UFWParserResponse.__str__!  sc    T[[)DIINN$%		Aq$))A,,//A 	T	Awr   )rt   rs   r   r   N)	r#   r$   r%   r&   r'   r   r   r(   r)   r*   s   @r   r   r     s     ' r   r   c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )		UFWParseri,  zClass for ufw parserc                    / V n         R # r	   commands)r   s   &r   r   UFWParser.__init__.  s	    r   c                0   VP                  4       \        V P                  P                  4       4      9  d   \	        4       hVP                  4       \        V P                  V,          P                  4       4      9  d   \	        4       hVP                  4       # )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                   Rp\        V4      ^ 8  d7   V^ ,          P                  4       R8X  d   RpVP                  V^ ,          4       Rp\        V4      ^ 8  dS   V^ ,          P                  4       R8X  g   V^ ,          P                  4       R8X  d   RpVP                  V^ ,          4       RpRpV^ ,          P                  4       p\        V4      ^8  d   V\        V P                  P                  4       4      9   d_   V^,          P                  4       \        V P                  V,          P                  4       4      9   d   TpV^,          P                  4       pMTp\        V P                  P                  4       4       Fw  pW@P                  V,          9   g   K  \        V P                  V,          V,          \        4      '       d,   \        V P                  V,          V,          R4      R8w  d   Ku  Tp M	  VR8X  d   RpV P                  WT4      pV P                  V,          V,          pVP                  V4      p	W)n        W9n        V	# )	z(Parse command. Returns a UFWParserActionFz	--dry-runTz--forcez-fr5   r   r/   )r   r   rW   r   r   r   
isinstancer-   getattrr  r   r   r   )
r   r    r   r   r  r   r   r   rt   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                   VP                   e   VP                   R8X  d   RVP                  ,          pMRVP                   ,          pVP                  V P                  9  d   / V P                  VP                  &   W P                  VP                  ,          9   d   \        R4      V,          p\	        V4      hWP                  VP                  ,          V&   R# )z"Register a command with the parserNr5   z%szCommand '%s' already exists)r
   r   r   rE   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*   s   @r   r   r   ,  s"     ,\' 'r   r   )rh   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   