|
| 1 | +import requests |
| 2 | +import argparse |
| 3 | +import sys |
| 4 | +import os |
| 5 | +from colorama import Fore |
| 6 | +import validators |
| 7 | +import time |
| 8 | + |
| 9 | +# Validations |
| 10 | + |
| 11 | +def check(url_list): |
| 12 | + for url in url_list: |
| 13 | + if not validators.url(url): |
| 14 | + print("You must specify a valid URL: {}".format(url)) |
| 15 | + print("Exiting...") |
| 16 | + sys.exit(1) |
| 17 | + |
| 18 | +def exploit(url_list, timeout, outfile): |
| 19 | + |
| 20 | + try: |
| 21 | + |
| 22 | + with open(outfile, "w") as f: |
| 23 | + f.write("Vulnerable domains\n\t") |
| 24 | + |
| 25 | + for url in url_list: |
| 26 | + |
| 27 | + print(Fore.WHITE + "Target Url {}".format(url)) |
| 28 | + print(Fore.RED+"------------------------------------------------------------------------") |
| 29 | + |
| 30 | + try: |
| 31 | + response = requests.get(url, timeout=timeout) |
| 32 | + |
| 33 | + if 'X-Frame-Options' not in response.headers or 'frame-ancestors' not in response.headers: |
| 34 | + print(Fore.GREEN + "\nYour target is vulnerable") |
| 35 | + print(Fore.GREEN + "Saving Vulnerable Url into Output File") |
| 36 | + time.sleep(3) |
| 37 | + f.write(url + "\n") |
| 38 | + else: |
| 39 | + print("Not vulnerable: {}".format(url)) |
| 40 | + |
| 41 | + except requests.exceptions.RequestException: |
| 42 | + print(f"An error occurred while connecting to the application: {url}") |
| 43 | + |
| 44 | + except Exception: |
| 45 | + |
| 46 | + print(Fore.RED+"An error occurred while opening or writing to the output file: {}".format(outfile)) |
| 47 | + print("Thank You For Using") |
| 48 | + time.sleep(2) |
| 49 | + sys.exit() |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +if __name__ == '__main__': |
| 54 | + |
| 55 | + print(Fore.LIGHTWHITE_EX +"-------------------------------------------------------------------------------------------------") |
| 56 | + print(Fore.RED + ''' |
| 57 | + ░█████╗░██╗░░░░░██╗░█████╗░██╗░░██╗░░░░░██╗░█████╗░░█████╗░██╗░░██╗░██████╗░█████╗░░█████╗░███╗░░██╗" |
| 58 | + "██╔══██╗██║░░░░░██║██╔══██╗██║░██╔╝░░░░░██║██╔══██╗██╔══██╗██║░██╔╝██╔════╝██╔══██╗██╔══██╗████╗░██║" |
| 59 | + "██║░░╚═╝██║░░░░░██║██║░░╚═╝█████═╝░░░░░░██║███████║██║░░╚═╝█████═╝░╚█████╗░██║░░╚═╝███████║██╔██╗██║" |
| 60 | + "██║░░██╗██║░░░░░██║██║░░██╗██╔═██╗░██╗░░██║██╔══██║██║░░██╗██╔═██╗░░╚═══██╗██║░░██╗██╔══██║██║╚████║" |
| 61 | + "╚█████╔╝███████╗██║╚█████╔╝██║░╚██╗╚█████╔╝██║░░██║╚█████╔╝██║░╚██╗██████╔╝╚█████╔╝██║░░██║██║░╚███║" |
| 62 | + "░╚════╝░╚══════╝╚═╝░╚════╝░╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝░░╚══╝\n''') |
| 63 | + print(Fore.LIGHTGREEN_EX + "\t\t\t\t\tWelcome to Albus Security") |
| 64 | + print(Fore.LIGHTWHITE_EX + '\t\t\t\t\tAuthor: Aniket Tyagi\n\n') |
| 65 | + |
| 66 | + # Argument Controller |
| 67 | + parser = argparse.ArgumentParser() |
| 68 | + group = parser.add_mutually_exclusive_group(required=True) |
| 69 | + group.add_argument('-U', '--url', help='Specify a single URL') |
| 70 | + group.add_argument('-L', '--list', help='Specify a file containing a list of URLs') |
| 71 | + parser.add_argument('-T', '--timeout', help='Maximum number of seconds to wait while requesting a web page (Default: 10)', default=10, type=int) |
| 72 | + parser.add_argument('-O', '--output', help='Specify the output file name') |
| 73 | + |
| 74 | + args = parser.parse_args() |
| 75 | + |
| 76 | + if args.url: |
| 77 | + url_list = [args.url] |
| 78 | + elif args.list: |
| 79 | + if not os.path.exists(args.list): |
| 80 | + print("The specified path to the URL list does not exist!") |
| 81 | + print("Exiting...") |
| 82 | + sys.exit(1) |
| 83 | + |
| 84 | + with open(args.list, 'r') as f: |
| 85 | + url_list = [line.strip() for line in f] |
| 86 | + |
| 87 | + check(url_list) |
| 88 | + exploit(url_list, args.timeout, args.output) |
| 89 | + |
| 90 | + print(Fore.GREEN + "The list of vulnerable domains has been stored in the specified file.\n") |
| 91 | + print(Fore.GREEN + "Thank you! Happy hacking!") |
0 commit comments