def login(self): print("____________________________________________\n") username = input("Entrez votre pseudo : \n").upper() password = input("Entre votre mdp : \n") password = md5(password.encode('utf-8')).hexdigest() c = database.conn.cursor() c.execute("SELECT * FROM users WHERE username=:pseudo",{"pseudo" : username}) data = c.fetchone() if(data == None): print("Mauvais Username!\n") self.login() else: while(password != data[5]): print("Mauvais password\n") password = input("Entre votre mdp : \n") password = md5(password.encode('utf-8')).hexdigest() if(data[1] != "ADMIN" and data[1] != "MASTER"): print("Vous n'êtes pas admin") self.login() print("Connexion Réussi !!\n") self.id = data[0] self.role = data[1] self.prenom = data[2] self.nom = data[3] self.username = data[4] self.password_hash = data[5] self.mail = data[6] self.site = data[7] logs.writeInLogSimple(self.username," vient de se connecter")
def ftp_menu(): choice = input("Press : \n1 Listez les dossiers du ftp" "\n2 Etat du ftp" "\n3 Pour Push un fichier" "\n4 recup un audit ?" "\n5 quitter\n") if choice == "1": logs.writeInLogSimple(user.username, " a lancé le listage des dossiers") list() ftp_menu() elif choice == "2": logs.writeInLogSimple(user.username, " a demande l'etat du serveur ftp") etat() ftp_menu() elif choice == "3": logs.writeInLogSimple(user.username, " a lancé le push de fichier") copie() ftp_menu() elif choice == "4": logs.writeInLogSimple(user.username, " a lancé la recuperation du fichier d'audit") ftp_menu() elif choice == "5": main_menu() else: print("Wrong key") ftp_menu()
def portscan_menu(): choice = input( "Press :\n1 to scan a range of ports\n2 to scan one port\n3 to cancel\n" ) if choice == "1": logs.writeInLogSimple(user.username, " a lancé le scan d'une range de port") portscan.rangePorts() portscan_menu() elif choice == "2": logs.writeInLogSimple(user.username, " a lancé le scan d'un port") portscan.onePort() portscan_menu() elif choice == "3": main_menu() else: print("Wrong key") portscan_menu()
def users_menu(): choice = input( "Press :\n1 to create a new user\n2 to search an user\n3 to edit or delete an user\n4 to cancel\n" ) if choice == "1": logs.writeInLogSimple(user.username, " a lancé la création d'User") user.create_user() users_menu() elif choice == "2": logs.writeInLogSimple(user.username, " a lancé la recherche d'User") user.show_all_users() user.search_users() users_menu() elif choice == "3": logs.writeInLogSimple(user.username, " a lancé l'édition ou suppression d'User") user.show_all_users() user.edit_or_delete() users_menu() elif choice == "4": # return ou main_menu() else: print("Wrong key") users_menu()
def main_menu(): choice = input( "Press :\n1 to manage users\n2 to manage ftp\n3 to test brute force\n4 to scan ports\n5 to try the mail bombing\n6 to see the logs file\n7 to exit\n" ) if choice == "1": logs.writeInLogSimple(user.username, " à lancer la gestion d'User") users_menu() main_menu() elif choice == "2": logs.writeInLogSimple(user.username, " à lancer la gestion FTP") checkdirect() ftp_menu() main_menu() elif choice == "3": logs.writeInLogSimple(user.username, " à lancer le bruteforce") bruteforce.bruteforce() main_menu() elif choice == "4": logs.writeInLogSimple(user.username, " à lancer le scan de port") portscan_menu() main_menu() elif choice == "5": logs.writeInLogSimple(user.username, " à lancer le mail bombing") smtp.lancement() main_menu() elif choice == "6": filename = "log.txt" with open(filename) as f: data = f.readlines() for n, line in enumerate(data, 1): print('{:2}.'.format(n), line.rstrip()) # logs() main_menu() elif choice == "7": exit() else: print("Wrong key") main_menu()