U
    @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   s4   || _ |  | _t| D ]}|| | j|< q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 t|dS )N.)joinreversedsplit)r   ipaddrr   r   r   reverseAddrS   s    zsfp_dronebl.reverseAddrc                 C   s  |j }| jD ]}|  r  d S z@| |d | }| jd|  | j|}|sZW q| jdt|  d }|D ]}t| j| tkr| j| d | d } qqvt|t	| j| 
 kr| jdt|  qvt|}	| j| |	 d | d } qqv|d k	r`|dkrd}
|d	kr*d
}
|dkr8d}
|dkrFd}
t|
|| j|}| | W q tk
r }
 z(| jd| d | d t|
  W 5 d }
~
X Y qX q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    




8zsfp_dronebl.queryAddrc                 C   sR  |j }|j}|j}|}t }| jd| d |  || jkrBd S d| j|< |dkr| jd sbd S t|j	| jd k r| 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dt
t|j	 d t
| jd   d S |drBt|D ]&}|  r, d S | t
|| qn| || 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   	prefixlenr0   
startswithr-   r@   )r   eventr7   srcModuleName	eventDatar6   addrlistr<   r   r   r   handleEvent   sN    





zsfp_dronebl.handleEvent)r2   
__module____qualname____doc__r   optdescsr   r,   dictr   r   r#   r)   r@   rJ   r   r   r   r   r      sB   	0r   N)netaddrr   sflibr   r   r   r   r   r   r   r   <module>   s   