
"b<]c           @  s  d  Z  d d l m Z d d l m 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 d d	 l m Z m Z m Z m Z m 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 d d
 l Z y& d d l m Z m Z m  Z  m! Z! Wn3 e" k
 red d l m Z m Z m  Z  m! Z! n Xy d d l# m$ Z$ Wn9 e" k
 ry d d l% m$ Z$ Wn e" k
 rn Xn Xd d l& m' Z' d d d d d d d g Z( d f  d     YZ) d   Z* d e) f d     YZ+ e) Z, d e) f d     YZ- d   Z. d   Z/ d d  Z0 d f  d     YZ1 e2 d  k rd d
 l3 Z3 e3 j4   n  d
 S(!   s   
Web application
(from web.py)
i(   t   print_functioni   (   t   webapi(   R   t   wsgit   utilst   browser(   t
   debugerror(   t
   httpserver(   t   lstripst   safeunicode(   t	   iteritemst   string_typest   is_itert   PY2t	   text_typeN(   t   isclass(   t
   splitqueryt	   urlencodet   quotet   unquote(   t   reload(   t   BytesIOt   applicationt   auto_applicationt   subdir_applicationt   subdomain_applicationt   loadhookt
   unloadhookt   autodelegatec           B  s   e  Z d  Z d i  d d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d d	 d d
 d e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z g  d  Z d   Z d   Z d   Z d   Z d   Z RS(   s  
    Application to delegate requests based on path.
    
        >>> urls = ("/hello", "hello")
        >>> app = application(urls, globals())
        >>> class hello:
        ...     def GET(self): return "hello"
        >>>
        >>> app.request("/hello").data
        b'hello'
    c           s?  | d  k r$ t j j d t  } n   j |  |  _ g   _  j t	  j
    j t  j   | r;d       f d   } t j | |   | |      f d   }  j t	 t      r  r  j t	 |   n      r;d t j k r;y t      Wq8t k
 r4q8Xq;n  d  S(   Nt   debugc          S  sE   t  j d }  t |  d d   } | oD t j j t j j |   d S(   Nt   __main__t   __file__i    (   t   syst   modulest   getattrt   Nonet   ost   patht   splitextt   basename(   t   modt   file(    (    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/application.pyt   main_module_nameB   s    c           s[   |  j  d  |  j  d  } } | d k s7 | d k r; d S| d k rS     } n  | Sd S(   s(   find name of the module name from fvars.R   t   __name__NR   (   t   getR"   (   t   fvarsR(   t   name(   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/application.pyt   modnameG   s    c            sP   t   d d d g  }  t |    d  } | rL |  j  _  j |  n  d S(   s%   loadhook to reload mapping and fvars.t    N(   t
   __import__R"   R!   t   __dict__R,   t   init_mapping(   R'   t   mapping(   t   mapping_namet   module_namet   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/application.pyt   reload_mappingT   s    R   (   R"   t   webt   configR+   t   FalseR2   R,   t
   processorst   add_processorR   t   _loadR   t   _unloadR   t   dictfindt   ReloaderR   t   argvR0   t   ImportError(   R6   R3   R,   t
   autoreloadR.   R7   (    (   R)   R4   R5   R6   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/application.pyt   __init__8   s,    			
	
c         C  s   t  j j j |   d  S(   N(   R8   t   ctxt	   app_stackt   append(   R6   (    (    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/application.pyR=   h   s    c         C  s   t  j j d  t  j _ t  j j r| t  j j d  } | r| | j t  j _ | j t  j _ | j t  j _ | j t  j _ q| n  d  S(   Nit   _oldctx(   R8   RE   RF   R+   t   homet   homepathR$   t   fullpath(   R6   t   oldctx(    (    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/application.pyR>   k   s    c         C  s   t  j j   d  S(   N(   R   t   ThreadedDictt	   clear_all(   R6   (    (    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/application.pyt   _cleanupu   s    c         C  s   t  t j | d   |  _ d  S(   Ni   (   t   listR   t   groupR3   (   R6   R3   (    (    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/application.pyR2   x   s    c         C  s   |  j  j | | f  d  S(   N(   R3   RG   (   R6   t   patternt	   classname(    (    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/application.pyt   add_mapping{   s    c         C  s   |  j  j |  d S(   s  
        Adds a processor to the application. 
        
            >>> urls = ("/(.*)", "echo")
            >>> app = application(urls, globals())
            >>> class echo:
            ...     def GET(self, name): return name
            ...
            >>>
            >>> def hello(handler): return "hello, " +  handler()
            ...
            >>> app.add_processor(hello)
            >>> app.request("/web.py").data
            b'hello, web.py'
        N(   R;   RG   (   R6   t	   processor(    (    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/application.pyR<   ~   s    t   /t   GETs   0.0.0.0:8080c           s  t  |  \ } }	 |	 p d }
 d | k r7 | d } n i  } t | d | d | d | d |
 d t |  } | pv i  } x: | j   D], \ } } | | d | j   j d	 d
  <q Wd | k r | j d  | d <n  d | k r | j d  | d <n  | d k rq| pd } t | t  r0t |  } n | } t	 | j
 d   | d <d | k rqt |  | d <qqn  t j       f d   } |  j   | |  } d j |    _   S(   s  Makes request to this application for the specified path and method.
        Response will be a storage object with data, status and headers.
        
            >>> urls = ("/hello", "hello")
            >>> app = application(urls, globals())
            >>> class hello:
            ...     def GET(self): 
            ...         web.header('Content-Type', 'text/plain')
            ...         return "hello"
            ...
            >>> response = app.request("/hello")
            >>> response.data
            b'hello'
            >>> response.status
            '200 OK'
            >>> response.headers['Content-Type']
            'text/plain'
        
        To use https, use https=True.
        
            >>> urls = ("/redirect", "redirect")
            >>> app = application(urls, globals())
            >>> class redirect:
            ...     def GET(self): raise web.seeother("/foo")
            ...
            >>> response = app.request("/redirect")
            >>> response.headers['Location']
            'http://0.0.0.0:8080/foo'
            >>> response = app.request("/redirect", https=True)
            >>> response.headers['Location']
            'https://0.0.0.0:8080/foo'
        
        The headers argument specifies HTTP headers as a mapping object
        such as a dict.
        
            >>> urls = ('/ua', 'uaprinter')
            >>> class uaprinter:
            ...     def GET(self):
            ...         return 'your user-agent is ' + web.ctx.env['HTTP_USER_AGENT']
            ... 
            >>> app = application(urls, globals())
            >>> app.request('/ua', headers = {
            ...      'User-Agent': 'a small jumping bean/1.0 (compatible)'
            ... }).data
            b'your user-agent is a small jumping bean/1.0 (compatible)'
        
        R/   t   envt	   HTTP_HOSTt   REQUEST_METHODt	   PATH_INFOt   QUERY_STRINGt   HTTPSt   HTTP_t   -t   _t   HTTP_CONTENT_LENGTHt   CONTENT_LENGTHt   HTTP_CONTENT_TYPEt   CONTENT_TYPEt   HEADRW   s   utf-8s
   wsgi.inputc           s%   |    _  t |    _ |   _ d  S(   N(   t   statust   dictt   headerst   header_items(   Rf   Rh   (   t   response(    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/application.pyt   start_response   s    	(   Re   RW   (   R   Rg   t   strt   itemst   uppert   replacet   popt
   isinstanceR   R   t   encodet   lenR8   t   storaget   wsgifunct   joint   data(   R6   t	   localpartt   methodRw   t   hostRh   t   httpst   kwR$   t   maybe_queryt   queryRX   t   kt   vt   qRk   (    (   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/application.pyt   request   s4    00$c         C  s   t  j |   S(   N(   R   t
   AppBrowser(   R6   (    (    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/application.pyR      s    c         C  s7   |  j  |  j t j j  \ } } |  j | |  j |  S(   N(   t   _matchR3   R8   RE   R$   t	   _delegateR,   (   R6   t   fnt   args(    (    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/application.pyt   handle   s    !c           s      f d        j   S(   Nc           s   y?   r4   d   d }   |    f d    S j    SWn[ t j k
 rX   nE t t f k
 rq   n, t t j   d t j  j	    n Xd  S(   Ni    i   c             s
       S(   N(    (    (   t   processR;   (    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/application.pyt   <lambda>   R/   R(   (
   R   R8   t	   HTTPErrort   KeyboardInterruptt
   SystemExitt   printt	   tracebackt
   format_excR   t   internalerror(   R;   t   p(   R   R6   (   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/application.pyR      s    (   R;   (   R6   (    (   R   R6   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/application.pyt   handle_with_processors   s    c           s<   d        f d   } x | D] } | |  } q" W| S(   s8   Returns a WSGI-compatible function for this application.c         S  s=   y t  |   } Wn t k
 r) d } n Xt j | g |   S(   si   Peeps into an iterator by doing an iteration
            and returns an equivalent iterator.
            R/   (   t   nextt   StopIterationt	   itertoolst   chain(   t   iteratort
   firstchunk(    (    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/application.pyt   peep   s
    
c           s    j     j |   ya t j j j   t j j k rG t j    n   j   } t |  rn   |  } n	 | g } Wn" t j	 k
 r } | j
 g } n Xd   } | |  } t j j t j j } } | | |   f d   } t j | |    S(   Nc         s  sw   xp |  D]h } t  r$ t j |  Vq t | t  r; | Vq t | t  r[ | j d  Vq t |  j d  Vq Wd  S(   Ns   utf-8(   R   R   t   safestrRq   t   bytesR
   Rr   Rl   (   t   resultt   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/application.pyt   build_result  s    c           3  s     j    d Vd  S(   NR/   (   RO   (    (   R6   (    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/application.pyt   cleanup'  s    
(   RO   t   loadR8   RE   Ry   Rn   t   nomethodR   R   R   Rw   Rf   Rh   R   R   (   RX   t
   start_respR   t   eR   Rf   Rh   R   (   R   R6   (    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/application.pyR   
  s"    
	(    (   R6   t
   middlewareR   t   m(    (   R   R6   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/application.pyRu      s
    	#c         G  s   t  j |  j |    S(   s  
        Starts handling requests. If called in a CGI or FastCGI context, it will follow
        that protocol. If called from the command line, it will start an HTTP
        server on the port named in the first command line argument, or, if there
        is no argument, on port 8080.
        
        `middleware` is a list of WSGI middleware which is applied to the resulting WSGI
        function.
        (   R   t   runwsgiRu   (   R6   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/application.pyt   run2  s    
c         C  s&   t  j r" t  j j   d t  _ n  d S(   s.   Stops the http server started by run.
        N(   R   t   servert   stopR"   (   R6   (    (    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/application.pyR   >  s    	c         G  sX   |  j  |   } y d d l m } | |  SWn$ t k
 rS t j j   j |  SXd S(   s   
        Return a CGI handler. This is mostly useful with Google App Engine.
        There you can just do:
        
            main = app.cgirun()
        i(   t   run_wsgi_appN(   Ru   t    google.appengine.ext.webapp.utilR   RB   t   wsgireft   handlerst
   CGIHandlerR   (   R6   R   t   wsgiappR   (    (    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/application.pyt   cgirunF  s    c         G  s   |  j  |   } y t j d  } | d } | d } | d k rN t d   n  | d k r^ | S| d k r d d l m } | |  St d	   Wn$ t k
 r t j j	   j
 |  SXd
 S(   sy  
        Starts the program in a way that will work with Google app engine,
        no matter which version you are using (2.5 / 2.7)
        
        If it is 2.5, just normally start it with app.gaerun()
        
        If it is 2.7, make sure to change the app.yaml handler to point to the
        global variable that contains the result of app.gaerun()
        
        For example:
        
        in app.yaml (where code.py is where the main code is located)
        
            handlers:
            - url: /.*
              script: code.app
        
        Make sure that the app variable is globally accessible
        i   i    i   s2   Google App Engine only supports python 2.5 and 2.7i   i   i(   R   s/   Not a supported platform, use python 2.5 or 2.7N(   Ru   R   t   version_infot   EnvironmentErrorR   R   RB   R   R   R   R   (   R6   R   R   t   versiont   majort   minorR   (    (    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/application.pyt   gaerunT  s    


c         C  s>  t  j } | j   d | _ g  | _ d | _ | | _ | _ | j d  | _	 | j d  d k ru | d | _
 n3 | j d d  j   d k r d | _
 n	 d | _
 | j
 d | j d d  | _ t j j d | j d d   | _ | j | j | _ | j | _ | j d  | _ | j d  | _ | j d  | _ | j d d  j d  rt | j d  j d  d | j  | _ t | j  | _ n  | j d  rd | j d d  | _ n	 d | _ | j | j | _ xB t |  D]4 \ } } t | t  r| j d d  | | <qqWd | _ g  | _ d S(   s   Initializes ctx using env.s   200 OKR/   RY   s   wsgi.url_schemet   httpR{   R]   t   ont   truet   1s   ://s	   [unknown]t   REAL_SCRIPT_NAMEt   SCRIPT_NAMEt   REMOTE_ADDRRZ   R[   t   SERVER_SOFTWAREs	   lighttpd/t   REQUEST_URIt   ?i    R\   s   utf-8Ro   N(   R   R{   (   R   R   R   (   R8   RE   t   clearRf   Rh   t   outputt   environRX   R+   Rz   t   protocolt   lowert
   homedomainR#   RJ   RI   t   realhomet   ipRy   R$   t
   startswithR   t   splitR   R~   RK   R	   Rq   R   t   decodeRF   (   R6   RX   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/application.pyR   x  s>    	
				 $+		c   	        si    f d   } | d  k r* t j    n;t | t  rC | j   St |  rY | |  St | t  rE| j d  r | j	 d d  d } t j
 j d k r t j
 j j d d  } | r | d | 7} q n  t j |   nX d	 | k r1| j d	 d  \ } } t | d  d  d g  } t | |  } n
 | | } | |  St | d
  r[|   St j   Sd  S(   Nc           sn   t  j j } | d k r1 t |  |  r1 d } n  t |  |  sR t  j |    n  t |    |  } |     S(   NRe   RW   (   R8   RE   Ry   t   hasattrR   R!   (   t   clst   metht   tocall(   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/application.pyt   handle_class  s    	s	   redirect t    i   RW   R\   R/   R   t   .t   __call__(   R"   R8   t   notfoundRq   R   R   R   R
   R   R   RE   Ry   RX   R+   t   redirectt   rsplitR0   R!   R   (	   R6   t   fR,   R   R   t   urlt   xR'   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/application.pyR     s2    	




c           s   x | D] \    t   t  rV | j    r     f d   } | d  f Sq nS t   t  r t j d   f  |  \  } n t j d   f  j |  } | r  g  | j	   D] } | ^ q f Sq Wd S(   Nc             s    j      S(   N(   t   _delegate_sub_application(    (   t   patR6   t   what(    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/application.pyR     R/   s   ^%s\Z(   NN(
   Rq   R   R   R"   R
   R   t   re_submt
   re_compilet   matcht   groups(   R6   R3   t   valueR   R   R   (    (   R   R6   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/application.pyR     s    
%'c         C  s~   t  j t  j  t  j _ t  j j | 7_ t  j j | 7_ t  j j t |  t  j _ t  j j t |  t  j _ | j	   S(   s#  Deletes request to sub application `app` rooted at the directory `dir`.
        The home, homepath, path and fullpath values in web.ctx are updated to mimic request
        to the subapp and are restored after it is handled. 
        
        @@Any issues with when used with yield?
        (
   R8   Rt   RE   RH   RI   RJ   R$   Rs   RK   R   (   R6   t   dirt   app(    (    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/application.pyR     s    c         C  sL   |  t  j j k rH t  j j j |   } | d k rH t  j j | d Sn  d  S(   Ni    i   (   R8   RE   RF   t   index(   R6   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/application.pyt   get_parent_app  s    c         C  s*   |  j    } | r | j   St j   Sd S(   s.   Returns HTTPError with '404 not found' messageN(   R   R   R8   t	   _NotFound(   R6   t   parent(    (    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/application.pyR     s    
c         C  sC   |  j    } | r | j   St j j d  r5 t   St j   Sd S(   s3   Returns HTTPError with '500 internal error' messageR   N(   R   R   R8   R9   R+   R   t   _InternalError(   R6   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/application.pyR     s    
(    N(   R*   t
   __module__t   __doc__R"   RD   R=   R>   RO   R2   RT   R<   R:   R   R   R   R   Ru   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/application.pyR   +   s0   0		
				S				6				$	%&				c           s     f d   } | S(   Nc           sH   t  |   j   } | j d d   | j d d     |  j |  j |  S(   NR1   t   __weakref__(   t   varst   copyRp   R"   R*   t	   __bases__(   R   t   body(   t   mcls(    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/application.pyt	   decorator  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/application.pyt   with_metaclass  s    c           B  s   e  Z d  Z d   Z RS(   s  Application similar to `application` but urls are constructed 
    automatically using metaclass.
    
        >>> app = auto_application()
        >>> class hello(app.page):
        ...     def GET(self): return "hello, world"
        ...
        >>> class foo(app.page):
        ...     path = '/foo/.*'
        ...     def GET(self): return "foo"
        >>> app.request("/hello").data
        b'hello, world'
        >>> app.request('/foo/bar').data
        b'foo'
    c           sU   t  j    d t f   f d     Y} t |  d d d     Y } |   _ d  S(   Nt   metapagec             s   e  Z   f d    Z RS(   c           sO   t  j |  | | |  | j d d |  } | d  k	 rK   j | |   n  d  S(   NR$   RV   (   t   typeRD   R+   R"   RT   (   t   klassR-   t   basest   attrsR$   (   R6   (    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/application.pyRD     s
    (   R*   R   RD   (    (   R6   (    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/application.pyR     s   t   pagec           B  s   e  Z d  Z RS(   N(   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/application.pyR   "  s   (    (   R   RD   R   R   R   (   R6   R   R   (    (   R6   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/application.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/application.pyR     s   c           B  s    e  Z d  Z d   Z d   Z RS(   sS  
    Application to delegate requests based on the host.
    
        >>> urls = ("/hello", "hello")
        >>> app = application(urls, globals())
        >>> class hello:
        ...     def GET(self): return "hello"
        >>>
        >>> mapping = (r"hello\.example\.com", app)
        >>> app2 = subdomain_application(mapping)
        >>> app2.request("/hello", host="hello.example.com").data
        b'hello'
        >>> response = app2.request("/hello", host="something.example.com")
        >>> response.status
        '404 Not Found'
        >>> response.data
        b'not found'
    c         C  sJ   t  j j j d  d } |  j |  j |  \ } } |  j | |  j |  S(   Nt   :i    (   R8   RE   Rz   R   R   R3   R   R,   (   R6   Rz   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/application.pyR   @  s    c         C  s   x | D] \ } } t  | t  rH t j d | d | |  \ } } n  t j d | d  j |  } | r | g  | j   D] } | ^ q~ f Sq Wd S(   Nt   ^t   $(   NN(   Rq   R
   R   R   R   R   R   R"   (   R6   R3   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/application.pyR   E  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/application.pyR   ,  s   	c           s     f d   } | S(   s   
    Converts a load hook into an application processor.
    
        >>> app = auto_application()
        >>> def f(): "something done before handling request"
        ...
        >>> app.add_processor(loadhook(f))
    c           s       |    S(   N(    (   t   handler(   t   h(    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/application.pyRU   [  s    (    (   R   RU   (    (   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/application.pyR   Q  s    
c           s%      f d   }   f d    | S(   s   
    Converts an unload hook into an application processor.
    
        >>> app = auto_application()
        >>> def f(): "something done after handling request"
        ...
        >>> app.add_processor(unloadhook(f))    
    c           sL   y |    } t  |  } Wn       n X| r=  |  S    | Sd  S(   N(   R   (   R   R   t   is_gen(   R   t   wrap(    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/application.pyRU   l  s    	
c         3  s7      f d   } t       x t r2 |   Vq! Wd  S(   Nc             s&   y t    SWn       n Xd  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/application.pyt	   next_hook|  s
    (   t   itert   True(   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/application.pyR   z  s    	(    (   R   RU   (    (   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/application.pyR   b  s    
R/   c           s     f d   } | S(   sA  
    Returns a method that takes one argument and calls the method named prefix+arg,
    calling `notfound()` if there isn't one. Example:
    
        urls = ('/prefs/(.*)', 'prefs')
    
        class prefs:
            GET = autodelegate('GET_')
            def GET_password(self): pass
            def GET_privacy(self): pass
    
    `GET_password` would get called for `/prefs/password` while `GET_privacy` for 
    `GET_privacy` gets called for `/prefs/privacy`.
    
    If a user visits `/prefs/password/change` then `GET_password(self, '/change')`
    is called.
    c           s   d | k r> | j  d d  \ } }   | } d | g } n   | } g  } t |  |  r y t |  |  |   SWq t k
 r t j    q Xn t j    d  S(   NRV   i   (   R   R   R!   t	   TypeErrorR8   R   (   R6   t   argt   firstt   restt   funcR   (   t   prefix(    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/application.pyt   internal  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/application.pyR     s    R@   c           B  sJ   e  Z d  Z e j j d  r' d Z n d Z d   Z d   Z d   Z	 RS(   s\   Checks to see if any loaded modules have changed on disk and, 
    if so, reloads them.
    t   javas	   $py.classs   .pycc         C  s   i  |  _  d  S(   N(   t   mtimes(   R6   (    (    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/application.pyRD     s    c         C  s+   x$ t  j j   D] } |  j |  q Wd  S(   N(   R   R    t   valuest   check(   R6   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/application.pyR     s    c         C  s  | o t  | d  o | j s" d  Sy t j | j  j } Wn t t f k
 rU d  SX| j j |  j j	  r t j
 j | j d   r t t j | j d   j |  } n  | |  j k r | |  j | <nE |  j | | k  ry t |  | |  j | <Wqt k
 rqXn  d  S(   NR   i(   R   R   R#   t   statt   st_mtimet   OSErrort   IOErrort   endswitht	   __class__t   SUFFIXR$   t   existst   maxR  R   RB   (   R6   R'   t   mtime(    (    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/application.pyR    s     1%
(
   R*   R   R   R   t   platformR   R  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/application.pyR@     s   			R   (5   R   t
   __future__R    R/   R   R8   R   R   R   R   R   R   R   t
   py3helpersR	   R
   R   R   R   R   t   urllibR   R   R#   t   typest   inspectR   t   wsgiref.handlersR   t   urllib.parseR   R   R   R   RB   t	   importlibR   t   impt   ioR   t   __all__R   R   R   R   R   R   R   R   R@   R*   t   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/application.pyt   <module>   s^   "(&&	 	%%		('$