-
Notifications
You must be signed in to change notification settings - Fork 0
/
rockme.py
169 lines (128 loc) · 7.24 KB
/
rockme.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
###### rockme.py is for educational and security awareness purposes only #####
### Assign NASI escape codes for text color
RED = "\033[91m" # Used for error messages
RESET = "\033[0m" # Resets text color after displaying error message
### Display main menu
while True:
print("=======================================")
print(" Please select a wordlist from below ")
print("=======================================")
print("[1] - rockyou-75.txt")
print("[2] - darkweb2017-top10000.txt")
print("[ ] -")
print("[ ] -")
print("[ ] -")
print("[Q] - Quit")
# Prompts user to enter a choice and converts it to a string
main_choice = str(input("Enter: "))
# Displays submenu related to RockYou
if main_choice == "1":
print("=======================================")
print(" rockyou-75.txt ")
print("=======================================")
print("[1] - Check password")
print("[2] - Display content")
print("[3] - What is RockYou.txt?")
print("[ ] ")
print("[Q] - Quit")
# Prompts user to enter a subchoice and converts it to a string
sub_choice = str(input("Enter: "))
# Begin logic for subchoice 1
if sub_choice == "1":
# Assigns the file to var
import_file = "rockyou-75.txt"
# Opens file in "r" mode. Reads and assign the file's content to var and turns it into a list, where each element is separated by a content's line break
with open(import_file, "r") as file:
password_list = file.read().splitlines()
# Prompts the user to enter a password they would like to check against wordlist content
user_pw = str(input("What is the password you would like to check: "))
# For loop iterates each element within the wordlist
for password_index, password in enumerate(password_list):
# Logic compares user's password against current element being checked
# var password_index keeps track of the index location of the matching password
# Notifies the user a match has been found and it's index location
# Otherwise, indicate no match and quit the script
if user_pw == password:
print(f'A match has been identified to password "{user_pw}" at index position {password_index}')
quit()
else:
print("No match was identified")
quit()
# Begin logic for subchoice 2
if sub_choice == "2":
# Assigns the file to var
import_file = "rockyou-75.txt"
# Opens file in "r" mode. Reads and assign the file's content to var and turns it into a list, where each element is separated by a content's line break
with open(import_file, "r") as file:
password_list = file.read().splitlines()
# For logic iterates through each element in wordlist, and displays it to user. Quit script when finished
for password in password_list:
print(password)
quit()
# Begin logic for subchoice 3
if sub_choice == "3":
print("")
print("In 2009, a social app named RockYou experienced a massive cyberattack which led to over 32 million user passwords becoming exposed due to being stored in plaintext.")
print("The leaked passwords have since been compiled into a wordlist commonly known as 'RockYou.txt', and used by security professionals and malicious actors.")
print("as part of a password dictionary attack and penetration testing, as the wordlist is derived from real-life passwords.")
print("")
quit()
if sub_choice.lower() == "q":
quit()
if main_choice == "2":
print("=======================================")
print(" darkweb2017-top10000.txt ")
print("=======================================")
print("[1] - Check password")
print("[2] - Display content")
print("[ ] ")
print("[Q] - Quit")
# Prompts user to enter a subchoice and converts it to a string
sub_choice = str(input("Enter: "))
# Begin logic for subchoice 1
if sub_choice == "1":
# Assigns the file to var. Ensure wordlist file is saved in same directory as script, or use absolute path and filename
import_file = "darkweb2017-top10000.txt"
# Opens file in "r" mode. Reads and assign the file's content to var and turns it into a list, where each element is separated by a content's line break
with open(import_file, "r", encoding="utf-8") as file:
password_list = file.read().splitlines()
# Prompts the user to enter a password they would like to check against wordlist content
user_pw = str(input("What is the password you would like to check: "))
# For loop iterates each element within the wordlist
for password_index, password in enumerate(password_list):
# Logic compares user's password against current element being checked
# var password_index keeps track of the index location of the matching password
# Notifies the user a match has been found and it's index location
# Otherwise, indicate no match and quit the script
if user_pw == password:
print(f'A match has been identified to password "{user_pw}" at index position {password_index}')
quit()
else:
print("No match was identified")
quit()
# Begin logic for subchoice 2
if sub_choice == "2":
# Assigns the file to var
import_file = "darkweb2017-top10000.txt"
# Opens file in "r" mode. Reads and assign the file's content to var and turns it into a list, where each element is separated by a content's line break
with open(import_file, "r", encoding="utf-8") as file:
password_list = file.read().splitlines()
# For logic iterates through each element in wordlist, and displays it to user. Quit script when finished
for password in password_list:
print(password)
quit()
if sub_choice.lower() == "q":
quit()
# if main choice is Q, then quit script
if main_choice.lower() == "q":
quit()
### User input validation
if main_choice.lower() != "1" or "q":
print(RED + "Invalid choice, try again." + RESET)
################################################ FOOTNOTES ################################################
#############################
# Version: 1.01 #
# Date: 08/10/2023 #
# Coder: CH @chan2git #
#############################
# rockyou-75.txt, darkweb2017-top10000.txt is from https://github.com/danielmiessler