-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubdomainEnum.py
55 lines (42 loc) · 1.54 KB
/
SubdomainEnum.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from typing import List
import bbot.core.event
import bbot.modules
import bbot.scanner
import logging
import bbot
#Disable logging info in terminal
logging.getLogger('bbot').setLevel(0)
def GetSDEModules() -> list[str]:
'''
Returns name of all subdomain enumeration related modules available on bbot.
'''
try:
ScanModules = bbot.configurator.module_loader.filter_modules(mod_type='scan')
SubEnumModules = []
for Module in ScanModules:
Name, Properties = Module
if 'subdomain-enum' in Properties['flags']:
SubEnumModules.append(Name)
return SubEnumModules
except Exception:
print("An error occured while loading some modules, check you connection")
exit(1)
def getScanner(targets, name) -> bbot.scanner.Scanner :
'''
Return the prepared scanner object.
'''
SDScanner = bbot.scanner.Scanner(*targets, modules=GetSDEModules(), name=name)
return SDScanner
def runScan(targets, name) -> List[str]:
SubDomains = []
PreparedScanner = getScanner(targets, name)
try:
for event in PreparedScanner.start():
if type(event) == bbot.core.event.base.DNS_NAME:
if 'in-scope' in event.tags:
print(f'found subdomain in scope: {event.data}')
SubDomains.append(event.data)
print(f"Found {len(SubDomains)} Subdomains!")
return SubDomains
except Exception as e:
print(f"An error occured {e}")