3
@6^r                 @   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               @   sV   e Zd ZdZdZdddddZdd	d
ddZe fddZdd Z	dd Z
dd ZdS )sfp_pgpztPGP Key Look-up:Footprint,Investigate,Passive:Public Registries::Look up e-mail addresses in PGP public key servers.NzEhttps://pgp.key-server.io/pks/lookup?fingerprint=on&op=vindex&search=z3https://pgp.key-server.io/pks/lookup?op=get&search=z5http://the.earth.li:11371/pks/lookup?op=index&search=z3http://the.earth.li:11371/pks/lookup?op=get&search=)keyserver_search1keyserver_fetch1keyserver_search2keyserver_fetch2zYPGP public key server URL to find e-mail addresses on a domain. Domain will get appended.zhPGP public key server URL to find the public key for an e-mail address. Email address will get appended.z`Backup PGP public key server URL to find e-mail addresses on a domain. Domain will get appended.zoBackup PGP public key server URL to find the public key for an e-mail address. Email address will get appended.c             C   s>   || _ d| _| j | _x"t|j D ]}|| | j|< q$W d S )NzPGP Key Servers)sf__dataSource__tempStorageresultslistkeysopts)selfsfcuserOptsopt r   2/var/www/spiderfoot.crq.systems/modules/sfp_pgp.pysetup(   s
    
zsfp_pgp.setupc             C   s
   dddgS )NINTERNET_NAME	EMAILADDRDOMAIN_NAMEr   )r   r   r   r   watchedEvents1   s    zsfp_pgp.watchedEventsc             C   s
   dddgS )Nr   AFFILIATE_EMAILADDRPGP_KEYr   )r   r   r   r   producedEvents7   s    zsfp_pgp.producedEventsc             C   sX  |j }|j}|j}|| jkr d S d| j|< | jjd| d |  |dkrF| jj| jd | | jd | jd d	}|d
 d ks|d dkr| jj| jd | | jd | jd d	}|d
 d k	o|d dkrF| jj|d
 }xf|D ]^}d}|j	 j
dd }	| j j|	dddsd}| jjd|  t||| j|}
| j|
 qW |dkrT| jj| jd | | jd | jd d	}|d
 d ks|d dkr| jj| jd | | jd | jd d	}|d
 d k	rT|d dkrTtjdtjtjB }tj||d
 }xV|D ]N}| jjd|  t|dk r4| jjd qtd|| j|}
| j|
 qW d S )NTzReceived event, z, from r   r   r   _fetchtimeout
_useragent)timeout	useragentcontentcodeZ503r   r   @   )includeChildrenincludeParentsr   zFound e-mail address: r   r	   z(-----BEGIN.*END.*BLOCK-----)zFound public key: i,  zLikely invalid public key.r   )r   r   )	eventTypemoduledatar   r
   debugfetchUrlr   parseEmailslowersplit	getTargetmatchesinfor   __name__notifyListenersrecompile	MULTILINEDOTALLfindalllen)r   event	eventNamesrcModuleName	eventDataresemailsemailevttypemailDomevtpatr2   matchr   r   r   handleEvent;   sX    





zsfp_pgp.handleEvent)r4   
__module____qualname____doc__r   r   optdescsdictr   r   r   rH   r   r   r   r   r      s   	r   )r6   sflibr   r   r   r   r   r   r   r   <module>   s   