3
@6^5                 @   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               @   sZ   e Zd ZdZddddZddddZdZdZdZe	 fd	d
Z
dd Zdd Zdd ZdS )	sfp_nameszjName Extractor:Footprint,Passive:Real World:errorprone:Attempt to identify human names in fetched content.K   T)	algolimitemailtonamefilterjscsszA value between 0-100 to tune the sensitivity of the name finder. Less than 40 will give you a lot of junk, over 50 and you'll probably miss things but will have less false positives.zJConvert e-mail addresses in the form of firstname.surname@target to names?zFilter out names that originated from CSS/JS content. Enabling this avoids detection of popular Javascript and web framework author names.Nc             C   sX   || _ | j | _t| j j | _t| j j | _x"t|j	 D ]}|| | j
|< q>W d S )N)sftempStorageresultsset	dictwordsd	dictnamesnlistkeysopts)selfsfcuserOptsopt r   4/var/www/spiderfoot.crq.systems/modules/sfp_names.pysetup&   s    
zsfp_names.setupc             C   s   ddddddgS )NTARGET_WEB_CONTENT	EMAILADDRDOMAIN_WHOISNETBLOCK_WHOISRAW_RIR_DATARAW_FILE_META_DATAr   )r   r   r   r   watchedEvents1   s    zsfp_names.watchedEventsc             C   s   dgS )N
HUMAN_NAMEr   )r   r   r   r   producedEvents9   s    zsfp_names.producedEventsc             C   s"  |j }|j}|j}| jjd| d |  |dkrj|j}|d k	rj| jd rjd|ksZd|krj| jjd d S |dkoz| jd	 r2d
|jdd kr2t|t	krdj
tt	j|jdd jd
}n*dj
tt	j|jdd jd
}t	|}tjd|rd S td|| j|}|jr|j|_nd|_| j| d S tjd}tj||}	x|	D ]}
d}d}|
d j }|t|d  dksP|t|d  dkrqP|
d jdd}|jd}|
d j jdd}|jd}|| jkr|| jkr| jjd| d | d  |d7 }d}n| jj|d | d  || jkr@|d7 }t|dks\t|dkrd|d8 }|s|| jkr|| jkr|d 8 }|| jkr|| jkr|d!8 }|
d d | }| jjd"| d# t	|  || jd$ krPtd|| j|}|jr|j|_nd|_| j| qPW d S )%NzReceived event, z, from r   r	   z.jsz.cssz!Ignoring web content from CSS/JS.r   r   .@r    z[0-9]*r#   Unknownux   ([A-Z][a-z�������������]+)\s+.?.?\s?([A-Z][�������������a-zA-Z'\-]+)F   '   z's zPBoth first and second names are not in the dictionary, so high chance of name: (:z).r   Tz was found or z was found in dictionary.2      (   zName of z has score: r   )	eventTypemoduledatar
   debugactualSourcer   splittypestrjoinmap
capitalizerematchr   __name__moduleDataSourcenotifyListenerscompilefindalllowerlenreplacerstripr   r   )r   event	eventNamesrcModuleName	eventDataurlnameevtrxmrpZ	notindictfirstZ
secondOrigsecondr   r   r   handleEvent=   st    $"


,


zsfp_names.handleEvent)r>   
__module____qualname____doc__r   optdescsr   r   r   dictr   r"   r$   rT   r   r   r   r   r      s   r   )r<   sflibr   r   r   r   r   r   r   r   <module>   s   