
    Xh[#                     Z    d Z ddlmZ ddlmZmZ ddlZda G d d      Z G d de      Z	y)	zoSherlock Notify Module

This module defines the objects for notifying the caller about the
results of queries.
    )QueryStatus)ForeStyleNc                   4    e Zd ZdZddZddZd ZddZd Zy)	QueryNotifyzQuery Notify Object.

    Base class that describes methods available to notify the results of
    a query.
    It is intended that other classes inherit from this base class and
    override the methods to implement specific functionality.
    Nc                     || _         y)a~  Create Query Notify Object.

        Contains information about a specific method of notifying the results
        of a query.

        Keyword Arguments:
        self                   -- This object.
        result                 -- Object of type QueryResult() containing
                                  results for this query.

        Return Value:
        Nothing.
        Nresultselfr
   s     ?/var/www/betterdocs.net/sherlock_api/sherlock_project/notify.py__init__zQueryNotify.__init__            c                      y)a  Notify Start.

        Notify method for start of query.  This method will be called before
        any queries are performed.  This method will typically be
        overridden by higher level classes that will inherit from it.

        Keyword Arguments:
        self                   -- This object.
        message                -- Object that is used to give context to start
                                  of query.
                                  Default is None.

        Return Value:
        Nothing.
        N r   messages     r   startzQueryNotify.start*       r   c                     || _         y)a  Notify Update.

        Notify method for query result.  This method will typically be
        overridden by higher level classes that will inherit from it.

        Keyword Arguments:
        self                   -- This object.
        result                 -- Object of type QueryResult() containing
                                  results for this query.

        Return Value:
        Nothing.
        Nr	   r   s     r   updatezQueryNotify.update=   r   r   c                      y)a  Notify Finish.

        Notify method for finish of query.  This method will be called after
        all queries have been performed.  This method will typically be
        overridden by higher level classes that will inherit from it.

        Keyword Arguments:
        self                   -- This object.
        message                -- Object that is used to give context to start
                                  of query.
                                  Default is None.

        Return Value:
        Nothing.
        Nr   r   s     r   finishzQueryNotify.finishP   r   r   c                 ,    t        | j                        S zConvert Object To String.

        Keyword Arguments:
        self                   -- This object.

        Return Value:
        Nicely formatted string to get information about this object.
        strr
   r   s    r   __str__zQueryNotify.__str__c        4;;r   )N)	__name__
__module____qualname____doc__r   r   r   r   r    r   r   r   r   r      s     &&&&	 r   r   c                   D     e Zd ZdZd fd	Zd Zd Zd Zd	dZd Z	 xZ
S )
QueryNotifyPrintzLQuery Notify Print Object.

    Query notify class that prints results.
    c                 N    t         |   |       || _        || _        || _        y)a  Create Query Notify Print Object.

        Contains information about a specific method of notifying the results
        of a query.

        Keyword Arguments:
        self                   -- This object.
        result                 -- Object of type QueryResult() containing
                                  results for this query.
        verbose                -- Boolean indicating whether to give verbose output.
        print_all              -- Boolean indicating whether to only print all sites, including not found.
        browse                 -- Boolean indicating whether to open found sites in a web browser.

        Return Value:
        Nothing.
        N)superr   verbose	print_allbrowse)r   r
   r*   r+   r,   	__class__s        r   r   zQueryNotifyPrint.__init__u   s*    $ 	 "r   c                 $   d}t        t        j                  t        j                  z   dz   t        j
                  z   dz   t        j                  z   d| z   t        j                  z   d| z   t        j                  z   dz          t        d       y)	aD  Notify Start.

        Will print the title to the standard output.

        Keyword Arguments:
        self                   -- This object.
        message                -- String containing username that the series
                                  of queries are about.

        Return Value:
        Nothing.
        zChecking username[*z]  z on:N)printr   BRIGHTr   GREENYELLOWWHITE)r   r   titles      r   r   zQueryNotifyPrint.start   s     $ellTZZ'#-kk jjw<( jj wi=) jj	 "	" 	# 	dr   c                      t         dz  a t         S )a&  This function counts the number of results. Every time the function is called,
        the number of results is increasing.

        Keyword Arguments:
        self                   -- This object.

        Return Value:
        The number of results by the time we call the function.
           )globvarr   s    r   countResultszQueryNotifyPrint.countResults   s     	1r   c                 	   || _         d}| j                   j                  4| j                  du r&dt        | j                   j                  dz         d}|j                  t
        j                  k(  r| j                          t        t        j                  t        j                  z   dz   t        j                  z   dz   t        j                  z   d	z   |z   t        j                  z   d
| j                   j                   dz   t        j                  z   | j                   j                    z          | j"                  r*t%        j&                  | j                   j                   d       y|j                  t
        j(                  k(  r| j*                  rt        t        j                  t        j                  z   dz   t        j,                  z   dz   t        j                  z   d	z   |z   t        j                  z   d
| j                   j                   dz   t        j.                  z   dz          y|j                  t
        j0                  k(  r| j*                  rt        t        j                  t        j                  z   dz   t        j,                  z   dz   t        j                  z   d	z   t        j                  z   d
| j                   j                   dz   t        j,                  z   d
| j                   j2                   z   t        j.                  z   d
z          y|j                  t
        j4                  k(  r| j*                  rd}t        t        j                  t        j                  z   dz   t        j,                  z   dz   t        j                  z   d	z   t        j                  z   d
| j                   j                   dz   t        j.                  z   d
| z          y|j                  t
        j6                  k(  r| j*                  rt        t        j                  t        j                  z   dz   t        j,                  z   dz   t        j                  z   d	z   t        j                  z   d
| j                   j                   dz   t        j,                  z   dz   t        j.                  z   dz          yt9        d|j                   d| j                   j                   d      )aK  Notify Update.

        Will print the query result to the standard output.

        Keyword Arguments:
        self                   -- This object.
        result                 -- Object of type QueryResult() containing
                                  results for this query.

        Return Value:
        Nothing.
         NTz [i  zms]r/   +]r1   z:    -:z Not Found!z&Illegal Username Format For This Site!z Blocked by bot detectionz (proxy may help)zUnknown Query Status 'z' for site '')r
   
query_timer*   roundstatusr   CLAIMEDr<   r3   r   r4   r   r7   r5   	site_name	RESET_ALLsite_url_userr,   
webbrowseropen	AVAILABLEr+   REDr6   UNKNOWNcontextILLEGALWAF
ValueError)r   r
   response_time_textmsgs       r   r   zQueryNotifyPrint.update   sc    ;;!!-$,,$2F#%eDKK,B,BT,I&J%K3!O ==K///%,,+c1**"#**"# %% **	
 dkk++,B/0 //" [[../1 2 {{ 9 91=X 	U ]]k333~~ellTZZ/#5hh!$%jj!#&' )) jj	! &'t{{'<'<&=Q#?	@
 kk"
 %22 3P 	C ]]k111~~ellTZZ/#5hh!$%jj!#&' jj! &'t{{'<'<&=Q#?@ hh	 $%T[[%8%8$9!:	;
 kk"
 %(( )> 	1 ]]k111~~>ellTZZ/#5hh!$%jj!#&' jj! &'t{{'<'<&=Q#?@ kk	" '(uI	. /* 	 ]]koo-~~ellTZZ/#5hh!$%jj!#&' jj! &'t{{'<'<&=Q#?@ hh	 "=	=
 kk"
 %88 9 		 (|DKKDYDYCZZ[\ r   c                 N   | j                         dz
  }t        t        j                  t        j
                  z   dz   t        j                  z   dz   t        j
                  z   dz   t        j                  z   d| dz   t        j
                  z   dz   t        j                  z          y)zNotify Start.
        Will print the last line to the standard output.
        Keyword Arguments:
        self                   -- This object.
        message                -- The 2 last phrases.
        Return Value:
        Nothing.
        r:   r/   r0   z] Search completed withr1   resultsN)	r<   r3   r   r4   r   r5   r6   r7   rJ   )r   r   NumberOfResultss      r   r   zQueryNotifyPrint.finish  s     ++-1ellTZZ'#-kk jj45 jj /q12 jj	 %	% (-	7 	r   c                 ,    t        | j                        S r   r   r   s    r   r    zQueryNotifyPrint.__str__  r!   r   )NFFF)z!The processing has been finished.)r"   r#   r$   r%   r   r   r<   r   r   r    __classcell__)r-   s   @r   r'   r'   o   s(    
24KZ$	 r   r'   )
r%   sherlock_project.resultr   coloramar   r   rL   r;   r   r'   r   r   r   <module>r^      s7   
 0    ^  ^ Bo { o r   