├── subdomain-Enum.py └── README.md /subdomain-Enum.py: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/python 2 | import requests 3 | import json 4 | import os 5 | print ("\nSubdomain Enumeration Script\n") 6 | def get_sub_domains(domain,filepath): 7 | url = "https://api.securitytrails.com/v1/domain/"+domain+"/subdomains" 8 | #print(url) 9 | querystring = {"children_only":"true"} 10 | headers = { 11 | 'accept': "application/json", 12 | 'apikey': "APIKEY" 13 | } 14 | response = requests.request("GET", url, headers=headers, params=querystring) 15 | result_json=json.loads(response.text) 16 | sub_domains=[i+'.'+domain for i in result_json['subdomains']] 17 | f=open(filepath,'w+') 18 | for i in sub_domains: 19 | f.write(i+'\n') 20 | f.close() 21 | return sub_domains 22 | 23 | domain=input("\nEnter Domain name : ") 24 | filepath=input("\nPlease provide a file name to save : ") 25 | get_sub_domains(domain,filepath) 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CodeFactor](https://www.codefactor.io/repository/github/chaitanyakrishna/subdomain-enum/badge)](https://www.codefactor.io/repository/github/chaitanyakrishna/subdomain-enum) 2 | 3 | # Subdomain-Enum 4 | 5 | ## Subdomain Enumeration using Securitytrails API 6 | 7 | Following script enumaretes possible list of sub-domains using Securitytrails API 8 | 9 | ## Register 10 | 11 | Register account in [SecurityTrails.com](https://securitytrails.com/) 12 | 13 | Activate Account to get the API Key 14 | 15 | 16 | 17 | ## Usage 18 | 19 | ``` 20 | $ python subdomain-enum.py 21 | 22 | Subdomain Enumeration Script 23 | 24 | Enter Domain name : facebook.com 25 | 26 | Please provide a file name to save : facebook.csv 27 | 28 | $ head facebook.csv 29 | 30 | unity.cta.grid.facebook.com 31 | www-92.grid.facebook.com 32 | wn05.grid.facebook.com 33 | d.ns.c10r.facebook.com 34 | transport.facebook.com 35 | oldmutual.facebook.com 36 | jilin.facebook.com 37 | fna-internal-services-shv-02-fagc1.facebook.com 38 | campus.facebook.com 39 | presby.facebook.com 40 | 41 | ---Snipped--- 42 | ``` 43 | 44 | ## Contributing 45 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 46 | --------------------------------------------------------------------------------