def getting(): wcsv() try: sm(sender_email, reciever_email, subject, messege, path, "smtp.gmail.com", 587, sender_user_name, sender_password) except: print("Email could not be sent") return send_file('log.csv', attachment_filename='log.csv')
def node(): path = 'nodeImages/images.jpg' data = request.get_json() data = data['key'] print(type(data)) data = data.split(",")[1] data = bytes(data, 'utf-8') print(type(data)) image = base64.b64decode(data) with open(path, 'wb') as f: f.write(image) response = test(path) print(response) if (response == None): try: sm(sender_email, reciever_email, subject, messege, path, "smtp.gmail.com", 587, sender_user_name, sender_password) except: print("email courd not be sent") os.remove(path) return "Intruder" else: result = gs(response) validity = result[0][2] if (validity == 0): add(response + "," + "valid") os.remove(path) return response + "," + "valid" else: try: sm(sender_email, reciever_email, subject, messege, path, "smtp.gmail.com", 587, sender_user_name, sender_password) except: print("Emial could not be sent") add(response + "," + "invalid") os.remove(path) return response + "," + "invalid"
def android_test(): path = "androidImages/test.jpg" data = request.stream.read() image = data image = base64.b64decode(image) with open(path, 'wb') as f: f.write(image) response = test(path) print(response) if (response == None): try: sm(sender_email, reciever_email, subject, messege, path, "smtp.gmail.com", 587, sender_user_name, sender_password) except: print("Email could not be sent ") os.remove(path) return "Intruder" else: result = gs(response) validity = result[0][2] if (validity == 0): add(response + "," + "valid") os.remove(path) return response + "," + "valid" else: try: sm(sender_email, reciever_email, subject, messege, path, "smtp.gmail.com", 587, sender_user_name, sender_password) except: print("Email could not be sent") add(response + "," + "invalid") os.remove(path) return response + "," + "invalid"
def model(): path = "curlImages/test.jpg" filestr = request.files['file'].read() npimg = np.fromstring(filestr, np.uint8) img = cv2.imdecode(npimg, cv2.IMREAD_COLOR) cv2.imwrite(path, img) response = test(path) print(response) if (response == None): try: sm(sender_email, reciever_email, subject, messege, path, "smtp.gmail.com", 587, sender_user_name, sender_password) except: print("email courd not be sent") os.remove(path) return "Intruder" else: result = gs(response) validity = result[0][2] if (validity == 0): add(response + "," + "valid") os.remove(path) return response + "," + "valid" else: try: sm(sender_email, reciever_email, subject, messege, path, "smtp.gmail.com", 587, sender_user_name, sender_password) except: print("Emial could not be sent") add(response + "," + "invalid") os.remove(path) return response + "," + "invalid"