#!/usr/bin/env/ python

import scanner
import colorama
import sys

def banner():
    print(colorama.Fore.LIGHTRED_EX+"__  ______ ____  _                 _   ")
    print(colorama.Fore.LIGHTRED_EX+"\ \/ / ___/ ___|| |__  _   _ _ __ | |_")
    print(colorama.Fore.LIGHTWHITE_EX+" \  /\___ \___ \| '_ \| | | | '_ \| __|")
    print(colorama.Fore.LIGHTWHITE_EX+" /  \ ___) |__) | | | | |_| | | | | |_ ")
    print(colorama.Fore.LIGHTGREEN_EX+"/_/\_\____/____/|_| |_|\__,_|_| |_|\__|")
    print(colorama.Fore.LIGHTGREEN_EX+"\n**** Developed By Krunalkumar Patel ****\n"+colorama.Fore.WHITE)

banner()
target_url=input(colorama.Fore.LIGHTGREEN_EX+"Enter the target URL: "+colorama.Fore.WHITE)



#target_url="http://10.0.2.4/mutillidae/"
links_to_ignore=["http://10.0.2.4/dvwa/logout.php"]
data_dict = {"username":"admin","password":"password","Login":"submit"}

vuln_scanner=scanner.Scanner(target_url,links_to_ignore)
vuln_scanner.session.post("http://10.0.2.4/dvwa/login.php",data=data_dict)
if(vuln_scanner.is_started_with(target_url)):
    pass
else:
    print(colorama.Fore.LIGHTRED_EX+"\n[-] Invalid URL"+colorama.Fore.WHITE)
    print("\n[***]  Please Run Again and Meantion URL with it's Protocol.\n       example: http://10.0.2.4/dvwa/ \n       example: http://10.0.2.4/Mutillidae/ \n")
    sys.exit(0)
print("--" * 50)
print(colorama.Fore.CYAN+"\n\n[*] Crawling is started for "+target_url+"\n"+colorama.Fore.WHITE)
print("--" * 50)
vuln_scanner.crawl()
vuln_scanner.run_scanner()

print("--" * 50)
print(colorama.Fore.CYAN+"\n\n[*] Scanning is completed for "+target_url+"\n"+colorama.Fore.WHITE)
print("--" * 50)
