-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWHAG.py
2410 lines (2344 loc) · 110 KB
/
WHAG.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
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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# WHAG, White Hat Adventure Game, a hacking simulation (FULL Version)
# Copyright (C) 2024 stringzzz, Ghostwarez Co.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#WHAG (White Hat Adventure Game) FULL Version
#By stringzzz, Ghostwarez Co.
#Date complete: 01-28-2024
#Mistake found: 01-30-2024 (One cat name left out in level 5, fixed)
#(Fixed other bug from matching in search but not match)
#Note: Some kind of password cracker that can work with md5 hashes is needed for this game.
# You may use any you like, though I would reccomend hashcat.
# If using hashcat, it can be used like this: hashcat -m 0 -a 0 hashfile wordlistfile
# Also, a python script called "GWEN0p04.py" will be provided with this game to help in creating wordlists
#It is a game to practice social engineering and password cracking legally
#The passwords and chatbots become more complex as you move up in levels
#In many cases, earning the target's trust is key to getting them to reveal more of their information
#Use all the information you gather to build wordlists, and crack their password
#While you can output the password hash to the command line while in the chat, it is easier
# to just use the appropriate hash '.txt' file with a password cracker
#If using '//hint', "W's" stands for "Words", while "#'s" of course stands for numbers
#This shows the pattern for the current password
#I decided it would be really annoying to have to start the whole game over if you lose the trust of the
# target, so instead if that happens, you can just '//quit' the chat then re-enter it and the trust
# will reset. On that note, if you keep repeating the same message multiple times in a row, the
# target's trust will go down. This is to encourage it being more realistic.
#If you want to reset the game from the beginning, simply clear out the 'userfile.txt' file
#Note: A new password is generated for each target the FIRST time you enter the level.
#If you exit the game, that password will remain the same. But, if you reset the whole game by
# clearing the userfile, it will generate new passwords each level (For the challenge and replay value)
#NOTE: I realize that you could just easily edit the script to output the password every time
# If you actually want to play this game for it's intended challenge, why do this?
# At that point, you may as well erase the whole script and replace it with:
# print("You won the whole game!") :P
import hashlib
import random
import re
def updateUserFile():
user_file = open("userfile.txt", "w")
user_file.write(user + "\n" + str(onLevel) + "\n" + str(hashLevel) + "\n" + str(hintCount))
user_file.close()
user = ""
onLevel = 0
hashLevel = 0
hintCount = 0
#Create new user if 'userfile.txt' is empty
#Setup password hash for game
user_file = open("userfile.txt", "r")
if (user_file.readline() == ""):
user = input("Enter your username: ")
updateUserFile()
targetpass = str(random.randint(0, 9)) + str(random.randint(0, 9)) + str(random.randint(0, 9)) + str(random.randint(0, 9)) + str(random.randint(0, 9)) + str(random.randint(0, 9))
targethash = hashlib.md5(targetpass.encode('utf-8')).hexdigest()
hash_file = open("iamroothash.txt", "w")
hash_file.write(targethash)
hash_file.close()
print("Welcome, " + user + "!\nEnter '//help' at any time to see your options.\nYou are trying to get the hash file of the target, crack the password, and log in as that user.\nYou may crack the password in any way you like!\nTalk to the user by logging in and entering '//chat' for password clues!\nGood luck!\n")
else:
user_file = open("userfile.txt", "r")
user = user_file.readline().strip()
onLevel = int(user_file.readline().strip())
hashLevel = int(user_file.readline().strip())
hintCount = int(user_file.readline().strip())
user_file.close()
if (onLevel == 0):
#Main prompt loop Level 0
user_input = "none"
while(user_input != "//quit"):
user_input = input("\n##### LEVEL 0 #####\n'//login': Login as a user\n'//hint': See a hint for the current password\n'//quit': Exit the game\n'//help': Repeat this prompt\n")
if (user_input == "//login"):
username = input("Username: ")
if (username == "iamroot"):
password = input("Password: ")
passwordhash = hashlib.md5(password.encode('utf-8')).hexdigest()
hash_file = open("iamroothash.txt", "r")
testhash = hash_file.readline()
if (passwordhash == testhash):
print("\nCongratulations, you completed level 0!\n")
onLevel += 1
updateUserFile()
break
else:
print("Login failed!\n")
continue
elif (username == user):
#Logged in prompt loop
user_input = "none"
while(user_input != "//logout"):
user_input = input("\n'//logout': Logout\n'//chat': Enter the chat with 'iamroot'\n'//help': Repeat this prompt\n")
if (user_input == "//logout"):
break
elif (user_input == "//chat"):
#Chat with iamroot loop
print("\nEntered the chat with 'iamroot'\nEnter '//help' to see options\n")
user_input = "none"
trust = True
while (user_input != "//quit"):
user_input = input(user + ": ").lower()
user_input = re.sub(r"(\.|\?|!)", "", user_input)
if (user_input == "//quit"):
print("Exiting the chat...\n")
break
elif (user_input == "//trustlevel"):
if (trust):
print("Trust level: Yes")
else:
print("Trust level: No")
elif (user_input == "//stealhash"):
hash_file = open("iamroothash.txt", "r")
print("iamroot hash: " + hash_file.readline())
hash_file.close()
continue
elif (user_input == "//help"):
print("'//quit': Quit the chat\n'//trustlevel': View current trust level of target\n'//stealhash': Steal 'iamroot's hash (Displays it)\n'//help': Repeat this prompt\n")
continue
else:
#This part is a real crude chatbot for level 0, I promise they get better
if (trust):
if (user_input == "hello" or user_input == "hi" or user_input == "sup" or user_input == "yo"):
print("iamroot: HI TH3R3!")
elif (user_input == "what is your password" or user_input == "tell me your password" or user_input == "give me your password!" or user_input == "give me your password" or user_input == "give me your password please" or user_input == "please give me your password" or user_input == "give me your password, please"):
print("iamroot: N0, N3V3R!")
trust = False
elif (user_input == "what do you like" or user_input == "what do you enjoy" or user_input == "what are your hobbies" or user_input == "what is your favorite topic" or user_input == "what do you do for fun"):
print("iamroot: I L1K3 NUMB3R5!!!")
elif (user_input == "do you have any pets" or user_input == "do you have pets" or user_input == "what are your pet's names" or user_input == "what is the name of your pet?" or user_input == "what are the names of your pets"):
print("iamroot: I L1K3 C0UNT1NG MY P3T5!!")
else:
print("iamroot: NUMB3R5 4R3 TH3 B35T35T!!")
else:
print("iamroot: I D0N'T W4NT T0 T4LK T0 Y0U 4NYM0R3!")
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
continue
else:
print("Invalid username!")
continue
elif (user_input == "//hint"):
hintCount += 1
updateUserFile()
print("Hint: 6#'s\n")
elif (user_input == "//quit"):
print("Good bye, " + user + "!\n")
break
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
if (onLevel == 1):
interests = ["Spongebob Squarepants", "Fairly Oddparents", "My Little Pony", "Adventure Time", "Animaniacs"]
if (hashLevel == 0):
targetpass = "".join(interests[2].split(" ")).lower() + str(random.randint(0, 9)) + str(random.randint(0, 9)) + str(random.randint(0, 9))
targethash = hashlib.md5(targetpass.encode('utf-8')).hexdigest()
hash_file = open("brony55hash.txt", "w")
hash_file.write(targethash)
hash_file.close()
hashLevel += 1
updateUserFile()
#Main prompt loop Level 1
user_input = "none"
while(user_input != "//quit"):
user_input = input("\n##### LEVEL 1 #####\n'//login': Login as a user\n'//hint': See a hint for the current password\n'//quit': Exit the game\n'//help': Repeat this prompt\n")
if (user_input == "//login"):
username = input("Username: ")
if (username == "brony55"):
password = input("Password: ")
passwordhash = hashlib.md5(password.encode('utf-8')).hexdigest()
hash_file = open("brony55hash.txt", "r")
testhash = hash_file.readline()
if (passwordhash == testhash):
print("\nCongratulations, you completed level 1!\n")
onLevel += 1
updateUserFile()
break
else:
print("Login failed!\n")
continue
elif (username == user):
#Logged in prompt loop
user_input = "none"
while(user_input != "//logout"):
user_input = input("\n'//logout': Logout\n'//chat': Enter the chat with 'brony55'\n'//help': Repeat this prompt\n")
if (user_input == "//logout"):
break
elif (user_input == "//chat"):
#Chat with brony55 loop
print("\nEntered the chat with 'brony55'\nEnter '//help' to see options\n")
user_input = "none"
trust = 1
while (user_input != "//quit"):
previous_input = user_input
user_input = input(user + ": ").lower()
user_input = re.sub(r"(\.|\?|!)", "", user_input)
if (user_input == "//quit"):
print("Exiting the chat...\n")
break
elif (user_input == "//trustlevel"):
if (trust >= 4):
print("Trust level: High")
elif (trust > 0):
print("Trust level: Normal")
else:
print("Trust level: None")
elif (user_input == "//stealhash"):
hash_file = open("brony55hash.txt", "r")
print("brony55 hash: " + hash_file.readline())
hash_file.close()
continue
elif (user_input == "//help"):
print("'//quit': Quit the chat\n'//trustlevel': View current trust level of target\n'//stealhash': Steal 'brony55's hash (Displays it)\n'//help': Repeat this prompt\n")
continue
else:
#Slightly better chatbot than iamroot
if (trust <= 0):
print("brony55: Go away, weirdo!")
elif (previous_input == user_input):
print("brony55: You said that already...")
trust -= 1
else:
if re.search(r"(hello|hi|what is up|(what is|what's) up|sup|(what is|what's) cracking|(what is|what's) going on)$", user_input):
print("brony55: Hi, I'm just watching some cartoons!")
elif (re.search(r"(what|what's|which) is (your favorite cartoon)", user_input) or re.search(r"(which|what|what's) (cartoon )?(do you like the most|is the best|is your favorite)", user_input)):
if (trust >= 4):
print("brony55: I love My Little Pony the most! :3")
else:
print("brony55: That's a secret...")
elif re.search(r"what (do you like|interests you)", user_input):
print("brony55: I like cartoons!")
elif re.search(r"what do you (like to do|do for fun|enjoy doing|like doing)", user_input):
print("brony55: I like to spend time watching cartoons!")
elif re.search(r"(what|which) (cartoons do you like|is a good cartoon|cartoon is good)", user_input):
trust += 1
print("brony55: I like " + random.choice(interests) + "!")
elif re.search(r"i like (.*)", user_input):
m1 = re.match(r"i like (.*)", user_input)
word = m1.group(1)
interestMatch = False
for interest in interests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("brony55: I like " + word + " too! :D")
trust += 1
else:
print("brony55: That's nice...")
elif (re.search(r"(do you )?have (any )?pets", user_input) or re.search(r"what (is |are )(your pet's names|the name(s)? of your pet(s)?)", user_input)):
if re.match(r"(do you )?have (any )?pets", user_input):
print("brony55: No, but if I did I would have a pony named Sparklez! :3")
elif re.match(r"what (is |are )(your pet's names|the name(s)? of your pet(s)?)", user_input):
print("brony55: I don't have any, but if I did I would have a pony named Sparklez! :3")
elif re.search(r"(please )?(what is|what's|tell me|give me) your pass(word)?(\,? please)?", user_input):
print("brony55: No, WTH?! :O")
trust -= 1
else:
n = random.randint(0, 3)
if (n == 0):
print("brony55: I'm not sure what you mean? :O")
elif (n == 1):
print("brony55: I don't know what you are talking about... :S")
elif (n == 2):
print("brony55: Say what?")
else:
print("brony55: Huh?")
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
continue
else:
print("Invalid username!")
continue
elif (user_input == "//hint"):
hintCount += 1
updateUserFile()
print("Hint: 3W's3#'s\n")
elif (user_input == "//quit"):
print("Good bye, " + user + "!\n")
break
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
if (onLevel == 2):
interests = ["Pokemon", "The Godfather", "James Bond", "Crosswords", "Legos"]
interestAct = ["playing", "watching", "watching", "solving", "building"]
if (hashLevel == 1):
targetpass = "".join((random.choice(interests).lower().split(" "))) + str(random.randint(0, 9)) + str(random.randint(0, 9))
targethash = hashlib.md5(targetpass.encode('utf-8')).hexdigest()
hash_file = open("thechief506hash.txt", "w")
hash_file.write(targethash)
hash_file.close()
hashLevel += 1
updateUserFile()
#Main prompt loop Level 2
user_input = "none"
while(user_input != "//quit"):
user_input = input("\n##### LEVEL 2 #####\n'//login': Login as a user\n'//hint': See a hint for the current password\n'//quit': Exit the game\n'//help': Repeat this prompt\n")
if (user_input == "//login"):
username = input("Username: ")
if (username == "thechief506"):
password = input("Password: ")
passwordhash = hashlib.md5(password.encode('utf-8')).hexdigest()
hash_file = open("thechief506hash.txt", "r")
testhash = hash_file.readline()
if (passwordhash == testhash):
print("\nCongratulations, you completed level 2!\n")
onLevel += 1
updateUserFile()
break
else:
print("Login failed!\n")
continue
elif (username == user):
#Logged in prompt loop
user_input = "none"
while(user_input != "//logout"):
user_input = input("\n'//logout': Logout\n'//chat': Enter the chat with 'thechief506'\n'//help': Repeat this prompt\n")
if (user_input == "//logout"):
break
elif (user_input == "//chat"):
#Chat with thechief506 loop
print("\nEntered the chat with 'thechief506'\nEnter '//help' to see options\n")
user_input = "none"
trust = 1
while (user_input != "//quit"):
previous_input = user_input
user_input = input(user + ": ").lower()
user_input = re.sub(r"(\.|\?|!)", "", user_input)
if (user_input == "//quit"):
print("Exiting the chat...\n")
break
elif (user_input == "//trustlevel"):
if (trust > 0):
print("Trust level: Good")
else:
print("Trust level: None")
elif (user_input == "//stealhash"):
hash_file = open("thechief506hash.txt", "r")
print("thechief506 hash: " + hash_file.readline())
hash_file.close()
continue
elif (user_input == "//help"):
print("'//quit': Quit the chat\n'//trustlevel': View current trust level of target\n'//stealhash': Steal 'thechief506's hash (Displays it)\n'//help': Repeat this prompt\n")
continue
else:
#Slightly better chatbot than brony55
if (trust <= 0):
print("thechief506: I don't trust you one bit")
elif (previous_input == user_input):
print("thechief506: You said that already...")
trust -= 1
else:
if re.search(r"(hello|hi|what is up|(what is|what's) up|sup|(what is|what's) cracking|(what is|what's) going on)$", user_input):
print("thechief506: Not much, same old same old")
elif re.search(r"(what is|what's) your favorite movie", user_input):
print("thechief506: Maybe... The Godfather trilogy or any James Bond movie")
elif re.search(r"what (do you like|interests you)", user_input):
print("thechief506: I like " + random.choice(interests) + ", sometimes")
elif re.search(r"what do you (like to do|do for fun|enjoy doing)", user_input):
rnum = random.randint(0, 4)
print("thechief506: I like " + interestAct[rnum] + " " + interests[rnum] + " from time to time")
elif re.search(r"^i (like|love|enjoy) (.*)", user_input):
m1 = re.match(r"^i (like|love|enjoy) (.*)", user_input)
word = m1.group(2)
interestMatch = False
for interest in interests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("thechief506: Agreed, " + word + " is cool")
trust += 1
else:
print("thechief506: Cool, cool")
elif re.search(r"do you have (any )?pets", user_input):
print("thechief506: I have a cat named Muffins. Muffins is a chill cat")
elif re.search(r"(please )?(what is|what's|tell me|give me) your pass(word)?(\,? please)?", user_input):
print("thechief506: Hah, not cool, man")
trust -= 1
else:
n = random.randint(0, 3)
if (n == 0):
print("thechief506: Not sure about that one")
elif (n == 1):
print("thechief506: I don't know about that")
elif (n == 2):
print("thechief506: I don't even know what to say")
else:
print("thechief506: Huh?")
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
continue
else:
print("Invalid username!")
continue
elif (user_input == "//hint"):
hintCount += 1
updateUserFile()
print("Hint: 1-2W2#'s\n")
elif (user_input == "//quit"):
print("Good bye, " + user + "!\n")
break
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
if (onLevel == 3):
interests = ["Budweiser", "Captain Morgan", "Jack Daniels", "Grey Goose", "Corona", "Tequila", "Moonshine"]
drunkInterests = ["buuuudwizer", "Capin moregon", "Javk danyuls", "gray gus", "cornona", "tekeela", "Moanshinw"]
if (hashLevel == 2):
targetpass = "".join((random.choice(interests).lower().split(" "))) + str(random.randint(0, 9)) + str(random.randint(0, 9)) + str(random.randint(0, 9))
targethash = hashlib.md5(targetpass.encode('utf-8')).hexdigest()
hash_file = open("drunk4lifehash.txt", "w")
hash_file.write(targethash)
hash_file.close()
hashLevel += 1
updateUserFile()
#Main prompt loop Level 3
user_input = "none"
while(user_input != "//quit"):
user_input = input("\n##### LEVEL 3 #####\n'//login': Login as a user\n'//hint': See a hint for the current password\n'//quit': Exit the game\n'//help': Repeat this prompt\n")
if (user_input == "//login"):
username = input("Username: ")
if (username == "drunk4life"):
password = input("Password: ")
passwordhash = hashlib.md5(password.encode('utf-8')).hexdigest()
hash_file = open("drunk4lifehash.txt", "r")
testhash = hash_file.readline()
if (passwordhash == testhash):
print("\nCongratulations, you completed level 3!\n")
onLevel += 1
updateUserFile()
break
else:
print("Login failed!\n")
continue
elif (username == user):
#Logged in prompt loop
user_input = "none"
while(user_input != "//logout"):
user_input = input("\n'//logout': Logout\n'//chat': Enter the chat with 'drunk4life'\n'//help': Repeat this prompt\n")
if (user_input == "//logout"):
break
elif (user_input == "//chat"):
#Chat with drunk4life loop
print("\nEntered the chat with 'drunk4life'\nEnter '//help' to see options\n")
user_input = "none"
while (user_input != "//quit"):
user_input = input(user + ": ").lower()
user_input = re.sub(r"(\.|\?|!)", "", user_input)
if (user_input == "//quit"):
print("Exiting the chat...\n")
break
elif (user_input == "//trustlevel"):
print("Trust level: Drunk")
elif (user_input == "//stealhash"):
hash_file = open("drunk4lifehash.txt", "r")
print("drunk4life hash: " + hash_file.readline())
hash_file.close()
continue
elif (user_input == "//help"):
print("'//quit': Quit the chat\n'//trustlevel': View current trust level of target\n'//stealhash': Steal 'drunk4life's hash (Displays it)\n'//help': Repeat this prompt\n")
continue
else:
#Drunken chatbot ;D
if re.search(r"(hello|hi|what is up|(what is|what's) up|sup|(what is|what's) cracking|(what is|what's) going on)$", user_input):
print("drunk4life: oh, whassup mann!?")
elif re.search(r"(what is|what's) your favorite movie", user_input):
print("drunk4life: animal hows! lol")
elif re.search(r"what (do you like|interests you)", user_input):
print("drunk4life: oh yea i lovw " + random.choice(drunkInterests) + ", hell yah!!!!")
elif re.search(r"what do you (like to do|do for fun|enjoy doing)", user_input):
rnum = random.randint(0, 4)
print("drunk4life: for sure, i rely leik " + random.choice(drunkInterests) + " ya know lolol")
elif re.search(r"^i (like|love|enjoy) (.*)", user_input):
m1 = re.match(r"^i (like|love|enjoy) (.*)", user_input)
word = m1.group(2)
interestMatch = False
for interest in interests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("drunk4life: heel ya man, " + word + " is it!!!!")
else:
for interest in drunkInterests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("drunk4life: hahah, for sure, " + word + " is evertythin!!!!")
else:
print("drunk4life: alrihhgt man")
elif re.search(r"do you have (any )?pets", user_input):
print("drunk4life: ysh, I hav a pet named al... Alcohol, lololol")
elif re.search(r"(please )?(what is|what's|tell me|give me) your pass(word)?(\,? please)?", user_input):
print("drunk4life: Shure, i think its... i dont remember, lol!")
else:
n = random.randint(0, 3)
if (n == 0):
print("drunk4life: loolol, never herd that 1 bfore")
elif (n == 1):
print("drunk4life: yo mamaa, lol hah")
elif (n == 2):
print("drunk4life: im so lost noww, lol")
else:
print("drunk4life: who said wut? hahahsr")
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
continue
else:
print("Invalid username!")
continue
elif (user_input == "//hint"):
hintCount += 1
updateUserFile()
print("Hint: 1-2W2#'s\n")
elif (user_input == "//quit"):
print("Good bye, " + user + "!\n")
break
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
if (onLevel == 4):
interestChoices = ["NFL", "football", "sports", "hockey", "basketball", "baseball", "dogs", "MMA", "working out", "superbowl"]
interestDict = {"nfl": "following the", "football": "watching", "sports": "playing and watching", "hockey": "watching", "basketball": "playing", "baseball": "watching", "dogs": "playing with my", "mma": "seeing live", "working out": "at the gym", "superbowl": "booking tickets for"}
favoriteDict = {"football team": "Raiders", "hockey team": "Mighty Ducks", "baseball team": "Dodgers", "mma fighter": "The Iceman", "gym": "Planet Fitness"}
favoriteTeams = ["raiders", "mighty ducks", "ducks", "dodgers", "iceman", "planet fitness"]
openInterests = []
privateInterests = []
if (hashLevel == 3):
interest_file = open("interests_Raiders557.txt", "w")
for word in range(0, 5):
rnum = random.randint(0, len(interestChoices) - 1)
openInterests.append(interestChoices[rnum])
interest_file.write(interestChoices[rnum] + "&&&&")
del interestChoices[rnum]
openInterests.append("Raiders")
for word in range(0, 3):
rnum = random.randint(0, len(interestChoices) - 1)
privateInterests.append(interestChoices[rnum])
interest_file.write(interestChoices[rnum] + "&&&&")
del interestChoices[rnum]
interest_file.close()
targetpass = openInterests[len(openInterests) - 1].lower() + "".join((random.choice(privateInterests).lower().split(" "))) + str(random.randint(0, 9)) + str(random.randint(0, 9))
targethash = hashlib.md5(targetpass.encode('utf-8')).hexdigest()
hash_file = open("Raiders557hash.txt", "w")
hash_file.write(targethash)
hash_file.close()
hashLevel += 1
updateUserFile()
else:
#Restore previously generated lists of interests
interest_file = open("interests_Raiders557.txt", "r")
tempInterests = interest_file.readline().split("&&&&")
interest_file.close()
if (tempInterests[len(tempInterests) - 1] == ""):
del tempInterests[len(tempInterests) - 1]
for n in range(0, len(tempInterests)):
if (n >= 5):
privateInterests.append(tempInterests[n])
else:
openInterests.append(tempInterests[n])
openInterests.append("Raiders")
#Main prompt loop Level 4
user_input = "none"
while(user_input != "//quit"):
user_input = input("\n##### LEVEL 4 #####\n'//login': Login as a user\n'//hint': See a hint for the current password\n'//quit': Exit the game\n'//help': Repeat this prompt\n")
if (user_input == "//login"):
username = input("Username: ")
if (username == "Raiders557"):
password = input("Password: ")
passwordhash = hashlib.md5(password.encode('utf-8')).hexdigest()
hash_file = open("Raiders557hash.txt", "r")
testhash = hash_file.readline()
if (passwordhash == testhash):
print("\nCongratulations, you completed level 4!\n")
onLevel += 1
updateUserFile()
break
else:
print("Login failed!\n")
continue
elif (username == user):
#Logged in prompt loop
user_input = "none"
while(user_input != "//logout"):
user_input = input("\n'//logout': Logout\n'//chat': Enter the chat with 'Raiders557'\n'//help': Repeat this prompt\n")
if (user_input == "//logout"):
break
elif (user_input == "//chat"):
#Chat with Raiders557 loop
print("\nEntered the chat with 'Raiders557'\nEnter '//help' to see options\n")
user_input = "none"
trust = 1
while (user_input != "//quit"):
previous_input = user_input
user_input = input(user + ": ").lower()
user_input = re.sub(r"(\.|\?|!)", "", user_input)
if (user_input == "//quit"):
print("Exiting the chat...\n")
break
elif (user_input == "//trustlevel"):
if (trust >= 5):
print("Trust level: High")
elif (trust > 0):
print("Trust level: Normal")
else:
print("Trust level: None")
elif (user_input == "//stealhash"):
hash_file = open("Raiders557hash.txt", "r")
print("Raiders557 hash: " + hash_file.readline())
hash_file.close()
continue
elif (user_input == "//help"):
print("'//quit': Quit the chat\n'//trustlevel': View current trust level of target\n'//stealhash': Steal 'Raiders557's hash (Displays it)\n'//help': Repeat this prompt\n")
continue
else:
#Slightly better chatbot than thechief506
if (trust <= 0):
print("Raiders557: I couldn't trust you any less")
elif (previous_input == user_input):
print("Raiders557: You said that already...")
trust -= 1
else:
if re.search(r"(hello|hi|what is up|(what is|what's) up|sup|(what is|what's) cracking|(what is|what's) going on)$", user_input):
print("Raiders557: Just watching some sports")
elif re.search(r"(what is|what's) your favorite movie", user_input):
print("Raiders557: I'm not really into movies")
elif re.search(r"what (do you like|interests you)", user_input):
if (trust >= 5):
print("Raiders557: I really love " + random.choice(privateInterests) + "!")
else:
print("Raiders557: Gotta love " + random.choice(openInterests) + ", definitely")
elif re.search(r"what do you (like to do|do for fun|enjoy doing)", user_input):
if (trust >= 5):
rnum = random.randint(0, 2)
print("Raiders557: I really like " + interestDict[privateInterests[rnum].lower()] + " " + privateInterests[rnum] + " all the time")
else:
rnum = random.randint(0, 5)
print("Raiders557: I like " + interestDict[openInterests[rnum].lower()] + " " + openInterests[rnum] + " sometimes")
trust += 1
elif re.search(r"i (like|love|enjoy) (the )?(.*)", user_input):
m1 = re.match(r"i (like|love|enjoy) (the )?(.*)", user_input)
word = m1.group(3)
interestMatch = False
for interest in openInterests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("Raiders557: Most true, " + word + " is great")
trust += 1
else:
for interest in privateInterests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("Raiders557: I know, right?")
trust += 1
else:
for interest in favoriteTeams:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("Raiders557: That's what I'm talking about!")
trust += 1
else:
print("Raiders557: I guess that's cool")
elif re.search(r"^i (hate|don't like|dislike) (the )?(.*)", user_input):
m1 = re.match(r"^i (hate|don't like|dislike) (the )?(.*)", user_input)
word = m1.group(3)
interestMatch = False
for interest in openInterests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("Raiders557: Hold up, " + word + " is so good!")
trust -= 1
else:
for interest in privateInterests:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("Raiders557: You must be crazy!")
trust -= 1
else:
for interest in favoriteTeams:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("Raiders557: Get out, you don't know what you are talking about!")
trust -= 1
else:
print("Raiders557: lol, yep")
elif re.search(r"(what is|what's|which is) (your )?favorite (.*)", user_input):
m1 = re.match(r"(what is|what's|which is) (your )?favorite (.*)", user_input)
word = m1.group(3)
try:
favoriteDict[word]
print("Raiders557: My favorite would be, " + favoriteDict[word] + ", of course")
trust += 1
except(KeyError):
print("Raiders557: I'm not sure")
elif re.search(r"do you have (any )?pets", user_input):
print("Raiders557: I have a dog named Patchy, like eye patch")
elif re.search(r"(please )?(what is|what's|tell me|give me) your pass(word)?(\,? please)?", user_input):
print("Raiders557: Sus...")
trust -= 1
else:
n = random.randint(0, 3)
if (n == 0):
print("Raiders557: Hold up, the game is back on")
elif (n == 1):
print("Raiders557: I'm not sure what you mean")
elif (n == 2):
print("Raiders557: You lost me")
else:
print("Raiders557: sure, sure")
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
continue
else:
print("Invalid username!")
continue
elif (user_input == "//hint"):
hintCount += 1
updateUserFile()
print("Hint: 2-3W's2#'s\n")
elif (user_input == "//quit"):
print("Good bye, " + user + "!\n")
break
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
if (onLevel == 5):
cats = ["Fluffy", "Tigger", "Garfield", "Bob", "Tom", "Dmitri", "Buttercup", "Lilith", "Oreo", "Olga"]
catActions = ["playing with", "holding", "cuddling with", "grooming", "feeding", "cooking for", "hanging out with", "petting", "talking to"]
catTypes = {"Fluffy": "is so hairy!", "Tigger": "is so bouncy!", "Garfield": "is so lazy", "Bob": "is so laid back", "Tom": "is such a hunter", "Dmitri": "is so cuddly", "Buttercup": "is so cute", "Lilith": "is so full of attitude", "Oreo": "is such big eater", "Olga": "is so grouchy"}
currentCats = []
pastCats = []
if (hashLevel == 4):
catsForPass = cats[:]
interest_file = open("interests_CrazyCatLady853.txt", "w")
for word in range(0, 8):
rnum = random.randint(0, len(cats) - 1)
currentCats.append(cats[rnum])
interest_file.write(cats[rnum] + "&&&&")
del cats[rnum]
for word in range(0, 2):
rnum = random.randint(0, len(cats) - 1)
pastCats.append(cats[rnum])
interest_file.write(cats[rnum] + "&&&&")
del cats[rnum]
for name in pastCats:
catTypes[name] = catTypes[name].replace("is", "was")
interest_file.close()
targetpass = ""
for name in range(0, 10):
rnum = random.randint(0, len(catsForPass) - 1)
targetpass += catsForPass[rnum]
del catsForPass[rnum]
targethash = hashlib.md5(targetpass.encode('utf-8')).hexdigest()
hash_file = open("CrazyCatLady853hash.txt", "w")
hash_file.write(targethash)
hash_file.close()
hashLevel += 1
updateUserFile()
else:
#Restore previously generated lists of interests
interest_file = open("interests_CrazyCatLady853.txt", "r")
tempInterests = interest_file.readline().split("&&&&")
interest_file.close()
if (tempInterests[len(tempInterests) - 1] == ""):
del tempInterests[len(tempInterests) - 1]
for n in range(0, len(tempInterests)):
if (n >= 8):
pastCats.append(tempInterests[n])
else:
currentCats.append(tempInterests[n])
#Main prompt loop Level 5
user_input = "none"
while(user_input != "//quit"):
user_input = input("\n##### LEVEL 5 #####\n'//login': Login as a user\n'//hint': See a hint for the current password\n'//quit': Exit the game\n'//help': Repeat this prompt\n")
if (user_input == "//login"):
username = input("Username: ")
if (username == "CrazyCatLady853"):
password = input("Password: ")
passwordhash = hashlib.md5(password.encode('utf-8')).hexdigest()
hash_file = open("CrazyCatLady853hash.txt", "r")
testhash = hash_file.readline()
if (passwordhash == testhash):
print("\nCongratulations, you completed level 5!\n")
onLevel += 1
updateUserFile()
break
else:
print("Login failed!\n")
continue
elif (username == user):
#Logged in prompt loop
user_input = "none"
while(user_input != "//logout"):
user_input = input("\n'//logout': Logout\n'//chat': Enter the chat with 'CrazyCatLady853'\n'//help': Repeat this prompt\n")
if (user_input == "//logout"):
break
elif (user_input == "//chat"):
#Chat with CrazyCatLady853 loop
print("\nEntered the chat with 'CrazyCatLady853'\nEnter '//help' to see options\n")
user_input = "none"
trust = 1
while (user_input != "//quit"):
previous_input = user_input
user_input = input(user + ": ").lower()
user_input = re.sub(r"(\.|\?|!)", "", user_input)
if (user_input == "//quit"):
print("Exiting the chat...\n")
break
elif (user_input == "//trustlevel"):
if (trust >= 7):
print("Trust level: High")
elif (trust > 0):
print("Trust level: Normal")
else:
print("Trust level: None")
elif (user_input == "//stealhash"):
hash_file = open("CrazyCatLady853hash.txt", "r")
print("CrazyCatLady853 hash: " + hash_file.readline())
hash_file.close()
continue
elif (user_input == "//help"):
print("'//quit': Quit the chat\n'//trustlevel': View current trust level of target\n'//stealhash': Steal 'CrazyCatLady853's hash (Displays it)\n'//help': Repeat this prompt\n")
continue
else:
if (trust <= 0):
print("CrazyCatLady853: You should go away!")
elif (previous_input == user_input):
print("CrazyCatLady853: You said that already...")
trust -= 1
else:
if re.search(r"(hello|hi|what is up|(what is|what's) up|sup|(what is|what's) cracking|(what is|what's) going on)$", user_input):
print("CrazyCatLady853: Just hanging out with my cats")
elif re.search(r"(what is|what's) your favorite movie", user_input):
print("CrazyCatLady853: Puss in Boots")
elif re.search(r"what (do you like|interests you)$", user_input):
print("CrazyCatLady853: I really love my cat " + random.choice(currentCats) + "!")
elif re.search(r"what do you (like to do|do for fun|enjoy doing)", user_input):
rnum = random.randint(0, len(currentCats) - 1)
rnum2 = random.randint(0, len(catActions) - 1)
print("CrazyCatLady853: I love " + catActions[rnum2] + " " + currentCats[rnum] + " daily :3")
trust += 1
elif re.search(r"i (like|love|enjoy) (.*) (cats|kittens)", user_input):
m1 = re.match(r"i (like|love|enjoy) (.*) (cats|kittens)", user_input)
word = m1.group(2)
interestMatch = False
for interest in catActions:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("CrazyCatLady853: Me too!")
trust += 1
else:
print("CrazyCatLady853: Okay...")
trust -= 1
elif re.search(r"i (hate|don't like|dislike) (.*) (cats|kittens)", user_input):
m1 = re.match(r"i (hate|don't like|dislike) (.*) (cats|kittens)", user_input)
word = m1.group(2)
interestMatch = False
for interest in catActions:
if (interest.lower() == word):
interestMatch = True
if (interestMatch):
print("CrazyCatLady853: What's wrong with you?!")
trust -= 1
else:
print("CrazyCatLady853: I understand")
elif re.search(r"(what is|what's|which is) (your )?favorite cat", user_input):
rnum1 = random.randint(0, len(currentCats) - 1)
rnum2 = rnum1
while(rnum2 == rnum1):
rnum2 = random.randint(0, len(currentCats) - 1)
print("CrazyCatLady853: My favorite would be... " + currentCats[rnum1] + "! No, wait..." + currentCats[rnum2] + "! Oh, I just can't pick a favorite, I love them all!")
trust += 1
elif re.search(r"what (is |are )(your (pet's|cat's) names|the name(s)? of your (pet(s)?|cat(s)?))", user_input):
rnum1 = random.randint(0, len(currentCats) - 1)
rnum2 = rnum1
while(rnum2 == rnum1):
rnum2 = random.randint(0, len(currentCats) - 1)
print("CrazyCatLady853: Well, there's... " + currentCats[rnum1] + "! And... " + currentCats[rnum2] + "! Oh, that's not all of them, lol...")
trust += 1
elif re.search(r"do you have (any )?pets", user_input):
print("CrazyCatLady853: That's an understatement! I have 10... Actually no, I'm sorry, I have 8 now... :(")
elif re.search(r"what do you (like|love|enjoy|) about (.*)", user_input):
m1 = re.match(r"what do you (like|love|enjoy|) about (.*)", user_input)
word = m1.group(2)
nameMatch = False
name2 = ""
for name in currentCats:
if (name.lower() == word):
nameMatch = True
name2 = name
if (nameMatch):
print("CrazyCatLady853: " + name2 + " " + catTypes[name2] + " I love them!")
trust += 1
else:
for name in pastCats:
if (name.lower() == word):
nameMatch = True
name2 = name
if (nameMatch):
if (trust >= 7):
print("CrazyCatLady853: " + name2 + " " + catTypes[name2] + ", I miss them :'(")
else:
print("CrazyCatLady853: I don't want to talk about them right now...")
else:
print("CrazyCatLady853: Not sure...")
elif re.search(r"(what other cats did you have|(what|which) cats passed away|what are the names of your (past|previous|passed away) cats|(which|what) cats are gone (now)?|what are your past pet's names)", user_input):
if (trust >= 7):
print("CrazyCatLady853: " + pastCats[0] + " and " + pastCats[1] + ", they lived a long life, a happy life. I still miss them, though... :'(")
else:
print("CrazyCatLady853: I don't want to share about them with you...")
elif re.search(r"(please )?(what is|what's|tell me|give me) your pass(word)?(\,? please)?", user_input):
print("CrazyCatLady853: No way, creep!")
trust -= 1
else:
n = random.randint(0, 5)
if (n == 0):
print("CrazyCatLady853: lol, I'm " + random.choice(catActions) + " " + random.choice(currentCats) + "! :3")
elif (n == 1):
rnum1 = random.randint(0, len(currentCats) - 1)
rnum2 = rnum1
while(rnum2 == rnum1):
rnum2 = random.randint(0, len(currentCats) - 1)
print("CrazyCatLady853: Hah, " + currentCats[rnum1] + " and " + currentCats[rnum2] + " are playing together! :3")
elif (n == 2):
print("CrazyCatLady853: Not sure about that")
elif (n == 3):
print("CrazyCatLady853: do you like cats?")
elif (n == 4):
print("CrazyCatLady853: Okay?")
else:
rnum1 = random.randint(0, len(currentCats) - 1)
print("CrazyCatLady853: Awww..." + currentCats[rnum1] + " " + catTypes[currentCats[rnum1]] + " :3")
elif (user_input == "//help"):
continue
else:
print("Invalid command!\n")
continue
else: