3
@†6^	  ã               @   s0   d dl Z d dlmZmZmZ G dd„ deƒZdS )é    N)Ú
SpiderFootÚSpiderFootPluginÚSpiderFootEventc               @   s>   e Zd ZdZi ZdZeƒ fdd„Zdd„ Zdd„ Z	d	d
„ Z
dS )Ú
sfp_cookiez_Cookies:Footprint,Investigate,Passive:Crawling and Scanning::Extract Cookies from HTTP headers.Nc             C   s8   || _ | jƒ | _x"t|jƒ ƒD ]}|| | j|< qW d S )N)ÚsfÚtempStorageÚresultsÚlistÚkeysÚopts)ÚselfÚsfcÚuserOptsÚopt© r   ú5/var/www/spiderfoot.crq.systems/modules/sfp_cookie.pyÚsetup   s    
zsfp_cookie.setupc             C   s   dgS )NZWEBSERVER_HTTPHEADERSr   )r   r   r   r   ÚwatchedEvents    s    zsfp_cookie.watchedEventsc             C   s   dgS )NÚTARGET_WEB_COOKIEr   )r   r   r   r   ÚproducedEvents&   s    zsfp_cookie.producedEventsc       	      C   sâ   |j }|j}|j}|j}| jjd| d | ƒ || jkr>d S d| j|< | jƒ j| jj	|ƒƒsn| jjdƒ d S yt
j|ƒ}|d kr†d S W n. tk
r¶ } z| jjddƒ d S d }~X nX d|krÞtd|d | j|ƒ}| j|ƒ d S )	NzReceived event, z, from Tz+Not collecting cookies from external sites.zBReceived HTTP headers from another module in an unexpected format.Fz
set-cookier   )Ú	eventTypeÚmoduleÚdataÚactualSourcer   Údebugr   Ú	getTargetÚmatchesÚurlFQDNÚjsonÚloadsÚBaseExceptionÚerrorr   Ú__name__ÚnotifyListeners)	r   ÚeventÚ	eventNameÚsrcModuleNameÚ	eventDataÚeventSourceZjdataÚeÚevtr   r   r   ÚhandleEvent*   s,    




zsfp_cookie.handleEvent)r"   Ú
__module__Ú__qualname__Ú__doc__r   r   Údictr   r   r   r+   r   r   r   r   r      s   r   )r   Úsflibr   r   r   r   r   r   r   r   Ú<module>   s   