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               @   sJ   e Zd ZdZi Zi ZdZe fddZdd Z	dd Z
d	d
 Zdd ZdS )sfp_openbugbountyzOpen Bug Bounty:Footprint,Investigate,Passive:Leaks, Dumps and Breaches::Check external vulnerability scanning/reporting service openbugbounty.org to see if the target is listed.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   </var/www/spiderfoot.crq.systems/modules/sfp_openbugbounty.pysetup"   s    
zsfp_openbugbounty.setupc             C   s   dgS )NINTERNET_NAMEr   )r   r   r   r   watchedEvents-   s    zsfp_openbugbounty.watchedEventsc             C   s
   dg}|S )NVULNERABILITYr   )r   retr   r   r   producedEvents1   s    z sfp_openbugbounty.producedEventsc       	      C   s   t  }d}d| }| jj|d| jd d}|d d krF| jjd d S yjtjd| d	 tj}xN|j|d D ]<}|d
 |ks|d
 j	d| rn|j
d| |d  d  qnW W n6 tk
r } z| jjdt| d d S d }~X nX |S )Nzhttps://www.openbugbounty.orgz-https://www.openbugbounty.org/search/?search=   
_useragent)timeout	useragentcontentz*No content returned from openbugbounty.orgz'.*<div class=.cell1.><a href=.(.*).>(.*z).*?</a></div>.*   .zFrom openbugbounty.org: <SFURL>r   z</SFURL>z2Error processing response from openbugbounty.org: F)r	   r   fetchUrlr   debugrecompile
IGNORECASEfindallendswithappend	Exceptionerrorstr)	r   qryr   baseurlresrxmer   r   r   queryOBB7   s     "zsfp_openbugbounty.queryOBBc       	      C   s   |j }|j}|j}t }| jjd| d |  || jkrR| jjd| d  d S d| j|< | j|}|rt|j| x&|D ]}t	d|| j
|}| j| qzW d S )NzReceived event, z, from z	Skipping z as already mapped.Tr   )	eventTypemoduledatar	   r   r    r   r1   extendr   __name__notifyListeners)	r   event	eventNamesrcModuleName	eventDatar4   obbnr0   r   r   r   handleEventM   s    




zsfp_openbugbounty.handleEvent)r6   
__module____qualname____doc__r   optdescsr   dictr   r   r   r1   r>   r   r   r   r   r      s   r   )r!   sflibr   r   r   r   r   r   r   r   <module>   s   