-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamc.py
332 lines (279 loc) · 9.7 KB
/
amc.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
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
import random
import os
import hashlib
from time import sleep
global md5
# define for start write chalenges func name is start
def start(): # start function
# try except for err handleing
try:
print("hello my friend this is amicheh's game you havehere for learning ")
na = input("enter your name ~$")
os.system("clear")
print("hello my friend this is amicheh's game you have here for learning ")
print ("In the first $amc1304$ challenge of 2022 you have to understand lpic1 you will have 10 questions and you will get a score at the end")
st = input("are you redy? [Y/n]")
if st == "y":
os.system("clear")
print ("welcome to amc1304")
print ("theme is Company")
print ("%s You are employed by a company and you have to meet their demands" % na)
ch1()
except:
print ("please run again")
def ch10():
try:
os.system("clear")
ch10 = "welcome to challenge 10 \n The system on which you are working does not have the lsof command installed, and you are not allowed to install software without going through four levels of approval and scheduling the installation weeks in advance. However, the netstat command is available. Which option to netstat will show the process ID to which a given network port is connected?"
print (ch10)
ch10_ch10 = """
A. ~/.ssh/authorized_keys
B. ~/.ssh/keys
C. ~/.ssh/keyauth
D. ~/.sshd/authkeys
"""
print (ch10_ch10)
for i in range(1,5):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "f1290186a5d0b1ceab27f4e77c0c5d68":
sleep(2)
print ("game over !")
else :
sleep(2)
print ("winner")
print ("Congratulations my friend, I hope you are successful wherever you are ")
if isd == "f1290186a5d0b1ceab27f4e77c0c5d68":
sleep(2)
print ("you win")
break
except:
sleep(2)
print ("please try again !")
def ch9():
try:
os.system("clear")
ch9 = "welcome to challenge 9 \n Within which file should you place public keys for servers from which you will accept key-based ssh authentication?"
print (ch9)
ch9_ch9 = """
A. ~/.ssh/authorized_keys
B. ~/.ssh/keys
C. ~/.ssh/keyauth
D. ~/.sshd/authkeys
"""
print (ch9_ch9)
for i in range(1,5):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "f1290186a5d0b1ceab27f4e77c0c5d68":
print ("game over !")
else :
print ("winner")
ch10()
if isd == "f1290186a5d0b1ceab27f4e77c0c5d68":
print ("you win")
ch10()
break
except:
print ("please try again !")
def ch8():
try:
os.system("clear")
ch8 = "welcome to challenge 8 \n You need to examine who is currently logged in to the system. Which of the following commands will display this information?"
print (ch8)
ch8_ch8 = """
A. listuser
B. fuser
C. ls -u
D. w
"""
print (ch8_ch8)
for i in range(1,5):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "f1290186a5d0b1ceab27f4e77c0c5d68":
print ("game over !")
else :
print ("winner")
ch9()
if isd == "f1290186a5d0b1ceab27f4e77c0c5d68":
print ("you win")
ch9()
break
except:
print ("please try again !")
def ch7():
try:
os.system("clear")
ch7 = "welcome to challenge 7 \n In a scripting scenario, which command will return the domain name configured for the server?"
print (ch7)
ch7_ch7 = """
A. dnsname
B. fqdn
C. hostname
D. hostname -d
"""
print (ch7_ch7)
for i in range(1,5):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "837ec5754f503cfaaee0929fd48974e7":
print ("game over !")
else :
print ("winner")
ch8()
if isd == "837ec5754f503cfaaee0929fd48974e7":
print ("you win")
ch8()
break
except:
print ("please try again !")
def ch6():
try:
os.system("clear")
ch5 = "welcome to challenge 6 \n Which of the following addresses represents the localhost in IPv6? (3)"
print (ch5)
ch5_ch5 = """
A. 0:1
B. ::1
C. 127:0:1
D. :127:0:0:1
"""
print (ch5_ch5)
for i in range(1,4):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "837ec5754f503cfaaee0929fd48974e7":
print ("game over !")
else :
print ("winner")
ch7()
if isd == "837ec5754f503cfaaee0929fd48974e7":
print ("you win")
ch7()
break
except:
print ("please try again !")
def ch5():
try:
os.system("clear")
ch5 = "welcome to challenge 5 \n Which of the following commands queries the mail servers for the domain example.com ? (5)"
print (ch5)
ch5_ch5 = """
A. dig example.com mx
B. dig example.com
C. host -t smtp example.com
D. dig example.com smtp
"""
print (ch5_ch5)
for i in range(1,6):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "c5a9b309744c165d140cb3d66a872da0":
print ("game over !")
else :
print ("winner")
ch6()
if isd == "c5a9b309744c165d140cb3d66a872da0":
print ("you win")
ch6()
break
except:
print ("please try again !")
def ch4():
try:
os.system("clear")
ch4 = "welcome to challenge 4 \n Which of the following commands queries the mail servers for the domain example.com ?"
print (ch4)
ch4_ch4 = """
A. dig example.com mx
B. dig example.com
C. host -t smtp example.com
D. dig example.com smtp
"""
print (ch4_ch4)
for i in range(1,5):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "c5a9b309744c165d140cb3d66a872da0":
print ("game over !")
else :
print ("winner")
ch5()
if isd == "c5a9b309744c165d140cb3d66a872da0":
print ("you win")
ch5()
break
except:
print ("please try again !")
def ch3():
try:
os.system("clear")
ch3 = " welcome to challenge 3 \n Which command is used to format a swap partition?"
print (ch3)
ch3_ch3 = """
A. mkfs -swap
B. mkswap
C. format -swap
D. mksw
"""
print (ch3_ch3)
for i in range(1,4):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 3 :
if isd != "93939cfda4dbd38c5946fa40989c8c6c":
print ("game over !")
else :
print ("winner")
ch4()
if isd == "93939cfda4dbd38c5946fa40989c8c6c":
print ("you win")
ch4()
break
except:
print("please try again !")
def ch2():
try:
os.system("clear")
ch2 = "welcome to challenge 2 \nIn a company you have to get the path of all the files with pdf extension and type the command (4)"
print (ch2)
for i in range(1,5):
isd = hashlib.md5(input("%i ~$" % i ).encode()).hexdigest()
if i == 4 :
if isd != "093906c48bcc2e585f54bed709f22222":
print ("game over !")
else :
print ("winner")
ch3()
if isd == "093906c48bcc2e585f54bed709f22222":
print ("you win")
ch3()
break
except:
print ("please try again !")
def ch1():
# try except for erro handling
try:
os.system("clear")
# ch1 set quastion
ch1 = "welcome to challenge 1 \n You are asked to list all the kernel modules and show them to the client # chance number (3)"
print (ch1)
# for loop and range chancess
for i in range(1,4):
# isd var is input client hash
isd = hashlib.md5(input("%i ~$" % i).encode()).hexdigest()
# if i chance == 3 chance and isd != hash you are game over
if i == 3 :
if isd != "e44d12d4c5d06e7acfb04b826da858bd":
print ("game over !")
# else you win
else :
print ("winer")
ch2()
# if you win programm is break
if isd == "e44d12d4c5d06e7acfb04b826da858bd":
print ("you win")
ch2()
except:
print ("please try again")
start()