-
Notifications
You must be signed in to change notification settings - Fork 2
/
gui.py
220 lines (179 loc) · 9.01 KB
/
gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
from PyQt5 import QtWidgets, QtCore, QtGui, uic
import sys
import os
from datetime import datetime as dt
from playsound import playsound
import time
import random
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
# hide_time = 15
hide_time = 2
button_stylesheet = """
QPushButton {
background-color: transparent;
border-color: transparent;
color: transparent;
}
"""
class Ui(QtWidgets.QDialog):
"""
Initializes the Ui class, which is a subclass of QtWidgets.QDialog.
This function sets up the user interface by loading the 'not_malware.ui' file and
connecting the 'thanks_button' click event to the 'show_message' method.
Parameters:
None
Returns:
None
Raises:
None
"""
def __init__(self, unsafe_mode):
super(Ui, self).__init__()
uic.loadUi('not_malware.ui', self)
# Apply stylesheets
self.boop_button.setStyleSheet(button_stylesheet)
self.ass_boop_button.setStyleSheet(button_stylesheet)
self.setWindowTitle("Totally Not Malware")
self.setWindowFlag(QtCore.Qt.WindowContextHelpButtonHint, False)
# Connect Buttons
self.thanks_button.clicked.connect(self.show_message)
self.boop_button.clicked.connect(self.boop)
self.ass_boop_button.clicked.connect(self.ass_boop)
if unsafe_mode:
self.setWindowFlag(QtCore.Qt.WindowCloseButtonHint, False)
self.tries = 0
self.funny_tries = 0
self.show()
def boop(self):
playsound("images/bleat.mp3")
def ass_boop(self):
playsound("images/scared.mp3")
self.deer_image.setPixmap(QtGui.QPixmap('./images/deer_gone.png'))
QtWidgets.QMessageBox.critical(self, "Error", "You scared the deer away :'(")
self.hide()
QtWidgets.QMessageBox.critical(self, "Error", "I'm hiding now, you can't get rid of me *that* easily")
time.sleep(hide_time)
self.deer_image.setPixmap(QtGui.QPixmap('./images/deer.png'))
reply = QtWidgets.QMessageBox.question(
self,
"Error",
"Promise not to do that again?",
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
)
if reply == QtWidgets.QMessageBox.Yes:
self.show()
else:
QtWidgets.QMessageBox.critical(self, "Error", "Then you have chosen VIOLENCE...")
for i in range(10):
self.boss_fight()
self.deer_image.setPixmap(QtGui.QPixmap('./images/deer_lasers.png'))
self.show()
def boss_fight(self):
msg_box = QtWidgets.QMessageBox(self)
msg_box.setWindowTitle("Bossfight")
msg_box.setText("Then you have chosen VIOLENCE...")
screen_rect = QtWidgets.QApplication.primaryScreen().availableGeometry()
x = screen_rect.width()
y = screen_rect.height()
x = x - 20
y = y - 20
x = random.randint(20, x)
y = random.randint(20, y)
msg_box.move(x, y)
msg_box.exec_()
def show_message(self):
"""
This function displays a message box based on the input values of cardnumber, expiration, and security_code.
Parameters:
- cardnumber (str): The credit card number entered by the user.
- expiration (str): The expiration date of the credit card entered by the user.
- security_code (str): The security code of the credit card entered by the user.
Returns:
- None: This function does not return any value. It only displays a message box.
Raises:
- None: This function does not raise any exceptions.
"""
cardnumber = self.card_number.text()
expiration = self.expiry_date.text()
security_code = self.security_code.text()
# This should probably be moved down inside the logic below, where the rest of the security code logic is
if security_code in ("6969", "420"):
if self.funny_tries < 1:
playsound("images/bleat.mp3")
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you typed in the funny number, input a another number")
else:
playsound("images/bleat.mp3")
QtWidgets.QMessageBox.critical(self, "Error", "Oops! I FUCKING TOLD YOU TO USE ANOTHER NUMBER.")
self.funny_tries += 1
return
if cardnumber and expiration and security_code:
if cardnumber and any(char.isalpha() for char in cardnumber):
if self.tries < 4:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you have letters in your card number.")
else:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Hey I know the world is tough but it isnt tough enough to justify you USING FUCKING LETTERS IN A CARD NUMBER")
self.tries += 1
return
if cardnumber.isdigit() and len(cardnumber) not in (16, 17):
if self.tries <4:
if len(cardnumber) > 16:
QtWidgets.QMessageBox.critical(self, "Error", f"Oops! you appear to have too many numbers, you have {len(cardnumber)} Numbers, The Max is 16")
elif len(cardnumber) < 16:
QtWidgets.QMessageBox.critical(self, "Error", f"Oops! you appear to be missing some numbers, you have {len(cardnumber)} Number(s), You must have 16")
else:
if len(cardnumber) > 16:
QtWidgets.QMessageBox.critical(self, "Error", f"Oops! you appear to have too many numbers, you have {len(cardnumber)} Numbers, The Max is 16 YOU FUCKING MORON, NICE TIME COUNT INSTEAD OF SPAMMING NUMBERS")
else:
QtWidgets.QMessageBox.critical(self, "Error", f"Oops! you appear to be missing some numbers, you have {len(cardnumber)} Number(s), You must have 16 HOW MANY FUCKING TIMES DO I HAVE TO SAY THIS")
self.tries += 1
return
if len(security_code) not in (3, 4):
if self.tries < 2:
if len(security_code) > 4:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you put too many digits in your secruity code")
elif len(security_code) < 3:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you put too few digits in your security code")
self.tries += 1
else:
QtWidgets.QMessageBox.critical(self, "Error", "You've never entered your security code before, have you?")
# This is in the else block here because the if block is false if the security code is valid
else:
if "/" not in expiration:
if len(expiration) == 4:
expiration = f"{expiration[:2]}/{expiration[2:]}"
elif len(expiration) == 3:
expiration = f"{expiration[0]}/{expiration[1:]}"
try:
date = dt.strptime(expiration, "%m/%y")
QtWidgets.QMessageBox.information(self, "Transaction Complete", "$12,420.69 was transferred from your account :3.")
except ValueError:
if self.tries < 2:
QtWidgets.QMessageBox.critical(self, "Error", "The date you entered is invalid.")
self.tries += 1
else:
QtWidgets.QMessageBox.critical(self, "Error", "You don't understand how dates work, do you?")
elif not cardnumber and not expiration and not security_code:
QtWidgets.QMessageBox.critical(self, "Error", "You can't leave everything blank :(")
return
elif not cardnumber:
if self.tries < 4:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you forgot the credit card number")
else:
QtWidgets.QMessageBox.critical(self, "Error", "You forgot your card number dumbass.")
self.tries += 1
elif not expiration:
if self.tries < 4:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you forgot the expiration date")
else:
QtWidgets.QMessageBox.critical(self, "Error", "You forgot the expiration date dumbass.")
self.tries += 1
elif not security_code:
if self.tries < 4:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! I can't take your money without a security code")
else:
QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you forgot the fucking security code you moron")
self.tries += 1
app = QtWidgets.QApplication(sys.argv)
unsafe_mode = "--unsafe" in sys.argv
window = Ui(unsafe_mode)
app.exec_()