
"b<]c        T   @  s<  d  Z  d d l m Z d d l m Z d d d d d d	 d
 g Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l m Z m Z m Z m Z d d l m Z d d l m Z d d l m Z m Z e rd d l m Z d e e f d     YZ n d d l m Z d   Z d f  d     YZ d f  d     YZ  d f  d     YZ! d f  d     YZ" d f  d     YZ# d  f  d!     YZ$ d" f  d#     YZ% d$ Z& d% f  d&     YZ' d' e' f d(     YZ( d) f  d*     YZ) d+ f  d,     YZ* d- e' f d.     YZ+ d/ e' f d0     YZ, d1 e' f d2     YZ- d3 e' f d4     YZ. d5 f  d6     YZ/ d7 f  d8     YZ0 i e( d9 6e' d: 6e+ d; 6e- d< 6e, d= 6e. d> 6e) d? 6Z1 d@ dA dB dC g Z2 dD dE dF dG dH dI dJ dK dL dM dN dO dP dQ dR dS dT dU dV dW dX dY dZ d[ d\ d] d^ d_ d` da db dc dd de df g# Z3 e r]d d l4 Z5 n d d l5 Z5 e6 g  e3 D]* Z7 e7 e5 j8 k re7 e9 e5 e7  f ^ qs Z: dg f  dh     YZ; di f  dj     YZ< dk f  dl     YZ= d e= f dm     YZ> dn e> f do     YZ? d f  dp     YZ@ dq e@ f dr     YZA e@ ZB y d ds lC mD ZD eA ZB Z@ Wn eE k
 rkn Xdt   ZF du   ZG d eH f dv     YZI d	 eH f dw     YZJ dx dy dz d{ d| d} d~ d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d gT ZK d e jL f d     YZM d e f d     YZN d   ZO eP d k r8d d l Z d e jQ k reG e jQ d  n d d lR ZR eR jS   n  d S(   s  
simple, elegant templating
(part of web.py)

Template design:

Template string is split into tokens and the tokens are combined into nodes. 
Parse tree is a nodelist. TextNode and ExpressionNode are simple nodes and 
for-loop, if-loop etc are block nodes, which contain multiple child nodes. 

Each node can emit some python string. python string emitted by the 
root node is validated for safeeval and executed using python in the given environment.

Enough care is taken to make sure the generated code and the template has line to line match, 
so that the error messages can point to exact line number in template. (It doesn't work in some cases still.)

Grammar:

    template -> defwith sections 
    defwith -> '$def with (' arguments ')' | ''
    sections -> section*
    section -> block | assignment | line

    assignment -> '$ ' <assignment expression>
    line -> (text|expr)*
    text -> <any characters other than $>
    expr -> '$' pyexpr | '$(' pyexpr ')' | '${' pyexpr '}'
    pyexpr -> <python expression>
i(   t   print_function(   t   opent   Templatet   Rendert   rendert   frendert
   ParseErrort   SecurityErrort   testNi   (   t   storaget   safeunicodet   safestrt
   re_compile(   t   config(   t   websafe(   t   PY2t	   iteritems(   t	   DictMixint   MutableMappingc           B  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   6   s   (   R   c         C  s9   |  j  d  d } | r+ |  |  |  | f S|  d f Sd S(   s   
    Splits the given text at newline.
    
        >>> splitline('foo\nbar')
        ('foo\n', 'bar')
        >>> splitline('foo')
        ('foo', '')
        >>> splitline('')
        ('', '')
    s   
i   t    N(   t   find(   t   textt   index(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt	   splitline=   s    t   Parserc           B  s   e  Z d  Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 d
   Z d   Z e d  Z d   Z d   Z d   Z d   Z d   Z d d  Z d   Z RS(   s   Parser Base.
    c         C  s   t  |  _ t |  _ d  S(   N(   t   STATEMENT_NODESt   statement_nodest   KEYWORDSt   keywords(   t   self(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __init__S   s    	s
   <template>c         C  sC   | |  _  | |  _ |  j |  \ } } |  j |  } t | |  S(   N(   R   t   namet   read_defwitht
   read_suitet   DefwithNode(   R   R   R!   t   defwitht   suite(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   parseW   s
    		c         C  sI   | j  d  r; t |  \ } } | d j   } | | f Sd | f Sd  S(   Ns	   $def withi   R   (   t
   startswithR   t   strip(   R   R   R%   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR"   ^   s
    
c         C  s   | j  d  j d  r | j d  } | |  | | d } } |  j |  } | d k rh |  j |  S| |  j k r |  j | |  S| |  j k r |  j |  S| j	   d k r |  j
 |  Sn  |  j |  S(   s  Reads one section from the given text.
        
        section -> block | assignment | line
        
            >>> read_section = Parser().read_section
            >>> read_section('foo\nbar\n')
            (<line: [t'foo\n']>, 'bar\n')
            >>> read_section('$ a = b + 1\nfoo\n')
            (<assignment: 'a = b + 1'>, 'foo\n')
            
        read_section('$for in range(10):\n    hello $i\nfoo)
        t    t   $i   t   varR   (   t   lstripR(   R   t   python_lookaheadt   read_varR   t   read_block_sectionR   t   read_keywordR)   t   read_assignmentt   readline(   R   R   R   t   begin_indentt   text2t   ahead(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   read_sectionf   s    c         C  s  t  |  \ } } |  j |  } t |  d k  rB t d   n  | d } | d } | j | d  d j   } | d k r n | d k rt| d d k r|  j | d	  \ } } g  | j   D] } |  j |  d
 ^ q }	 g  }
 xR |	 D]) } |
 j	 | j
  |
 j t d   q Wn |  j |  \ } } | j
 }
 g  |
 D] } | j d  ^ qC} d d j |  } n t d   t | |  | f S(   s  Reads a var statement.
        
            >>> read_var = Parser().read_var
            >>> read_var('var x=10\nfoo')
            (<var: x = 10>, 'foo')
            >>> read_var('var x: hello $name\nfoo')
            (<var: x = join_(u'hello ', escape_(name, True))>, 'foo')
        i   s   Invalid var statementi   i   t   =t   :i   s   
s       i    R   s	   join_(%s)s   , (   R   t   python_tokenst   lent   SyntaxErrort   splitR)   t   read_indented_blockt
   splitlinesR3   t   extendt   nodest   appendt   TextNodet   emitt   joint   VarNode(   R   R   t   linet   tokensR!   t   sept   valuet   blockt   xt   linesRA   t   linenodet   _t   nodet   parts(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR/      s.    	

,	"c         C  s?   g  } x, | r4 |  j  |  \ } } | j |  q	 Wt |  S(   s   Reads section by section till end of text.
        
            >>> read_suite = Parser().read_suite
            >>> read_suite('hello $name\nfoo\n')
            [<line: [t'hello ', $name, t'\n']>, <line: [t'foo\n']>]
        (   R7   RB   t	   SuiteNode(   R   R   t   sectionst   section(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR#      s
    	c         C  ss   t  |  \ } } | j d  r. | d  } n  g  } x, | rb |  j |  \ } } | j |  q7 Wt |  | f S(   s  Reads one line from the text. Newline is supressed if the line ends with \.
        
            >>> readline = Parser().readline
            >>> readline('hello $name!\nbye!')
            (<line: [t'hello ', $name, t'!\n']>, 'bye!')
            >>> readline('hello $name!\\\nbye!')
            (<line: [t'hello ', $name, t'!']>, 'bye!')
            >>> readline('$f()\n\n')
            (<line: [$f(), t'\n']>, '\n')
        s   \
i(   R   t   endswitht	   read_nodeRB   t   LineNode(   R   R   RG   RA   RP   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR3      s    	c         C  s   | j  d  r# t d  | d f S| j  d  rT t |  \ } } t d  | f S| j  d  r | d } | j  d  r t } | d } n t } |  j | d | S|  j |  Sd	 S(
   s  Reads a node from the given text and returns the node and remaining text.
        
            >>> read_node = Parser().read_node
            >>> read_node('hello $name')
            (t'hello ', '$name')
            >>> read_node('$name')
            ($name, '')
        s   $$R+   i   s   $#s   
i   R9   t   escapeN(   R(   RC   R   t   Falset   Truet	   read_exprt	   read_text(   R   R   RG   RX   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRV      s    	
c         C  sG   | j  d  } | d k  r+ t |  d f St | |   | | f Sd S(   s   Reads a text node from the given text.
        
            >>> read_text = Parser().read_text
            >>> read_text('hello $name')
            (t'hello ', '$name')
        R+   i    R   N(   R   RC   (   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR\      s    c         C  s,   t  |  \ } } t | j   d  | f S(   Ns   
(   R   t   StatementNodeR)   (   R   R   RG   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR1      s    c           s    f d   }  f d          f d       f d        f d    i d d 6d d	 6d
 d 6 d   } d d d     Y} | | |     j    j  k r    n |    j j \ } } t | |  d | | | f S(   su  Reads a python expression from the text and returns the expression and remaining text.
        
        expr -> simple_expr | paren_expr
        simple_expr -> id extended_expr
        extended_expr -> attr_access | paren_expr extended_expr | ''
        attr_access -> dot id extended_expr
        paren_expr -> [ tokens ] | ( tokens ) | { tokens }
        
            >>> read_expr = Parser().read_expr
            >>> read_expr("name")
            ($name, '')
            >>> read_expr("a.b and c")
            ($a.b, ' and c')
            >>> read_expr("a. b")
            ($a, '. b')
            >>> read_expr("name</h1>")
            ($name, '</h1>')
            >>> read_expr("(limit)ing")
            ($(limit), 'ing')
            >>> read_expr('a[1, 2][:3].f(1+2, "weird string[).", 3 + 4) done.')
            ($a[1, 2][:3].f(1+2, "weird string[).", 3 + 4), ' done.')
        c             s          d  S(   N(    (    (   t   extended_exprt
   identifier(    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   simple_expr
  s    c             s   t     d  S(   N(   t   next(    (   RH   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR_     s    c            sa    j    }  |  d  k r d  S|  j d k r5     n$ |  j  k rU       n d  Sd  Sd  S(   Nt   .(   t	   lookaheadt   NoneRJ   (   Rc   (   t   attr_accessR^   t
   paren_exprt   parensRH   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR^     s    

c            sP   d d l  m }   j   }  j   j |  k rL t          n  d  S(   Ni(   t   NAME(   t   tokenRh   Rc   t
   lookahead2t   typeRa   (   Rh   t   dot(   R^   R_   RH   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRe     s    
c            sh   t    j }   |  } xH t rc  j   j  k rA     q t    } | j | k r Pq q Wd  S(   N(   Ra   RJ   RZ   Rc   (   t   begint   endt   t(   Rf   Rg   RH   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRf   '  s    
	
t   )t   (t   ]t   [t   }t   {c         3  s   t  |  g      f d   } d } x t j |  D] } t d | d d | d d | d d | d	  } | d k	 r | | j k r | \ } } | j \ } } t d d
 d |  | | !d | d | j  Vn  | j } | Vq4 Wd S(   s;  tokenize text using python tokenizer.
            Python tokenizer ignores spaces, but they might be important in some cases. 
            This function introduces dummy space tokens when it identifies any ignored space.
            Each token is a storage object containing type, value, begin and end.
            c             s
   t     S(   N(   Ra   (    (   t   i(    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   <lambda>=  R   Rk   i    RJ   i   Rm   i   Rn   i   iN(   t   iterRd   t   tokenizet   generate_tokensR	   Rm   Rn   (   R   R3   Rn   Ro   RO   t   x1t   x2(    (   Rv   s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt
   get_tokens6  s    1-		t
   BetterIterc           B  sA   e  Z d  Z d   Z d   Z d   Z d   Z d   Z e Z RS(   s6   Iterator like object with 2 support for 2 look aheads.c         S  s.   t  |  |  _ g  |  _ d |  _ d  |  _ d  S(   Ni    (   Rx   R   t   itemst   positionRd   t   current_item(   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    M  s
    			c         S  s?   t  |  j  |  j k r1 |  j j |  j    n  |  j |  j S(   N(   R;   R   R   RB   t   _next(   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRc   T  s    c         S  s*   y t  |  j  SWn t k
 r% d  SXd  S(   N(   Ra   R   t   StopIterationRd   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   Y  s
    c         S  sG   t  |  j  |  j d k r5 |  j j |  j    n  |  j |  j d S(   Ni   (   R;   R   R   RB   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRj   a  s    c         S  s%   |  j    |  _ |  j d 7_ |  j S(   Ni   (   Rc   R   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __next__f  s    (	   R   R   t   __doc__R    Rc   R   Rj   R   Ra   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR~   J  s   					RX   (    (   Rc   RJ   R   Rn   t   ExpressionNode(   R   R   RX   R`   R}   R~   t   rowt   col(    (   Re   R^   R_   Rf   Rg   RH   s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR[      s     

	#
c         C  s(   t  |  \ } } t | j    | f S(   s   Reads assignment statement from text.
        
            >>> read_assignment = Parser().read_assignment
            >>> read_assignment('a = b + 1\nfoo')
            (<assignment: 'a = b + 1'>, 'foo')
        (   R   t   AssignmentNodeR)   (   R   R   RG   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR2   u  s    c           s;   t  | g      f d   } t j |  } t |  d S(   sD  Returns the first python token from the given text.
        
            >>> python_lookahead = Parser().python_lookahead
            >>> python_lookahead('for i in range(10):')
            'for'
            >>> python_lookahead('else:')
            'else'
            >>> python_lookahead(' x = 1')
            ' '
        c             s
   t     S(   N(   Ra   (    (   Rv   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw     R   i   (   Rx   Ry   Rz   Ra   (   R   R   R3   RH   (    (   Rv   s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR.     s    c           sH   t  | g      f d   } t j |  } g  | D] } | d ^ q4 S(   Nc             s
   t     S(   N(   Ra   (    (   Rv   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw     R   i   (   Rx   Ry   Rz   (   R   R   R3   RH   Ro   (    (   Rv   s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR:     s    c         C  s   | d k r d | f Sd } xh | r t  |  \ } } | j   d k rV | d 7} n' | j |  r| | | t |  7} n P| } q W| | f S(   s  Read a block of text. A block is what typically follows a for or it statement.
        It can be in the same line as that of the statement or an indented block.
        
            >>> read_indented_block = Parser().read_indented_block
            >>> read_indented_block('  a\n  b\nc', '  ')
            ('a\nb\n', 'c')
            >>> read_indented_block('  a\n    b\n  c\nd', '  ')
            ('a\n  b\nc\n', 'd')
            >>> read_indented_block('  a\n\n    b\nc', '  ')
            ('a\n\n  b\n', 'c')
        R   s   
(   R   R)   R(   R;   (   R   R   t   indentRK   RG   R5   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR>     s    
	
c         C  s1   t  |  } | j d  | | j  | | j f S(   s   Reads a python statement.
        
            >>> read_statement = Parser().read_statement
            >>> read_statement('for i in range(10): hello $name')
            ('for i in range(10):', ' hello $name')
        R9   (   t   PythonTokenizert   consume_tillR   (   R   R   t   tok(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   read_statement  s    R   c   
      C  s   t  |  \ } } |  j |  \ } } |  j |  } | j   rQ | j   } nc d   } | |  t |  } | d k r | | }	 n | t | t  }	 |  j | |	  \ } } |  j	 | | | |  | f S(   sM  
            >>> read_block_section = Parser().read_block_section
            >>> read_block_section('for i in range(10): hello $i\nfoo')
            (<block: 'for i in range(10):', [<line: [t'hello ', $i, t'\n']>]>, 'foo')
            >>> read_block_section('for i in range(10):\n        hello $i\n    foo', begin_indent='    ')
            (<block: 'for i in range(10):', [<line: [t'hello ', $i, t'\n']>]>, '    foo')
            >>> read_block_section('for i in range(10):\n  hello $i\nfoo')
            (<block: 'for i in range(10):', [<line: [t'hello ', $i, t'\n']>]>, 'foo')
        c         S  s:   t  d  } | j |   } | o- | j d  } | p9 d S(   Ns     +i    R   (   R   t   matcht   group(   R   t   rxR   t   first_indent(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   find_indent  s    t   code(
   R   R   R.   R)   R-   R;   t   mint   INDENTR>   t   create_block_node(
   R   R   R4   RG   t   stmtt   keywordRK   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR0     s    
	c         C  s@   | |  j  k r& |  j  | | | |  St d t |    d  S(   Ns   Unknown statement: %s(   R   R   t   repr(   R   R   R   RK   R4   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    (   R   R   R   R    R'   R"   R7   R/   R#   R3   RV   R\   R1   RZ   R[   R2   R.   R:   R>   R   R0   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   O   s&   				$						
				R   c           B  s/   e  Z d  Z d   Z d   Z d   Z e Z RS(   s&   Utility wrapper over python tokenizer.c           sF   | |  _  t | g      f d   } t j |  |  _ d |  _ d  S(   Nc             s
   t     S(   N(   Ra   (    (   Rv   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw     R   i    (   R   Rx   Ry   Rz   RH   R   (   R   R   R3   (    (   Rv   s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s
    	c         C  s   y x t  r t |   } | j | k r+ Pn] | j d k rJ |  j d  n> | j d k ri |  j d  n | j d k r |  j d  n  | j d k r Pq q WWn d SXd S(	   s  Consumes tokens till colon.
        
            >>> tok = PythonTokenizer('for i in range(10): hello $i')
            >>> tok.consume_till(':')
            >>> tok.text[:tok.index]
            'for i in range(10):'
            >>> tok.text[tok.index:]
            ' hello $i'
        Rq   Rp   Rs   Rr   Ru   Rt   s   
N(   RZ   Ra   RJ   R   (   R   t   delimRo   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    
	c      	   C  sR   t  |  j  \ } } } } } | \ } } | |  _ t d | d | d | d |  S(   NRk   RJ   Rm   Rn   (   Ra   RH   R   R	   (   R   Rk   Ro   Rm   Rn   RG   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    	(   R   R   R   R    R   R   Ra   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s
   			R$   c           B  s#   e  Z d    Z d   Z d   Z RS(   c         C  s}   | r1 | j  d d  d |  _ |  j d 7_ n d |  _ |  j d 7_ |  j d 7_ |  j d 7_ | |  _ d	 |  _ d  S(
   Nt   witht   __template__R9   s   
    __lineoffset__ = -4s   def __template__():s   
    __lineoffset__ = -5s   
    loop = ForLoop()s3   
    self = TemplateResult(); extend_ = self.extends   
    return self(   t   replaceR%   R&   Rn   (   R   R%   R&   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    		c         C  s,   d } | |  j  |  j j | t  |  j S(   Ns   # coding: utf-8
(   R%   R&   RD   R   Rn   (   R   R   t   encoding(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD     s    c         C  s   d |  j  |  j f S(   Ns   <defwith: %s, %s>(   R%   R&   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __repr__   s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR$     s   		RC   c           B  s&   e  Z d    Z d d  Z d   Z RS(   c         C  s   | |  _  d  S(   N(   RJ   (   R   RJ   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    &  s    R   c         C  s   t  t |  j   S(   N(   R   R
   RJ   (   R   R   R4   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD   )  s    c         C  s   d t  |  j  S(   NRo   (   R   RJ   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   ,  s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRC   $  s   	R   c           B  s)   e  Z e d   Z d d  Z d   Z RS(   c         C  sX   | j    |  _ | j d  rK | j d  rK d |  j d d !d |  _ n  | |  _ d  S(   NRu   Rt   Rq   i   iRp   (   R)   RJ   R(   RU   RX   (   R   RJ   RX   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    2  s    R   c         C  s   d |  j  t |  j  f S(   Ns   escape_(%s, %s)(   RJ   t   boolRX   (   R   R   R4   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD   8  s    c         C  s)   |  j  r d } n d } d | |  j f S(   NR   R9   s   $%s%s(   RX   RJ   (   R   RX   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   ;  s    		(   R   R   RZ   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   0  s   R   c           B  s&   e  Z d    Z d d  Z d   Z RS(   c         C  s   | |  _  d  S(   N(   R   (   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    E  s    R   c         C  s   | |  j  d S(   Ns   
(   R   (   R   R   R4   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD   H  s    c         C  s   d t  |  j  S(   Ns   <assignment: %s>(   R   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   K  s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   C  s   	RW   c           B  s)   e  Z d    Z d d d  Z d   Z RS(   c         C  s   | |  _  d  S(   N(   RA   (   R   RA   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    Q  s    R   c         C  sV   g  |  j  D] } | j d  ^ q
 } | rA t |  g | } n  | d d j |  S(   NR   s   extend_([%s])
s   , (   RA   RD   R   RE   (   R   R   t   text_indentR!   RP   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD   T  s    %c         C  s   d t  |  j  S(   Ns
   <line: %s>(   R   RA   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   Z  s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRW   O  s   	s       t	   BlockNodec           B  s)   e  Z d  d  Z d  d  Z d   Z RS(   R   c         C  s+   | |  _  t   j |  |  _ | |  _ d  S(   N(   R   R   R#   R&   R4   (   R   R   RK   R4   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    b  s    	c         C  s5   |  j  | } | |  j |  j j | t |  } | S(   N(   R4   R   R&   RD   R   (   R   R   R   t   out(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD   g  s    $c         C  s    d t  |  j  t  |  j  f S(   Ns   <block: %s, %s>(   R   R   R&   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   l  s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   `  s   t   ForNodec           B  s   e  Z d  d  Z d   Z RS(   R   c         C  sq   | |  _  t |  } | j d  | | j  } | | j d !} | d | j   d } t j |  | | |  d  S(   Nt   inis    loop.setup(s   ):(   t   original_stmtR   R   R   R)   R   R    (   R   R   RK   R4   R   t   at   b(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    r  s    	c         C  s    d t  |  j  t  |  j  f S(   Ns   <block: %s, %s>(   R   R   R&   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   {  s    (   R   R   R    R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   p  s   	t   CodeNodec           B  s)   e  Z d  d  Z d  d  Z d   Z RS(   R   c         C  s   d | |  _  d  S(   Ns   
(   R   (   R   R   RK   R4   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    c         C  s=   d d  l  } | j d | j  } | j | |  j  j d  S(   Nit   ^R*   (   t   ret   compilet   Mt   subR   t   rstrip(   R   R   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD     s    c         C  s   d t  |  j  S(   Ns
   <code: %s>(   R   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s   R]   c           B  s&   e  Z d    Z d d  Z d   Z RS(   c         C  s   | |  _  d  S(   N(   R   (   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    R   c         C  s   | |  j  S(   N(   R   (   R   R   R4   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD     s    c         C  s   d t  |  j  S(   Ns
   <stmt: %s>(   R   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR]     s   	t   IfNodec           B  s   e  Z RS(    (   R   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s   t   ElseNodec           B  s   e  Z RS(    (   R   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s   t   ElifNodec           B  s   e  Z RS(    (   R   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s   t   DefNodec           B  s   e  Z d    Z d d  Z RS(   c         O  sp   t  j |  | |  t d d  } d | _ |  j j j d |  t d d  } d | _ |  j j j |  d  S(   NR   s/   self = TemplateResult(); extend_ = self.extend
i    s   return self
(   R   R    R   R   R&   RS   t   insertRB   (   R   R   t   kwR   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    		R   c         C  s=   |  j  | } | |  j |  j j | t |  } | d | S(   Ns   __lineoffset__ -= 3
(   R4   R   R&   RD   R   (   R   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD     s    $(   R   R   R    RD   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s   		RF   c           B  s#   e  Z d    Z d   Z d   Z RS(   c         C  s   | |  _  | |  _ d  S(   N(   R!   RJ   (   R   R!   RJ   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    	c         C  s   | d t  |  j  |  j f S(   Ns   self[%s] = %s
(   R   R!   RJ   (   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD     s    c         C  s   d |  j  |  j f S(   Ns   <var: %s = %s>(   R!   RJ   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    (   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRF     s   		RR   c           B  s,   e  Z d  Z d   Z d d  Z d   Z RS(   s   Suite is a list of sections.c         C  s   | |  _  d  S(   N(   RS   (   R   RS   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    R   c         C  s3   d d j  g  |  j D] } | j | |  ^ q  S(   Ns   
R   (   RE   RS   RD   (   R   R   R   t   s(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD     s    c         C  s   t  |  j  S(   N(   R   RS   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    (   R   R   R   R    RD   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRR     s   	t   fort   whilet   ift   elift   elset   defR   t   passt   breakt   continuet   returnt   dictt	   enumeratet   floatt   intR   t   listt   longt   reversedt   sett   slicet   tuplet   xranget   abst   allt   anyt   callablet   chrt   cmpt   divmodt   filtert   hext   idt
   isinstanceRx   R;   t   maxR   t   octt   ordt   powt   rangeRZ   RY   Rd   t
   __import__t   ForLoopc           B  s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s  
    Wrapper for expression in for stament to support loop.xxx helpers.
    
        >>> loop = ForLoop()
        >>> for x in loop.setup(['a', 'b', 'c']):
        ...     print(loop.index, loop.revindex, loop.parity, x)
        ...
        1 3 odd a
        2 2 even b
        3 1 odd c
        >>> loop.index
        Traceback (most recent call last):
            ...
        AttributeError: index
    c         C  s   d  |  _ d  S(   N(   Rd   t   _ctx(   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    	c         C  s2   |  j  d  k r t |   n t |  j  |  Sd  S(   N(   R   Rd   t   AttributeErrort   getattr(   R   R!   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __getattr__  s    c         C  s   |  j    |  j j |  S(   N(   t   _pushR   t   setup(   R   t   seq(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    
c         C  s   t  |  |  j  |  _ d  S(   N(   t   ForLoopContextR   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   $  s    c         C  s   |  j  j |  _  d  S(   N(   R   t   parent(   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   _pop'  s    (   R   R   R   R    R   R   R   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s   				R   c           B  s   e  Z d  Z d   Z d   Z e d    Z e d    Z e d    Z e d    Z	 e d    Z
 e d    Z e d	    Z e d
    Z RS(   s?   Stackable context for ForLoop to support nested for loops.
    c         C  s   | |  _  | |  _ d  S(   N(   t   _forloopR   (   R   t   forloopR   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    /  s    	c         c  se   y t  |  |  _ Wn d |  _ n Xd |  _ x" | D] } |  j d 7_ | Vq6 W|  j j   d  S(   Ni    i   (   R;   t   lengthR   R   R   (   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   3  s    		c         C  s   |  j  d S(   Ni   (   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   @  R   c         C  s   |  j  d k S(   Ni   (   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   A  R   c         C  s   |  j  |  j k S(   N(   R   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   B  R   c         C  s   |  j  d d k S(   Ni   i   (   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   C  R   c         C  s   |  j  d d k S(   Ni   i    (   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   D  R   c         C  s   d d g |  j  S(   Nt   oddt   even(   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   E  R   c         C  s   |  j  |  j S(   N(   R   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   F  R   c         C  s   |  j  |  j d S(   Ni   (   R   R   (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   G  R   (   R   R   R   R    R   t   propertyt   index0t   firstt   lastR   R   t   parityt	   revindex0t   revindex(    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   +  s   		t   BaseTemplatec           B  sA   e  Z d    Z d   Z d   Z d   Z d   Z e d  Z RS(   c         C  sO   | |  _  | |  _ | |  _ | |  _ | r? |  j |  |  _ n d   |  _ d  S(   Nc           S  s   d S(   NR   (    (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw   T  R   (   t   filenameR   t   _globalst	   _builtinst   _compileRo   (   R   R   R   R   t   globalst   builtins(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    L  s    				c         B  s.   |  j  |  j p i  |  j  } | | U| d S(   NR   (   t   make_envR   R   (   R   R   t   env(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   V  s    c         O  s   t  } |  j | |   S(   N(   RZ   Ro   (   R   R   R   t   __hidetraceback__(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __call__[  s    c         C  s.   t  | d | d t d t d |  j d |  j S(   Nt   __builtins__R   t   TemplateResultt   escape_t   join_(   R   R   R  t   _escapet   _join(   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   _  s    c         G  s   d j  |  S(   Nu    (   RE   (   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  b  s    c         C  sF   | d  k r d } n  t |  } | rB |  j rB |  j |  } n  | S(   NR   (   Rd   R
   R   (   R   RJ   RX   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  e  s    	(	   R   R   R    R   R   R   R  RY   R  (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   J  s   	
				c           B  s   e  Z i d  d 6d d 6d d 6Z i e d 6e d 6e d 6Z i  Z d d d d d d  Z d	   Z e	 e  Z d
   Z
 d d  Z e	 e  Z d   Z d   Z RS(   s   text/html; charset=utf-8s   .htmls$   application/xhtml+xml; charset=utf-8s   .xhtmls
   text/plains   .txts   .xmls
   <template>c   
      C  s   | p	 g  |  _  t j |  } |  j | |  } t j j |  \ } }	 | p` |  j j |	 d   } |  j
 j |	 d   |  _ | d  k r |  j } n  | d  k r t } n  t j |  d | d | d | d | d | d  S(   NR   R   R   R   R   (   t
   extensionsR   t   normalize_textt   compile_templatet   ost   patht   splitextt   FILTERSt   getRd   t   CONTENT_TYPESt   content_typeR   t   TEMPLATE_BUILTINSR   R    (
   R   R   R   R   R   R   R  R   RO   t   ext(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    w  s    	+c         C  s   |  j  d d  j  d d  j   }  |  j d  s@ |  d 7}  n  d } t |  t  rw |  j |  rw |  t |  }  n  |  j  d d  }  |  S(   sE   Normalizes template text by correcting 
        , tabs and BOM chars.s   
s   
s   s   ﻿s   \$s   $$(   R   t
   expandtabsRU   R   t   strR(   R;   (   R   t   BOM(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    $c         O  s]   t  } d d l m } d | j k rJ |  j rJ | j d |  j d t  n  t j |  | |  S(   Ni   (   t   webapit   headerss   Content-Typet   unique(   RZ   R   R  t   ctxR  t   headerR   R   (   R   R   R   R   t   web(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s
    c         C  sC   | p t    } | j |  |  } | j d d  j   } t |  S(   NR   R   (   R   R'   RD   R)   R   (   R   R   t   parsert   rootnodeR   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   generate_code  s    c         C  s-   t    } x |  j D] } | |  } q W| S(   N(   R   R  (   R   t   pR  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   create_parser  s    	c      	   C  s   t  j | | d |  j   } d   } y t | | d  } WnQ t k
 r } | j d t | j  | j | | j | j d  f 7_   n Xt	 j
 | |  } t   j | |  | S(   NR  c         S  s9   y* t  |  d d j   j   } | | SWn d  SXd  S(   NR   s   utf-8(   R   t   readR?   Rd   (   R   t   linenoRM   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   get_source_line  s    t   execs5   

Template traceback:
    File %s, line %s
        %si   (   R   R  R  R   R<   t   msgR   R   R!  t   astR'   t   SafeVisitort   walk(   R   t   template_stringR   R   R"  t   compiled_codet   errt   ast_node(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    		;N(   R   R   R  R   R  R   Rd   R    R  t   staticmethodR   R  R  R  (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   n  s   



			t   CompiledTemplatec           B  s#   e  Z d    Z d   Z d   Z RS(   c         C  s    t  j |  d |  | |  _ d  S(   NR   (   R   R    Ro   (   R   t   fR   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    c         G  s   d  S(   N(   Rd   (   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    c         G  s   d  S(   N(   Rd   (   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s    (   R   R   R    R  R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR-    s   		c           B  sY   e  Z d  Z d d	 d	 d  Z d	 d  Z d   Z d   Z d   Z d   Z	 d   Z
 RS(
   sB  The most preferred way of using templates.
    
        render = web.template.render('templates')
        print render.foo()
        
    Optional parameter can be `base` can be used to pass output of 
    every template through the base template.
    
        render = web.template.render('templates', base='layout')
    t	   templatesc           s   |  _  |  _ | d  k r4 t j d t  } n  | rF i   _ n	 d   _   r} t   d  r}    f d    _ n	    _ d  S(   Nt   debugR   c           s    j     |   S(   N(   t	   _template(   t   page(   t   baseR   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRw     R   (	   t   _loct	   _keywordsRd   R   R  RY   t   _cachet   hasattrt   _base(   R   t   loct   cacheR3  R   (    (   R3  R   s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    				c         C  sF   d |  j  k r i  |  j  d <n  | s1 | j } n  | |  j  d | <d S(   s(   Add a global to this rendering instance.R   N(   R5  R   (   R   t   objR!   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   _add_global  s
    c         C  s[   t  j j |  j |  } t  j j |  r4 d | f S|  j |  } | rS d | f Sd Sd  S(   Nt   dirt   filet   none(   R?  N(   R	  R
  RE   R4  t   isdirt	   _findfileRd   (   R   R!   R
  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   _lookup  s    

c         C  s   |  j  |  \ } } | d k rI t | d |  j d  k	 d |  j |  j S| d k r} t t | d d j   d | |  j St	 d |   d  Sd  S(	   NR=  R:  R3  R>  R   s   utf-8R   s   No template named (
   RB  R   R6  Rd   R8  R5  R   R   R   R   (   R   R!   t   kindR
  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   _load_template  s    ((c         C  sr   g  t  j  | d  D] } | j d  s | ^ q } | j   | rd t j j |  rd | g } n  | oq | d S(   Ns   .*t   ~i    (   t   globRU   t   sortR	  R
  t   exists(   R   t   path_prefixR.  R  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRA    s
    5
c         C  sS   |  j  d  k	 rB | |  j  k r7 |  j |  |  j  | <n  |  j  | S|  j |  Sd  S(   N(   R6  Rd   RD  (   R   R!   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR1    s    c           sN     j  |     j r= t  t  r=    f d   } | S  j  |  Sd  S(   Nc            s     j   |  |    S(   N(   R8  (   R   R   (   R   Ro   (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   template  s    (   R1  R8  R   R   (   R   R!   RJ  (    (   R   Ro   s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s
    N(   R   R   R   Rd   R    R<  RB  RD  RA  R1  R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR     s   
		
			t
   GAE_Renderc           B  s    e  Z e Z d    Z d   Z RS(   c         O  s   t  j j |  | | |  d d  l } t | | j  rC | |  _ n6 | j d  j d d  } t	 | d  d  d g  |  _ |  j j j | j d t   |  j j j t j  |  j j j | j d i    d  S(   Nit   /Rb   RL   R   R   (   RK  t   superR    t   typesR   t
   ModuleTypet   modR   R   R   Rd   t   __dict__t   updateR  R  R   R   (   R   R9  R   R   RN  R!   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    $  s    c         C  s`   t  |  j |  } d d  l } t | | j  rX t | d |  j d  k	 d |  j |  j	 S| Sd  S(   NiR:  R3  (
   R   RP  RN  R   RO  RK  R6  Rd   R8  R5  (   R   R!   Ro   RN  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRD  1  s    ((   R   R   R   RM  R    RD  (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyRK  !  s   	(   t	   appenginec         K  s%   t  t |  d d j   d |  | S(   s1   Creates a template from the given file path.
    R   s   utf-8R   (   R   R   R   (   R
  R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   B  s    c         C  s1  t  d t j  } xt j |   D]\ } } } g  | D]< } | j d  r8 | j d  r8 | j d  r8 | ^ q8 } x. | D]% } | j d  r | j |  q q Wt t j	 j
 | d  d d d } | j d  | r | j d	 d
 j
 |   n  | j d  x| D]} t j	 j
 | |  } d | k rU| j d d  \ }	 }
 n | }	 t | d d j   } t j |  } t j | |  } | j d |	 d  } | j |  | j d  | j d |	 |	 t |  f  | j d |	 |	 f  t t | d d j   |  } qW| j   q" Wd S(   s"   Compiles templates to python code.R   Rb   RE  s   __init__.pyt   wR   s   utf-8sD   from web.template import CompiledTemplate, ForLoop, TemplateResult

s   import s   , s   
i   R   s   

s   %s = CompiledTemplate(%s, %s)
s(   join_ = %s._join; escape_ = %s._escape

N(   R   R   R   R	  R'  R(   RU   t   removeR   R
  RE   t   writeR=   R   R   R  R  R   R   t   close(   t   roott   re_startt   dirpatht   dirnamest	   filenamesR.  t   dR   R
  R!   RO   R   R   Ro   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   compile_templatesH  s4    I$ %c           B  s   e  Z RS(    (   R   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   i  s   c           B  s   e  Z d  Z RS(   s8   The template seems to be trying to do something naughty.(   R   R   R   (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   m  s   t   Interactivet
   Expressiont   Suitet   FunctionDeft   ClassDeft   Returnt   Deletet   Assignt	   AugAssignt   aliast   Fort   Whilet   Ift   Witht   comprehensiont   NameConstantt   argt   Exprt   Passt   Breakt   Continuet   BoolOpt   BinOpt   UnaryOpt   Lambdat   IfExpt   Dictt   Modulet	   argumentsR   t   Sett   ListCompt   SetCompt   DictCompt   GeneratorExpt   Yieldt   Comparet   Callt   Numt   Strt	   Attributet	   Subscriptt   Namet   Listt   Tuplet   Loadt   Storet   Delt   AugLoadt   AugStoret   Paramt   Ellipsist   Slicet   ExtSlicet   Indext   Andt   Ort   Addt   Subt   Multt   Divt   Modt   Powt   LShiftt   RShiftt   BitOrt   BitXort   BitAndt   FloorDivt   Invertt   Nott   UAddt   USubt   Eqt   NotEqt   Ltt   LtEt   Gtt   GtEt   Ist   IsNott   Int   NotInt   ExceptHandlerR&  c           B  s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z RS(   s  
    Make sure code is safe by walking through the AST.
    
    Code considered unsafe if:
        * it has restricted AST nodes (only nodes defined in ALLOWED_AST_NODES are allowed)
        * it is trying to assign to attributes
        * it is trying to access resricted attributes   
        
    Adopted from http://www.zafar.se/bkz/uploads/safe.txt (public domain, Babar K. Zafar)
        * Using ast rather than compiler tree, for jython and Py3 support since Py2.6
        * Simplified with ast.NodeVisitor class
    c         O  s&   t  t |   j | |   g  |  _ d S(   sB   Initialize visitor by generating callbacks for all AST node types.N(   RM  R&  R    t   errors(   R   t   argst   kwargs(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR      s    c         C  sW   | |  _  |  j |  |  j rS t d j g  |  j D] } t |  ^ q2    n  d S(   sJ   Validate each node in AST and raise SecurityError if the code is not safe.s   
N(   R   t   visitR  R   RE   R  (   R   t   treeR   R*  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR'    s    		c         C  sH   t  |  j } | t k r. |  j | |  n  t t |   j |  d  S(   N(   Rk   R   t   ALLOWED_AST_NODESt	   fail_nameRM  R&  t   generic_visit(   R   RP   t   nodename(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    c         C  sK   |  j  |  } |  j |  r1 |  j | |  n  t t |   j |  d  S(   N(   t   get_node_attrt   is_unallowed_attrt   fail_attributeRM  R&  R  (   R   RP   t   attrname(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   visit_Attribute  s    c         C  s   |  j  |  d  S(   N(   t   check_assign_targets(   R   RP   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   visit_Assign  s    c         C  s   |  j  |  d  S(   N(   t   check_assign_target(   R   RP   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   visit_AugAssign  s    c         C  s;   x | j  D] } |  j |  q
 Wt t |   j |  d  S(   N(   t   targetsR  RM  R&  R  (   R   RP   t   target(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    c         C  sA   t  |  j } | d k r= |  j |  } |  j | |  n  d  S(   NR  (   Rk   R   R  R  (   R   t
   targetnodet
   targetnameR  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    c         C  s?   |  j  |  } t d |  j | | f  } |  j j |  d  S(   Ns.   %s:%d - execution of '%s' statements is denied(   t   get_node_linenoR   R   R  RB   (   R   RP   R  R!  t   e(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    c         C  s?   |  j  |  } t d |  j | | f  } |  j j |  d  S(   Ns*   %s:%d - access to attribute '%s' is denied(   R  R   R   R  RB   (   R   RP   R  R!  R  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    c         C  s+   | j  d  p* | j  d  p* | j  d  S(   NRO   t   func_t   im_(   R(   (   R   R!   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  	  s    c         C  s   d | j  k r | j p d  S(   Nt   attr(   t   _fieldsR  Rd   (   R   RP   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    c         C  s   | j  r | j  p d S(   Ni    (   R!  (   R   RP   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s    (   R   R   R   R    R'  R  R  R  R  R  R  R  R  R  R  R  (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR&    s   												R  c           B  s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z RS(   s  Dictionary like object for storing template output.
    
    The result of a template execution is usally a string, but sometimes it
    contains attributes set using $var. This class provides a simple
    dictionary like interface for storing the output of the template and the
    attributes. The output is stored with a special key __body__. Convering
    the the TemplateResult to string or unicode returns the value of __body__.
    
    When the template is in execution, the output is generated part by part
    and those parts are combined at the end. Parts are added to the
    TemplateResult by calling the `extend` method and the parts are combined
    seemlessly when __body__ is accessed.
    
        >>> d = TemplateResult(__body__='hello, world', x='foo')
        >>> print(d)
        hello, world
        >>> d.x
        'foo'
        >>> d = TemplateResult()
        >>> d.extend([u'hello', u'world'])
        >>> d
        <TemplateResult: {'__body__': u'helloworld'}>
    c         O  s`   t  | |   |  j d <|  j j d d  g  |  j d <|  j j |  j d <|  j j d d   d  S(   Nt   _dt   __body__u    t   _partsR@   (   R   RQ  R  t
   setdefaultR  R@   Rd   (   R   R   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    ,  s    c         C  s   |  j  j   S(   N(   R  t   keys(   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  4  s    c         C  se   |  j  ra d j |  j   } g  |  j  (|  j j d  } | rQ | | |  j d <qa | |  j d <n  d S(   s4   Prepare value of __body__ by joining parts.
        u    R  N(   R  RE   R  R  (   R   RJ   t   body(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   _prepare_body7  s    	
c         C  s$   | d k r |  j    n  |  j | S(   NR  (   R  R  (   R   R!   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __getitem__C  s    c         C  s,   | d k r |  j    n  |  j j | |  S(   NR  (   R  R  t   __setitem__(   R   R!   RJ   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  H  s    c         C  s)   | d k r |  j    n  |  j j |  S(   NR  (   R  R  t   __delitem__(   R   R!   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  M  s    c         C  s2   y |  | SWn t  k
 r- } t |   n Xd  S(   N(   t   KeyErrorR   (   R   t   keyt   k(    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   R  s    c         C  s   | |  | <d  S(   N(    (   R   R  RJ   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __setattr__X  s    c         C  s1   y |  | =Wn t  k
 r, } t |   n Xd  S(   N(   R  R   (   R   R  R  (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __delattr__[  s    c         C  s   |  j    |  d S(   NR  (   R  (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __unicode__a  s    
c         C  s-   |  j    t r! |  d j d  S|  d Sd  S(   NR  s   utf-8(   R  R   t   encode(   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   __str__e  s    
c         C  s   |  j    d |  j S(   Ns   <TemplateResult: %s>(   R  R  (   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   l  s    
c         C  s   |  j  j   S(   N(   R  t   __len__(   R   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  p  s    c         c  s<   x5 |  j  j   D]$ } | d k r/ |  j   n  | Vq Wd  S(   NR  (   R  t   __iter__R  (   R   Rv   (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR  s  s    (   R   R   R   R    R  R  R  R  R  R   R  R  R  R  R   R  R  (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR    s   													c           C  s   d S(   st  Doctest for testing template module.
    
    Define a utility function to run template test.
    
        >>> class TestResult:
        ...     def __init__(self, t): self.t = t
        ...     def __getattr__(self, name): return getattr(self.t, name)
        ...     def __repr__(self): return repr(unicode(self.t) if PY2 else str(self.t))
        ...
        >>> def t(code, **keywords):
        ...     tmpl = Template(code, **keywords)
        ...     return lambda *a, **kw: TestResult(tmpl(*a, **kw))
        ...
    
    Simple tests.
    
        >>> t('1')()
        u'1\n'
        >>> t('$def with ()\n1')()
        u'1\n'
        >>> t('$def with (a)\n$a')(1)
        u'1\n'
        >>> t('$def with (a=0)\n$a')(1)
        u'1\n'
        >>> t('$def with (a=0)\n$a')(a=1)
        u'1\n'
    
    Test complicated expressions.
        
        >>> t('$def with (x)\n$x.upper()')('hello')
        u'HELLO\n'
        >>> t('$(2 * 3 + 4 * 5)')()
        u'26\n'
        >>> t('${2 * 3 + 4 * 5}')()
        u'26\n'
        >>> t('$def with (limit)\nkeep $(limit)ing.')('go')
        u'keep going.\n'
        >>> t('$def with (a)\n$a.b[0]')(storage(b=[1]))
        u'1\n'
        
    Test html escaping.
    
        >>> t('$def with (x)\n$x', filename='a.html')('<html>')
        u'&lt;html&gt;\n'
        >>> t('$def with (x)\n$x', filename='a.txt')('<html>')
        u'<html>\n'
                
    Test if, for and while.
    
        >>> t('$if 1: 1')()
        u'1\n'
        >>> t('$if 1:\n    1')()
        u'1\n'
        >>> t('$if 1:\n    1\\')()
        u'1'
        >>> t('$if 0: 0\n$elif 1: 1')()
        u'1\n'
        >>> t('$if 0: 0\n$elif None: 0\n$else: 1')()
        u'1\n'
        >>> t('$if 0 < 1 and 1 < 2: 1')()
        u'1\n'
        >>> t('$for x in [1, 2, 3]: $x')()
        u'1\n2\n3\n'
        >>> t('$def with (d)\n$for k, v in d.items(): $k')({1: 1})
        u'1\n'
        >>> t('$for x in [1, 2, 3]:\n\t$x')()
        u'    1\n    2\n    3\n'
        >>> t('$def with (a)\n$while a and a.pop():1')([1, 2, 3])
        u'1\n1\n1\n'
    
    The space after : must be ignored.
    
        >>> t('$if True: foo')()
        u'foo\n'
    
    Test loop.xxx.
    
        >>> t("$for i in range(5):$loop.index, $loop.parity")()
        u'1, odd\n2, even\n3, odd\n4, even\n5, odd\n'
        >>> t("$for i in range(2):\n    $for j in range(2):$loop.parent.parity $loop.parity")()
        u'odd odd\nodd even\neven odd\neven even\n'
        
    Test assignment.
    
        >>> t('$ a = 1\n$a')()
        u'1\n'
        >>> t('$ a = [1]\n$a[0]')()
        u'1\n'
        >>> t('$ a = {1: 1}\n$list(a.keys())[0]')()
        u'1\n'
        >>> t('$ a = []\n$if not a: 1')()
        u'1\n'
        >>> t('$ a = {}\n$if not a: 1')()
        u'1\n'
        >>> t('$ a = -1\n$a')()
        u'-1\n'
        >>> t('$ a = "1"\n$a')()
        u'1\n'
    
    Test comments.
    
        >>> t('$# 0')()
        u'\n'
        >>> t('hello$#comment1\nhello$#comment2')()
        u'hello\nhello\n'
        >>> t('$#comment0\nhello$#comment1\nhello$#comment2')()
        u'\nhello\nhello\n'
        
    Test unicode.
    
        >>> t('$def with (a)\n$a')(u'\u203d')
        u'\u203d\n'
        >>> t(u'$def with (a)\n$a $:a')(u'\u203d')
        u'\u203d \u203d\n'
        >>> t(u'$def with ()\nfoo')()
        u'foo\n'
        >>> def f(x): return x
        ...
        >>> t(u'$def with (f)\n$:f("x")')(f)
        u'x\n'
        >>> t('$def with (f)\n$:f("x")')(f)
        u'x\n'
    
    Test dollar escaping.
    
        >>> t("Stop, $$money isn't evaluated.")()
        u"Stop, $money isn't evaluated.\n"
        >>> t("Stop, \$money isn't evaluated.")()
        u"Stop, $money isn't evaluated.\n"
        
    Test space sensitivity.
    
        >>> t('$def with (x)\n$x')(1)
        u'1\n'
        >>> t('$def with(x ,y)\n$x')(1, 1)
        u'1\n'
        >>> t('$(1 + 2*3 + 4)')()
        u'11\n'
        
    Make sure globals are working.
            
        >>> t('$x')()
        Traceback (most recent call last):
            ...
        NameError: global name 'x' is not defined
        >>> t('$x', globals={'x': 1})()
        u'1\n'
        
    Can't change globals.
    
        >>> t('$ x = 2\n$x', globals={'x': 1})()
        u'2\n'
        >>> t('$ x = x + 1\n$x', globals={'x': 1})()
        Traceback (most recent call last):
            ...
        UnboundLocalError: local variable 'x' referenced before assignment
    
    Make sure builtins are customizable.
    
        >>> t('$min(1, 2)')()
        u'1\n'
        >>> t('$min(1, 2)', builtins={})()
        Traceback (most recent call last):
            ...
        NameError: global name 'min' is not defined
        
    Test vars.
    
        >>> x = t('$var x: 1')()
        >>> x.x
        u'1'
        >>> x = t('$var x = 1')()
        >>> x.x
        1
        >>> x = t('$var x:  \n    foo\n    bar')()
        >>> x.x
        u'foo\nbar\n'
    
    Test BOM chars.
    
        >>> t('\xef\xbb\xbf$def with(x)\n$x')('foo')
        u'foo\n'
    
    Test for with weird cases.
    
        >>> t('$for i in range(10)[1:5]:\n    $i')()
        u'1\n2\n3\n4\n'
        >>> t("$for k, v in sorted({'a': 1, 'b': 2}.items()):\n    $k $v", globals={'sorted':sorted})()
        u'a 1\nb 2\n'
    
    Test for syntax error.
    
        >>> try:
        ...     t("$for k, v in ({'a': 1, 'b': 2}.items():\n    $k $v")()
        ... except SyntaxError:
        ...     print("OK")
        ... else:
        ...     print("Expected SyntaxError")
        ...
        OK
    
    Test datetime.
    
        >>> import datetime
        >>> t("$def with (date)\n$date.strftime('%m %Y')")(datetime.datetime(2009, 1, 1))
        u'01 2009\n'
    
    N(    (    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyR   z  s    t   __main__s	   --compilei   (T   R   t
   __future__R    t   ioR   t   __all__Ry   R	  t   sysRF  R   t   warningsR%  t   utilsR	   R
   R   R   R  R   t   netR   t
   py3helpersR   R   t   UserDictR   t   objectR   t   collectionsR   R   R   R$   RC   R   R   RW   R   R   R   R   R]   R   R   R   R   RF   RR   R   R   t   TEMPLATE_BUILTIN_NAMESt   __builtin__R   R   R!   RQ  R   R  R   R   R   R   R-  R   RK  R   t   googleRS  t   ImportErrorR   R^  t	   ExceptionR   R   R  t   NodeVisitorR&  R  R   R   t   argvt   doctestt   testmod(    (    (    s   /mnt/my-files/home/darkz3ro/Desktop/my files/malware analysing and devlopment/viruses codes and analysis/APT34-leat/MuddyC3v1.0.1-/muddyc3_v1.0.1/lib/web/template.pyt   <module>   s  	"	 .

		='$RT		!	Lg	