-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·426 lines (325 loc) · 10.5 KB
/
setup.py
File metadata and controls
executable file
·426 lines (325 loc) · 10.5 KB
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
from time import sleep
import os
import sys # 420 Lines
from os import system
def cls():
if sys.platform.startswith('win32' or 'win64' or 'win86'):
os.system('cls')
else:
os.system('clear')
def permission_not_found():
cls()
print('It has been detected that you don\'t have the permission to write files in this directory.\n\nIf you\'re using this script on a Linux distribution, run the script as root.\n\nIf you\'re on Windows, check that the files are not set to \"read only\".\n\nIf it still doesn\'t work then you don\'t have the right privileges to execute this script or make changes. Most probably your administration has blocked this feature.')
try:
os.system('pip3 install -r requirements.txt || pip install -r requirements.txt')
except Exception:
pass
cls()
def banner():
try:
from pyfiglet import Figlet
f = Figlet(font='big')
print(f.renderText("""Merryweather\nATM services"""))
except ImportError or ModuleNotFoundError:
pass
try:
import re
import colorama
class IO(object):
_ANSI_CSI_RE = re.compile('\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?')
Back = colorama.Back
Fore = colorama.Fore
Style = colorama.Style
def c_banner():
MAIN_BANNER = r"""{}
██╗ ██╗███████╗██╗ ██████╗ ██████╗ ███╗ ███╗███████╗
██║ ██║██╔════╝██║ ██╔════╝██╔═══██╗████╗ ████║██╔════╝
██║ █╗ ██║█████╗ ██║ ██║ ██║ ██║██╔████╔██║█████╗
██║███╗██║██╔══╝ ██║ ██║ ██║ ██║██║╚██╔╝██║██╔══╝
╚███╔███╔╝███████╗███████╗╚██████╗╚██████╔╝██║ ╚═╝ ██║███████╗
╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
{}
""".format(IO.Fore.LIGHTRED_EX, IO.Style.RESET_ALL + IO.Style.BRIGHT)
print(MAIN_BANNER)
c_banner()
except ImportError or ModuleNotFoundError:
if sys.platform.startswith("win32" or "win64" or "win86"):
banner()
else:
print('Consider installing Colorama in your distro (sudo apt-get install python3-colorama)')
banner()
try:
from asset.asset0 import a0
except ModuleNotFoundError or ImportError: #balance
pass
try:
from asset.asset1 import a1
except ModuleNotFoundError or ImportError:
pass
try:
from asset.asset2 import a2
except ModuleNotFoundError or ImportError:
pass
try:
from asset.asset3 import a3
except ModuleNotFoundError or ImportError:
pass
try:
from asset.asset4 import a4
except ModuleNotFoundError or ImportError: #balance
pass
try:
from asset.asset5 import a5
except ModuleNotFoundError or ImportError:
pass
try:
from asset.asset6 import a6
except ModuleNotFoundError or ImportError:
pass
try:
from asset.asset7 import a7
except ModuleNotFoundError or ImportError:
pass
try:
from asset.asset8 import a8
except ModuleNotFoundError or ImportError:
pass
try:
from asset.asset9 import a9
except ModuleNotFoundError or ImportError: #balance
pass
try:
from asset.pin0 import pin0 # pin
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin1 import pin1
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin2 import pin2
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin3 import pin3
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin4 import pin4
except ModuleNotFoundError or ImportError: #pin
pass
try:
from asset.pin5 import pin5
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin6 import pin6
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin7 import pin7
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin8 import pin8
except ModuleNotFoundError or ImportError:
pass
try:
from asset.pin9 import pin9
except ModuleNotFoundError or ImportError: #pin
pass
try:
from asset.name0 import name0 #name
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name1 import name1
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name2 import name2
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name3 import name3
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name4 import name4
except ModuleNotFoundError or ImportError: #name
pass
try:
from asset.name5 import name5
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name6 import name6
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name7 import name7
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name8 import name8
except ModuleNotFoundError or ImportError:
pass
try:
from asset.name9 import name9
except ModuleNotFoundError or ImportError:
pass #name
def users():
cls()
try:
val = int(input('How many users do you want to add in this facility?\n\n> '))
val1 = str(val).startswith('0')
if val <= 10 and val != 0:
global f
f = int(val)
cls()
name()
elif val > 10:
cls()
print('You can only add a maximum of ten users.')
sleep(3)
users()
elif val1 == True:
cls()
print('Are you kidding me? Why the hell are you using this script then???')
sleep(5)
print('')
print('Don\'t be a jerk this time.')
sleep(5)
users()
except ValueError:
cls()
print('Please enter only integers')
sleep(3)
users()
def welcome():
print('Welcome to the Merryweather ATM setup wizard.\n\nPlease enter the following questions carefully for any wrong information may create further problems.')
sleep(5)
print('')
print('Gathering information', end = '')
sleep(0.5)
print('.', end = '')
sleep(0.5)
print('.', end = '')
sleep(0.5)
print('.')
sleep(2)
print('')
print('Compiling data', end = '')
sleep(0.5)
print('.', end = '')
sleep(0.5)
print('.', end = '')
sleep(0.5)
print('.')
print('')
sleep(2)
print('Processing', end = '')
sleep(0.5)
print('.', end = '')
sleep(0.5)
print('.', end = '')
sleep(0.5)
print('.')
sleep(2)
cls()
users()
names = []
def name():
inx = 0
usr = 1
try:
for i in range(f):
o_name = input('Enter the name of user {}.\n> '.format(usr))
if len(o_name) <= 0:
cls()
print("Please enter a correct value.")
sleep(2)
cls()
name()
print('')
t_name = o_name.title()
names.append(t_name)
with open('asset/name{}.py'.format(str(inx)), 'w') as nn:
nn.write('name{} = \'{}\''.format(inx, t_name))
nn.close()
inx += 1
usr += 1
cls()
print('Saving Names in Database...')
sleep(3)
cls()
pin()
except PermissionError:
permission_not_found()
def pin():
inx2 = 0
for i in range(f):
try:
o_pin = int(input('Enter the preferred PIN for {}.\n> '.format(names[inx2])))
print('')
o_pin1 = str(o_pin).startswith('0')
if o_pin1 == True:
cls()
print("Please avoid using \'0\' as the first digit.")
sleep(3)
cls()
pin()
else:
cls()
with open('asset/pin{}.py'.format(str(inx2)), 'w') as pn:
pn.write('pin{} = {}'.format(inx2, o_pin))
pn.close()
inx2 += 1
except ValueError:
cls()
print('Please enter only numbers.')
sleep(3)
pin()
print('Saving PINs in Database...')
sleep(3)
cls()
bal()
def bal():
inx3 = 0
for i in range(f):
try:
o_bal = int(input('Enter the Balance for {}.\n> $ '.format(names[inx3])))
print('')
with open('asset/asset{}.py'.format(str(inx3)), 'w') as bl:
bl.write('a{} = {}'.format(inx3, o_bal))
bl.close()
inx3 += 1
cls()
except ValueError:
cls()
print('Please enter only numbers.')
sleep(3)
bal()
done()
def done():
print('Configuration successful!')
print('')
print('You can now run the ATM.py script and login with the credentials you entered.')
sleep(8)
run()
def run():
cls()
atm = input('Would you like to run the ATM script now?\n> ')
if atm == 'y' or atm == 'Y' or atm == 'YES' or atm == 'Yes' or atm == 'yes':
os.system('python3 ATM.py || python ATM.py')
cls()
exit()
elif atm == 'n' or atm == 'N' or atm == 'NO' or atm == 'No' or atm == 'no':
cls()
a = input("Press Enter to close this script.\n")
elif len(atm) <= 0 or atm != atm.isalpha() or atm != 'yes' or atm != 'YES' or atm != 'Yes' or atm != 'y' or atm != 'Y' or atm != 'no' or atm != 'NO' or atm != 'No' or atm != 'n' or atm != 'N':
cls()
print('Please enter either \'Yes\' or \'No\'.')
sleep(3)
run()
welcome()