Compare commits

..

No commits in common. "master" and "1.0" have entirely different histories.
master ... 1.0

4 changed files with 30 additions and 123 deletions

View file

@ -1,7 +1,2 @@
# Csv-Password-Viewer # Csv-Password-Viewer
Permet de voir tous ses mots de passes stockés dans un fichier csv facilement, et d'accéder aux sites correspondant au compte stockés. Permet de voir tous ses mots de passes stockés dans un fichier csv facilement, et d'accéder aux sites correspondant au compte stockés.
Fonctionne avec les csv fourni par :
- BitWarden
- Firefox
- Chrome

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

148
main.py
View file

@ -1,4 +1,4 @@
from tkinter import Tk, filedialog, Button, Label, Entry, PhotoImage from tkinter import Tk, filedialog, Button, Label, Entry
import tkinter.font as tkfont import tkinter.font as tkfont
import csv import csv
import webbrowser import webbrowser
@ -7,23 +7,13 @@ from tkinter.messagebox import showinfo
# Commandes # Commandes
def select_file(): def select_file():
path_file = filedialog.askopenfilename(initialdir = "/", title = "Select file", filetypes = (("Fichier csv", "*.csv"), ("Tous les fichiers (non supporté)", "*.*"))) path_file = filedialog.askopenfilename(initialdir = "/", title = "Select file", filetypes = (("Fichier csv", "*.csv"), ("Fichier json (non pris en charge)", "*.json")))
openfile(path_file) openfile(path_file)
def openfile(path): def openfile(path):
with open(path, "r") as file: global list_url, list_user, list_pass, curseur, line_count
premiere_ligne = file.readline() global affichage_url, affichage_user, affichage_pass, affichage_curseur
if premiere_ligne == "folder,favorite,type,name,notes,fields,login_uri,login_username,login_password,login_totp\n": global barre_de_recherche
openfile_bitwarden(path)
elif premiere_ligne == '"url","username","password","httpRealm","formActionOrigin","guid","timeCreated","timeLastUsed","timePasswordChanged"\n':
openfile_firefox(path)
elif premiere_ligne == "name,url,username,password\n":
openfile_chrome(path)
else:
showinfo("Erreur", "Ce format de fichier csv n'est pas reconnu.\nMerci d'utilisé Firefox ou Bitwarden.")
def openfile_chrome(path):
global list_url, list_user, list_pass, line_count, liste_name
for item in root.grid_slaves(): for item in root.grid_slaves():
item.destroy() item.destroy()
@ -34,120 +24,56 @@ def openfile_chrome(path):
list_url = [] list_url = []
list_user = [] list_user = []
list_pass = [] list_pass = []
liste_name = []
for row in csv_reader: for row in csv_reader:
if line_count != 0: if line_count != 0:
liste_name.append(row[0])
list_url.append(row[1])
list_user.append(row[2])
list_pass.append(row[3])
line_count += 1
line_count -= 1
lancement()
def openfile_firefox(path):
global list_url, list_user, list_pass, line_count, liste_name
for item in root.grid_slaves():
item.destroy()
with open(path) as csv_file:
csv_reader = csv.reader(csv_file, delimiter = ',')
line_count = 0
list_url = []
list_user = []
list_pass = []
liste_name = []
for row in csv_reader:
if line_count > 1:
liste_name.append(row[0]) # pas de nom, alors ce sera l'URL
list_url.append(row[0])
list_user.append(row[1])
list_pass.append(row[2])
line_count += 1
line_count -= 2
lancement()
def openfile_bitwarden(path):
global list_url, list_user, list_pass, line_count, liste_name
for item in root.grid_slaves():
item.destroy()
with open(path) as csv_file:
csv_reader = csv.reader(csv_file, delimiter = ',')
line_count = 0
list_url = []
list_user = []
list_pass = []
liste_name = []
for row in csv_reader:
if line_count != 0:
liste_name.append(row[3])
list_url.append(row[6]) list_url.append(row[6])
list_user.append(row[7]) list_user.append(row[7])
list_pass.append(row[8]) list_pass.append(row[8])
line_count += 1 line_count += 1
line_count -= 1 line_count -= 1
lancement() Label(root, text = f"Il y a {line_count} comptes.", font = tkfont.Font(size = 20)).place(x = 460, y = 30)
Button(root, text = "<", font=tkfont.Font(size = 30), command = previous_account).place(x = 100, y = 500)
Button(root, text = ">", font=tkfont.Font(size = 30), command = next_account).place(x = 970, y = 500)
def lancement(): Label(root, text = "URL :", font = tkfont.Font(size = 10)).place(x = 150, y = 180)
global lancement_affichage_ligne Label(root, text = "User :", font = tkfont.Font(size = 10)).place(x = 145, y = 250)
global barre_de_recherche Label(root, text = "Password :", font = tkfont.Font(size = 10)).place(x = 120, y = 320)
global affichage_url, affichage_user, affichage_pass, affichage_curseur, curseur
global root
clear_second_lancement()
lancement_affichage_ligne = Label(root, text = f"Il y a {line_count} comptes.", font = tkfont.Font(size = 20))
lancement_affichage_ligne.place(x = 460, y = 30)
Button(root, text = "<", font=tkfont.Font(size = 30), command = previous_account).place(x = 100, y = 500)
Button(root, text = ">", font=tkfont.Font(size = 30), command = next_account).place(x = 970, y = 500)
Label(root, text = "URL :", font = tkfont.Font(size = 10)).place(x = 150, y = 180)
Label(root, text = "User :", font = tkfont.Font(size = 10)).place(x = 145, y = 250)
Label(root, text = "Password :", font = tkfont.Font(size = 10)).place(x = 120, y = 320)
curseur = 0 curseur = 0
affichage_url = Label(root, text = list_url[curseur], font = tkfont.Font(size = 40, underline = True), fg = "blue", cursor = "hand2") affichage_url = Label(root, text = list_url[curseur], font = tkfont.Font(size = 40))
affichage_user = Entry(root, font = tkfont.Font(size = 40)) affichage_user = Entry(root, font = tkfont.Font(size = 40))
affichage_pass = Entry(root, font = tkfont.Font(size = 40)) affichage_pass = Entry(root, font = tkfont.Font(size = 40))
affichage_user.insert(0, list_user[curseur]) affichage_user.insert(0, list_user[curseur])
affichage_pass.insert(0, list_pass[curseur]) affichage_pass.insert(0, list_pass[curseur])
affichage_url.bind("<Button-1>", callback) affichage_url.bind("<Button-1>", callback)
affichage_url.place(x = 200, y = 160) affichage_url.place(x = 200, y = 160)
affichage_user.place(x = 200, y = 230) affichage_user.place(x = 200, y = 230)
affichage_pass.place(x = 200, y = 300) affichage_pass.place(x = 200, y = 300)
affichage_curseur = Label(root, text = "Compte numéro 1", font = tkfont.Font(size = 15)) affichage_curseur = Label(root, text = "Compte numéro 1", font = tkfont.Font(size = 15))
affichage_curseur.place(x = 500, y = 500) affichage_curseur.place(x = 500, y = 500)
barre_de_recherche = Entry(root, font = tkfont.Font(size = 15), width = len(str(line_count))) barre_de_recherche = Entry(root, font = tkfont.Font(size = 15), width = len(str(line_count)))
boutton_recherche = Button(root, text = "Rechercher", command = lambda:recherche(barre_de_recherche.get())) boutton_recherche = Button(root, text = "Rechercher", command = lambda:recherche(barre_de_recherche.get()))
barre_de_recherche.place(x = 120, y = 10) barre_de_recherche.place(x = 120, y = 10)
boutton_recherche.place(x = 40, y = 10) boutton_recherche.place(x = 40, y = 10)
barre_de_recherche.bind("<Key>", barre_de_recherche_recup)
root.title(f"CSV PASSWORD VIEWER - {liste_name[curseur]}")
barre_de_recherche.bind("<Key>", barre_de_recherche_recup)
def affichage(): def affichage():
global affichage_url, affichage_user, affichage_pass, affichage_curseur, root global affichage_url, affichage_user, affichage_pass, affichage_curseur
affichage_url.destroy() affichage_url.destroy()
affichage_user.destroy() affichage_user.destroy()
affichage_pass.destroy() affichage_pass.destroy()
affichage_curseur.destroy() affichage_curseur.destroy()
affichage_url = Label(root, text = list_url[curseur], font = tkfont.Font(size = 40, underline = True), fg = "blue", cursor = "hand2") affichage_url = Label(root, text = list_url[curseur], font = tkfont.Font(size = 40))
affichage_user = Entry(root, font = tkfont.Font(size = 40)) affichage_user = Entry(root, font = tkfont.Font(size = 40))
affichage_pass = Entry(root, font = tkfont.Font(size = 40)) affichage_pass = Entry(root, font = tkfont.Font(size = 40))
@ -163,19 +89,6 @@ def affichage():
affichage_curseur = Label(root, text = f"Compte numéro {curseur+1}", font = tkfont.Font(size = 15)) affichage_curseur = Label(root, text = f"Compte numéro {curseur+1}", font = tkfont.Font(size = 15))
affichage_curseur.place(x = 500, y = 500) affichage_curseur.place(x = 500, y = 500)
root.title(f"CSV PASSWORD VIEWER - {liste_name[curseur]}")
def clear_second_lancement():
global lancement_affichage_ligne, affichage_url, affichage_curseur, barre_de_recherche
try:
lancement_affichage_ligne.destroy()
affichage_url.destroy()
affichage_curseur.destroy()
barre_de_recherche.destroy()
except:
pass
def previous_account(): def previous_account():
global curseur global curseur
if curseur > 0: if curseur > 0:
@ -220,7 +133,6 @@ root=Tk()
root.geometry("1100x600") root.geometry("1100x600")
root.title("CSV PASSWORD VIEWER") root.title("CSV PASSWORD VIEWER")
root.resizable(False, False) root.resizable(False, False)
root.iconphoto(False, PhotoImage(file='favicon.png'))
Button(root, text = "Browser file", command = select_file).place(x = 1000, y = 10) Button(root, text = "Browser file", command = select_file).place(x = 1000, y = 10)