psswd-box 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of psswd-box might be problematic. Click here for more details.
- psswd_box-1.0.0/PKG-INFO +32 -0
- psswd_box-1.0.0/README.md +18 -0
- psswd_box-1.0.0/psswd_box/__init__.py +0 -0
- psswd_box-1.0.0/psswd_box/app.py +178 -0
- psswd_box-1.0.0/psswd_box/configs/config.yaml +12 -0
- psswd_box-1.0.0/psswd_box/configs/themes.yaml +15 -0
- psswd_box-1.0.0/psswd_box/file_handler.py +17 -0
- psswd_box-1.0.0/psswd_box/gifs/app_showcase.gif +0 -0
- psswd_box-1.0.0/psswd_box/images/psswd_box.ico +0 -0
- psswd_box-1.0.0/psswd_box/images/psswd_box.png +0 -0
- psswd_box-1.0.0/psswd_box/password_generator.py +159 -0
- psswd_box-1.0.0/pyproject.toml +19 -0
psswd_box-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: psswd-box
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Melvin Quick
|
|
6
|
+
Author-email: melvinquick@proton.me
|
|
7
|
+
Requires-Python: >=3.12,<3.14
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Requires-Dist: pyqt6 (>=6.8.0,<7.0.0)
|
|
11
|
+
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
<p align="center"> <img src="psswd_box/images/psswd_box.png" width=400" height="400" /> </p>
|
|
15
|
+
|
|
16
|
+
## Donations
|
|
17
|
+
|
|
18
|
+
- [Buy Me A Coffee](https://www.buymeacoffee.com/KingKairos)
|
|
19
|
+
- [GitHub Sponsors](https://github.com/sponsors/melvinquick)
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
|
|
23
|
+
The general purpose of this app is to give people an easy way to generate passwords completely locally on their machine. This doesn't rely on a cloud service, or any information leaving the local machine whatsoever.
|
|
24
|
+
|
|
25
|
+
## App Showcase
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Useful Information
|
|
30
|
+
|
|
31
|
+
- [Project Goals](https://codeberg.org/melvinquick/psswd_box/projects/12633)
|
|
32
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<p align="center"> <img src="psswd_box/images/psswd_box.png" width=400" height="400" /> </p>
|
|
2
|
+
|
|
3
|
+
## Donations
|
|
4
|
+
|
|
5
|
+
- [Buy Me A Coffee](https://www.buymeacoffee.com/KingKairos)
|
|
6
|
+
- [GitHub Sponsors](https://github.com/sponsors/melvinquick)
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
The general purpose of this app is to give people an easy way to generate passwords completely locally on their machine. This doesn't rely on a cloud service, or any information leaving the local machine whatsoever.
|
|
11
|
+
|
|
12
|
+
## App Showcase
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
## Useful Information
|
|
17
|
+
|
|
18
|
+
- [Project Goals](https://codeberg.org/melvinquick/psswd_box/projects/12633)
|
|
File without changes
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from PyQt6.QtCore import Qt
|
|
4
|
+
from PyQt6.QtGui import QIcon
|
|
5
|
+
from PyQt6.QtWidgets import (
|
|
6
|
+
QApplication,
|
|
7
|
+
QMainWindow,
|
|
8
|
+
QWidget,
|
|
9
|
+
QPushButton,
|
|
10
|
+
QCheckBox,
|
|
11
|
+
QLabel,
|
|
12
|
+
QVBoxLayout,
|
|
13
|
+
QComboBox,
|
|
14
|
+
QHBoxLayout,
|
|
15
|
+
QSpinBox,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from password_generator import PasswordGenerator
|
|
19
|
+
from file_handler import FileHandler
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
icon = FileHandler("images/psswd_box.png")
|
|
23
|
+
|
|
24
|
+
config_file = FileHandler("configs/config.yaml")
|
|
25
|
+
themes_file = FileHandler("configs/themes.yaml")
|
|
26
|
+
|
|
27
|
+
config = config_file.load_yaml_file()
|
|
28
|
+
themes = themes_file.load_yaml_file()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class MainWindow(QMainWindow):
|
|
32
|
+
def __init__(self):
|
|
33
|
+
super().__init__()
|
|
34
|
+
|
|
35
|
+
# * Set window default settings
|
|
36
|
+
self.setWindowTitle(config["window_title"])
|
|
37
|
+
self.setFixedSize(
|
|
38
|
+
config["window_size"]["width"], config["window_size"]["height"]
|
|
39
|
+
)
|
|
40
|
+
self.setWindowIcon(QIcon(icon.get_file_path()))
|
|
41
|
+
|
|
42
|
+
# * Define normal variables
|
|
43
|
+
self.theme_list = [theme for theme in list(themes)[:-1]]
|
|
44
|
+
|
|
45
|
+
# * Create end user widgets and apply settings to them
|
|
46
|
+
self.generate_password = QPushButton("Generate Password")
|
|
47
|
+
|
|
48
|
+
self.password = QLabel(
|
|
49
|
+
" ", alignment=Qt.AlignmentFlag.AlignCenter, wordWrap=False
|
|
50
|
+
)
|
|
51
|
+
self.password.setTextInteractionFlags(
|
|
52
|
+
Qt.TextInteractionFlag.TextSelectableByMouse
|
|
53
|
+
| Qt.TextInteractionFlag.TextSelectableByKeyboard
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
self.lowercase_letters = QCheckBox("Lowercase Letters")
|
|
57
|
+
self.lowercase_letters.setCheckState(Qt.CheckState.Checked)
|
|
58
|
+
|
|
59
|
+
self.uppercase_letters = QCheckBox("Uppercase Letters")
|
|
60
|
+
self.uppercase_letters.setCheckState(Qt.CheckState.Checked)
|
|
61
|
+
|
|
62
|
+
self.numbers = QCheckBox("Numbers")
|
|
63
|
+
self.numbers.setCheckState(Qt.CheckState.Checked)
|
|
64
|
+
|
|
65
|
+
self.symbols = QCheckBox("Symbols")
|
|
66
|
+
self.symbols.setCheckState(Qt.CheckState.Checked)
|
|
67
|
+
|
|
68
|
+
self.num_characters = QSpinBox(prefix="Number of Characters: ")
|
|
69
|
+
self.num_characters.setRange(
|
|
70
|
+
config["num_characters"]["min"], config["num_characters"]["max"]
|
|
71
|
+
)
|
|
72
|
+
self.num_characters.setValue(config["num_characters"]["default"])
|
|
73
|
+
|
|
74
|
+
self.theme_toggle = QPushButton("Dark")
|
|
75
|
+
|
|
76
|
+
# * Define button connections and/or actions
|
|
77
|
+
self.generate_password.pressed.connect(self.get_password)
|
|
78
|
+
self.theme_toggle.pressed.connect(self.toggle_theme)
|
|
79
|
+
|
|
80
|
+
# * Create layouts
|
|
81
|
+
self.page = QVBoxLayout()
|
|
82
|
+
self.row_three = QHBoxLayout()
|
|
83
|
+
self.row_four = QHBoxLayout()
|
|
84
|
+
|
|
85
|
+
# * Add widgets to layouts
|
|
86
|
+
self.row_three.addWidget(self.lowercase_letters)
|
|
87
|
+
self.row_three.addWidget(self.uppercase_letters)
|
|
88
|
+
self.row_three.addWidget(self.numbers)
|
|
89
|
+
self.row_three.addWidget(self.symbols)
|
|
90
|
+
|
|
91
|
+
self.row_four.addWidget(self.num_characters)
|
|
92
|
+
self.row_four.addWidget(self.theme_toggle)
|
|
93
|
+
|
|
94
|
+
# * Setup overall page layout and set default window theme
|
|
95
|
+
self.page.addWidget(self.password)
|
|
96
|
+
self.page.addWidget(self.generate_password)
|
|
97
|
+
self.page.addLayout(self.row_three)
|
|
98
|
+
self.page.addLayout(self.row_four)
|
|
99
|
+
|
|
100
|
+
self.gui = QWidget()
|
|
101
|
+
self.gui.setLayout(self.page)
|
|
102
|
+
|
|
103
|
+
self.setCentralWidget(self.gui)
|
|
104
|
+
|
|
105
|
+
self.apply_theme(self.theme_toggle.text().lower())
|
|
106
|
+
|
|
107
|
+
def get_password(self):
|
|
108
|
+
character_types = self.get_character_types()
|
|
109
|
+
if character_types == ["n", "n", "n", "n"]:
|
|
110
|
+
self.password.setText("You MUST select one of the character types below!")
|
|
111
|
+
else:
|
|
112
|
+
psswd = PasswordGenerator()
|
|
113
|
+
self.password.setText(
|
|
114
|
+
psswd.generate_password(character_types, self.num_characters.value())
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
def get_character_types(self):
|
|
118
|
+
lowercase_letters_value = "y" if self.lowercase_letters.isChecked() else "n"
|
|
119
|
+
uppercase_letters_value = "y" if self.uppercase_letters.isChecked() else "n"
|
|
120
|
+
numbers_value = "y" if self.numbers.isChecked() else "n"
|
|
121
|
+
symbols_value = "y" if self.symbols.isChecked() else "n"
|
|
122
|
+
character_types = [
|
|
123
|
+
lowercase_letters_value,
|
|
124
|
+
uppercase_letters_value,
|
|
125
|
+
numbers_value,
|
|
126
|
+
symbols_value,
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
return character_types
|
|
130
|
+
|
|
131
|
+
def toggle_theme(self):
|
|
132
|
+
if self.theme_toggle.text() == "Dark":
|
|
133
|
+
self.theme_toggle.setText("Light")
|
|
134
|
+
theme = self.theme_toggle.text()
|
|
135
|
+
else:
|
|
136
|
+
self.theme_toggle.setText("Dark")
|
|
137
|
+
theme = self.theme_toggle.text()
|
|
138
|
+
|
|
139
|
+
self.apply_theme(theme.lower())
|
|
140
|
+
|
|
141
|
+
def apply_theme(self, theme):
|
|
142
|
+
self.main_stylesheet = f"""
|
|
143
|
+
background-color: {themes[theme]['background-color']};
|
|
144
|
+
color: {themes[theme]['color']};
|
|
145
|
+
border: {themes[theme]['border']};
|
|
146
|
+
border-radius: {themes['general']['border-radius']};
|
|
147
|
+
padding: {themes['general']['padding']};
|
|
148
|
+
"""
|
|
149
|
+
self.widget_stylesheet = f"""
|
|
150
|
+
background-color: {themes[theme]['widget-background-color']};
|
|
151
|
+
"""
|
|
152
|
+
self.setStyleSheet(self.main_stylesheet)
|
|
153
|
+
self.password.setStyleSheet(self.widget_stylesheet)
|
|
154
|
+
self.generate_password.setStyleSheet(self.widget_stylesheet)
|
|
155
|
+
self.lowercase_letters.setStyleSheet(self.widget_stylesheet)
|
|
156
|
+
self.uppercase_letters.setStyleSheet(self.widget_stylesheet)
|
|
157
|
+
self.numbers.setStyleSheet(self.widget_stylesheet)
|
|
158
|
+
self.symbols.setStyleSheet(self.widget_stylesheet)
|
|
159
|
+
self.theme_toggle.setStyleSheet(self.widget_stylesheet)
|
|
160
|
+
self.num_characters.setStyleSheet(self.widget_stylesheet)
|
|
161
|
+
|
|
162
|
+
(
|
|
163
|
+
self.theme_toggle.setText("Dark")
|
|
164
|
+
if theme == "dark"
|
|
165
|
+
else self.theme_toggle.setText("Light")
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def main():
|
|
170
|
+
app = QApplication(sys.argv)
|
|
171
|
+
app.setStyle("Breeze")
|
|
172
|
+
window = MainWindow()
|
|
173
|
+
window.show()
|
|
174
|
+
app.exec()
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
if __name__ == "__main__":
|
|
178
|
+
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
light:
|
|
2
|
+
background-color: "#d8dee9"
|
|
3
|
+
color: "#2e3440"
|
|
4
|
+
border: 1px solid '#e5e9f0'
|
|
5
|
+
widget-background-color: "#eceff4"
|
|
6
|
+
|
|
7
|
+
dark:
|
|
8
|
+
background-color: "#2e3440"
|
|
9
|
+
color: "#eceff4"
|
|
10
|
+
border: 1px solid '#434c5e'
|
|
11
|
+
widget-background-color: "#4c566a"
|
|
12
|
+
|
|
13
|
+
general:
|
|
14
|
+
border-radius: "4px"
|
|
15
|
+
padding: "2px 4px"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import os, yaml
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class FileHandler:
|
|
5
|
+
def __init__(self, filename):
|
|
6
|
+
self.filename = filename
|
|
7
|
+
|
|
8
|
+
def load_yaml_file(self):
|
|
9
|
+
with open(self.get_file_path(), "r") as f:
|
|
10
|
+
return yaml.safe_load(f)
|
|
11
|
+
|
|
12
|
+
def save_yaml_file(self, configs):
|
|
13
|
+
with open(self.get_file_path(), "w") as f:
|
|
14
|
+
return yaml.safe_dump(configs, f, default_flow_style=False)
|
|
15
|
+
|
|
16
|
+
def get_file_path(self):
|
|
17
|
+
return os.path.join(os.path.dirname(__file__), self.filename)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
from secrets import choice
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class PasswordGenerator:
|
|
5
|
+
def __init__(self):
|
|
6
|
+
self.lowercase_letters = [
|
|
7
|
+
"a",
|
|
8
|
+
"b",
|
|
9
|
+
"c",
|
|
10
|
+
"d",
|
|
11
|
+
"e",
|
|
12
|
+
"f",
|
|
13
|
+
"g",
|
|
14
|
+
"h",
|
|
15
|
+
"i",
|
|
16
|
+
"j",
|
|
17
|
+
"k",
|
|
18
|
+
"l",
|
|
19
|
+
"m",
|
|
20
|
+
"n",
|
|
21
|
+
"o",
|
|
22
|
+
"p",
|
|
23
|
+
"q",
|
|
24
|
+
"r",
|
|
25
|
+
"s",
|
|
26
|
+
"t",
|
|
27
|
+
"u",
|
|
28
|
+
"v",
|
|
29
|
+
"x",
|
|
30
|
+
"x",
|
|
31
|
+
"y",
|
|
32
|
+
"z",
|
|
33
|
+
]
|
|
34
|
+
self.uppercase_letters = [
|
|
35
|
+
"A",
|
|
36
|
+
"B",
|
|
37
|
+
"C",
|
|
38
|
+
"D",
|
|
39
|
+
"E",
|
|
40
|
+
"F",
|
|
41
|
+
"G",
|
|
42
|
+
"H",
|
|
43
|
+
"I",
|
|
44
|
+
"J",
|
|
45
|
+
"K",
|
|
46
|
+
"L",
|
|
47
|
+
"M",
|
|
48
|
+
"N",
|
|
49
|
+
"O",
|
|
50
|
+
"P",
|
|
51
|
+
"Q",
|
|
52
|
+
"R",
|
|
53
|
+
"S",
|
|
54
|
+
"T",
|
|
55
|
+
"U",
|
|
56
|
+
"V",
|
|
57
|
+
"W",
|
|
58
|
+
"X",
|
|
59
|
+
"Y",
|
|
60
|
+
"Z",
|
|
61
|
+
]
|
|
62
|
+
self.numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
|
63
|
+
self.symbols = [
|
|
64
|
+
"!",
|
|
65
|
+
"@",
|
|
66
|
+
"#",
|
|
67
|
+
"$",
|
|
68
|
+
"%",
|
|
69
|
+
"^",
|
|
70
|
+
"&",
|
|
71
|
+
"*",
|
|
72
|
+
"(",
|
|
73
|
+
")",
|
|
74
|
+
"[",
|
|
75
|
+
"]",
|
|
76
|
+
"{",
|
|
77
|
+
"}",
|
|
78
|
+
"\\",
|
|
79
|
+
";",
|
|
80
|
+
":",
|
|
81
|
+
'"',
|
|
82
|
+
"'",
|
|
83
|
+
"<",
|
|
84
|
+
">",
|
|
85
|
+
"/",
|
|
86
|
+
"?",
|
|
87
|
+
",",
|
|
88
|
+
"`",
|
|
89
|
+
"~",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
def generate_password(
|
|
93
|
+
self, character_types=["y", "y", "y", "y"], num_characters=20
|
|
94
|
+
):
|
|
95
|
+
|
|
96
|
+
if character_types == ["n", "n", "n", "n"]:
|
|
97
|
+
print("You didn't include any character types... Exiting")
|
|
98
|
+
return exit()
|
|
99
|
+
|
|
100
|
+
choices = self.get_valid_choices(character_types)
|
|
101
|
+
character_counter = 0
|
|
102
|
+
psswd = ""
|
|
103
|
+
|
|
104
|
+
while character_counter < num_characters:
|
|
105
|
+
psswd += choice(choices)
|
|
106
|
+
character_counter += 1
|
|
107
|
+
|
|
108
|
+
return psswd
|
|
109
|
+
|
|
110
|
+
def get_valid_choices(self, character_types):
|
|
111
|
+
match character_types:
|
|
112
|
+
case ["y", "y", "y", "y"]:
|
|
113
|
+
return (
|
|
114
|
+
self.lowercase_letters
|
|
115
|
+
+ self.uppercase_letters
|
|
116
|
+
+ self.numbers
|
|
117
|
+
+ self.symbols
|
|
118
|
+
)
|
|
119
|
+
case ["y", "y", "y", "n"]:
|
|
120
|
+
return self.lowercase_letters + self.uppercase_letters + self.numbers
|
|
121
|
+
case ["y", "y", "n", "n"]:
|
|
122
|
+
return self.lowercase_letters + self.uppercase_letters
|
|
123
|
+
case ["y", "n", "n", "n"]:
|
|
124
|
+
return self.lowercase_letters
|
|
125
|
+
case ["y", "n", "y", "y"]:
|
|
126
|
+
return self.lowercase_letters + self.numbers + self.symbols
|
|
127
|
+
case ["y", "n", "y", "n"]:
|
|
128
|
+
return self.lowercase_letters + self.numbers
|
|
129
|
+
case ["y", "n", "n", "y"]:
|
|
130
|
+
return self.lowercase_letters + self.symbols
|
|
131
|
+
case ["y", "y", "n", "y"]:
|
|
132
|
+
return self.lowercase_letters + self.uppercase_letters + self.symbols
|
|
133
|
+
case ["n", "y", "y", "y"]:
|
|
134
|
+
return self.uppercase_letters + self.numbers + self.symbols
|
|
135
|
+
case ["n", "n", "y", "y"]:
|
|
136
|
+
return self.numbers + self.symbols
|
|
137
|
+
case ["n", "n", "n", "y"]:
|
|
138
|
+
return self.symbols
|
|
139
|
+
case ["n", "y", "n", "y"]:
|
|
140
|
+
return self.uppercase_letters + self.symbols
|
|
141
|
+
case ["n", "y", "n", "n"]:
|
|
142
|
+
return self.uppercase_letters
|
|
143
|
+
case ["n", "n", "y", "n"]:
|
|
144
|
+
return self.numbers
|
|
145
|
+
case ["n", "y", "y", "n"]:
|
|
146
|
+
return self.uppercase_letters + self.numbers
|
|
147
|
+
case ["n", "n", "n", "n"]:
|
|
148
|
+
print("You didn't include any character types... Exiting")
|
|
149
|
+
return exit()
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def main():
|
|
153
|
+
|
|
154
|
+
psswd = PasswordGenerator()
|
|
155
|
+
print(psswd.generate_password())
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
if __name__ == "__main__":
|
|
159
|
+
main()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "psswd-box"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = ""
|
|
5
|
+
authors = ["Melvin Quick <melvinquick@proton.me>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
|
|
8
|
+
[tool.poetry.dependencies]
|
|
9
|
+
python = ">=3.12,<3.14"
|
|
10
|
+
pyqt6 = "^6.8.0"
|
|
11
|
+
pyyaml = "^6.0.2"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
[tool.poetry.group.dev.dependencies]
|
|
15
|
+
bandit = "^1.8.0"
|
|
16
|
+
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["poetry-core"]
|
|
19
|
+
build-backend = "poetry.core.masonry.api"
|