def check(): # return -1/2/1 -> normal / undetectable / phishing submit_url = request.args["url"] if not Checker.check_connection(submit_url): print("Connection unavailable") return "2" # unable to detech if (Checker.Statistical_report(submit_url) == 1): return "1" try: print("Getting info for", submit_url) input_array = Helper.embed_url(submit_url) print(input_array) if "2" in input_array: # if cannot get some features print("Cannot get some features") return "2" result = Functions.check_vector(input_array) # this code is used to logged into the database file. Uncomment when needed # if (result == 1): # f = open("model/data/urls.csv","a",encoding="UTF-8") # f.write(submit_url+"\n") return str(result) except: print("Unable to detech") return "2" # unable to detect
def check(): submit_url = request.args["url"] if not Checker.check_connection(submit_url): return "1" if (Checker.Statistical_report(submit_url) == 1): return "1" # return "-1" print("Getting info for", submit_url) input_array = embed_url(submit_url) print(input_array) print(len(input_array)) result = Functions.check_vector(input_array) # if (result == 1): # f = open("model/data/urls.csv","a",encoding="UTF-8") # f.write(submit_url+"\n") return str(result)
def check(): # return -1/2/1 -> normal / undetectable / phishing submit_url = request.args["url"] submit_url = submit_url.replace(" ", "") if not Checker.check_connection(submit_url): print("Connection unavailable") return { "status": "unknown", # unable to detect "message": "Unreachable" } if (Checker.Statistical_report(submit_url) == 1): return {"status": "phishing", "message": "Found in our database"} try: print("Getting info for", submit_url) embed_info = Helper.embed_url(submit_url) input_array = embed_info[0] info_obj = embed_info[1] print("Checking vector") result = Functions.check_vector(input_array) status = "unknown" if (result == 1): status = "phishing" elif (result == -1): status = "normal" return { "status": status, "message": "detect by model", "info": info_obj } # this code is used to logged into the database file. Uncomment when needed # if (result == 1): # f = open("model/data/urls.csv","a",encoding="UTF-8") # f.write(submit_url+"\n") return str(result) except: return {"status": "unknown", "message": "Internal error"}