Created
March 21, 2020 18:55
-
-
Save Anirbansingha1/98ec28e9c836ff85f72a40ff6bdef474 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| ------------------------------------------------------------------------------ | |
| CTFR - 04.03.18.02.10.00 - Sheila A. Berta (UnaPibaGeek) | |
| ------------------------------------------------------------------------------ | |
| """ | |
| ## # LIBRARIES # ## | |
| import re | |
| import requests | |
| ## # CONTEXT VARIABLES # ## | |
| version = 1.2 | |
| ## # MAIN FUNCTIONS # ## | |
| def parse_args(): | |
| import argparse | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-d', '--domain', type=str, required=True, help="Target domain.") | |
| parser.add_argument('-o', '--output', type=str, help="Output file.") | |
| return parser.parse_args() | |
| def banner(): | |
| global version | |
| b = ''' | |
| ____ _____ _____ ____ | |
| / ___|_ _| ___| _ \ | |
| | | | | | |_ | |_) | | |
| | |___ | | | _| | _ < | |
| \____| |_| |_| |_| \_\\ | |
| Version {v} - Hey don't miss AXFR! | |
| Made by Sheila A. Berta (UnaPibaGeek) | |
| '''.format(v=version) | |
| print(b) | |
| def clear_url(target): | |
| return re.sub('.*www\.','',target,1).split('/')[0].strip() | |
| def save_subdomains(subdomain,output_file): | |
| with open(output_file,"a") as f: | |
| f.write(subdomain + '\n') | |
| f.close() | |
| def main(): | |
| banner() | |
| args = parse_args() | |
| subdomains = [] | |
| target = clear_url(args.domain) | |
| output = args.output | |
| req = requests.get("https://crt.sh/?q=%.{d}&output=json".format(d=target)) | |
| if req.status_code != 200: | |
| print("[X] Information not available!") | |
| exit(1) | |
| for (key,value) in enumerate(req.json()): | |
| subdomains.append(value['name_value']) | |
| print("\n[!] ---- TARGET: {d} ---- [!] \n".format(d=target)) | |
| subdomains = sorted(set(subdomains)) | |
| for subdomain in subdomains: | |
| print("[-] {s}".format(s=subdomain)) | |
| if output is not None: | |
| save_subdomains(subdomain,output) | |
| print("\n\n[!] Done. Have a nice day! ;).") | |
| main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment