Skip to content

Commit

Permalink
Separation
Browse files Browse the repository at this point in the history
  • Loading branch information
IceTheCoder committed May 22, 2023
1 parent 668ea01 commit cbabeac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 15 additions & 0 deletions code/password_strength/password_strength_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tkinter as tk
from tkinter.font import Font
import customtkinter
from pynput.keyboard import Key, Controller

from password_strength import password_strength_logic as logic
import diacritics_fix as fix
Expand All @@ -13,6 +14,8 @@

copy_button_y_offset = 30

keyboard = Controller()


class PasswordStrengthFrame(customtkinter.CTkFrame):
"""
Expand Down Expand Up @@ -110,3 +113,15 @@ def display_warnings(entry_box: customtkinter.CTkEntry, w_labels: list, event: t
w_labels[index].configure(text=warning)
for label in w_labels:
label.grid(column=0, row=2 + w_labels.index(label), sticky='w')


def paste_text() -> None:
"""
Called upon pressing the paste button,
this function uses the keyboard module to simulate pressing CTRL and V to paste text into the input_box.
"""
# https://youtu.be/DTnz8wA6wpw
keyboard.press(Key.ctrl_l)
keyboard.press('v')
keyboard.release(Key.ctrl_l)
keyboard.release('v')
15 changes: 0 additions & 15 deletions code/password_strength/password_strength_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
"""
from __future__ import annotations
import string
from pynput.keyboard import Key, Controller
from collections.abc import Iterable
from dataclasses import dataclass
from pathlib import Path

keyboard = Controller()

# passwords.txt is from the https://github.com/danielmiessler/SecLists repository.
# https://www.youtube.com/watch?v=DCaKj3eIrro
passwords_file = Path('password_strength/passwords.txt')
Expand Down Expand Up @@ -142,15 +139,3 @@ def check_for_patterns_in_password() -> str:
pattern_warning = check_for_patterns_in_password()

return [prevalence_warning, length_warning, complexity_warning, pattern_warning]


def paste_text() -> None:
"""
Called upon pressing the paste button,
this function uses the keyboard module to simulate pressing CTRL and V to paste text into the input_box.
"""
# https://youtu.be/DTnz8wA6wpw
keyboard.press(Key.ctrl_l)
keyboard.press('v')
keyboard.release(Key.ctrl_l)
keyboard.release('v')

0 comments on commit cbabeac

Please sign in to comment.