3
@6^                 @   s4   d dl mZ d dlmZmZmZ G dd deZdS )    )	IPNetwork)
SpiderFootSpiderFootPluginSpiderFootEventc               @   s   e Zd ZdZdddddZdddddZd	Zd
dddddddddddddiZe fddZ	dd Z
dd Zdd Zd d! Zd"d# Zd	S )$sfp_droneblzDroneBL:Investigate,Passive:Reputation Systems::Query the DroneBL  database for open relays, open proxies, vulnerable servers, etc.T   )netblocklookupmaxnetblocksubnetlookup	maxsubnetzLook up all IPs on netblocks deemed to be owned by your target for possible blacklisted hosts on the same target subdomain/domain?zyIf looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)zKLook up all IPs on subnets which your target is a part of for blacklisting?zsIf looking up subnets, the maximum subnet size to look up all the IPs within (CIDR value, 24 = /24, 16 = /16, etc.)Nzdnsbl.dronebl.orgzdronebl.org - IRC Dronezdronebl.org - Bottlerz&dronebl.org - Unknown spambot or dronezdronebl.org - DDOS Dronezdronebl.org - SOCKS Proxyzdronebl.org - HTTP Proxyzdronebl.org - ProxyChainz#dronebl.org - Brute force attackersz dronebl.org - Open Wingate Proxyz*dronebl.org - Compromised router / gatewayz@dronebl.org - Automatically determined botnet IPs (experimental)zdronebl.org - Unknown)z	127.0.0.3z	127.0.0.5z	127.0.0.6z	127.0.0.7z	127.0.0.8z	127.0.0.9z
127.0.0.10z
127.0.0.13z
127.0.0.14z
127.0.0.15z
127.0.0.17z127.0.0.255c             C   s8   || _ | j | _x"t|j D ]}|| | j|< qW d S )N)sftempStorageresultslistkeysopts)selfsfcuserOptsopt r   6/var/www/spiderfoot.crq.systems/modules/sfp_dronebl.pysetup?   s    
zsfp_dronebl.setupc             C   s   ddddgS )N
IP_ADDRESSAFFILIATE_IPADDRNETBLOCK_OWNERNETBLOCK_MEMBERr   )r   r   r   r   watchedEventsG   s    zsfp_dronebl.watchedEventsc             C   s   ddddgS )NBLACKLISTED_IPADDRBLACKLISTED_AFFILIATE_IPADDRBLACKLISTED_SUBNETBLACKLISTED_NETBLOCKr   )r   r   r   r   producedEventsN   s    zsfp_dronebl.producedEventsc             C   s   dj t|jdS )N.)joinreversedsplit)r   ipaddrr   r   r   reverseAddrS   s    zsfp_dronebl.reverseAddrc             C   s  |j }x| jD ]}| j r"d S y:| j|d | }| jjd|  | jj|}|sZw| jjdt|  d }x|D ]}t| j| tkr| j| d | d }P qxt|t	| j| j
 kr| jjdt|  qxt|}	| j| |	 d | d }P qxW |d k	r\|dkrd}
|d	kr&d
}
|dkr4d}
|dkrBd}
t|
|| j|}| j| W q tk
r }
 z*| jjd| d | d t|
  W Y d d }
~
X qX qW d S )Nr#   zChecking Blacklist: zAddresses returned: z ()zReturn code not found in list: r   r   r   r   r   r!   r   r    zUnable to resolve z / z: )	eventTypecheckscheckForStopr(   r   debugresolveHoststrtyper   r   r   __name__notifyListenersBaseException)r   qaddrparentEvent	eventNamedomainlookupaddrstextaddrkeevtr   r   r   	queryAddrV   sH    





:zsfp_dronebl.queryAddrc             C   sT  |j }|j}|j}|}t }| jjd| d |  || jkrBd S d| j|< |dkr| jd sbd S t|j	| jd k r| jjdt
t|j	 d t
| jd   d S |d	kr| jd
 sd S t|j	| jd k r| jjdt
t|j	 d t
| jd   d S |jdrDx>t|D ]$}| j r,d S | jt
|| qW n| j|| d S )NzReceived event, z, from Tr   r   r	   z$Network size bigger than permitted: z > r   r
   r   	NETBLOCK_)r*   moduledatar   r   r-   r   r   r   	prefixlenr/   
startswithr,   r?   )r   eventr6   srcModuleName	eventDatar5   addrlistr;   r   r   r   handleEvent   s>    





zsfp_dronebl.handleEvent)r1   
__module____qualname____doc__r   optdescsr   r+   dictr   r   r"   r(   r?   rI   r   r   r   r   r      s:   
0r   N)netaddrr   sflibr   r   r   r   r   r   r   r   <module>   s   