-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserNameGen.py
189 lines (168 loc) · 8.07 KB
/
UserNameGen.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
#!/usr/bin/python3
import argparse
import time
import sys
from os import path
def welcome():
print(r'''
_____ _____ _____
| | |___ ___ ___| | |___ _____ ___| __|___ ___
| | |_ -| -_| _| | | | .'| | -_| | | -_| |
|_____|___|___|_| |_|___|__,|_|_|_|___|_____|___|_|_|
''')
def parse_args():
parser = argparse.ArgumentParser(prog='UserNameGen.py', description='A Simple CMD Line Username Generator {GitHub:https://github.com/RogueCyberSecurityChannel}')
parser.add_argument('-u', '--user-file', dest='users_file', metavar='users.txt', type=str,
help='A list of First and Last names to generate usernames from. Example: "users.txt"')
parser.add_argument('-o', '--output-file', dest='output_file', metavar='output.txt', type=str,
help='Output file for generated usernames. Example: "output.txt"')
parser.add_argument('-d', '--domain-name', dest='domain', metavar='@domain.com', type=str,
help='Domain name you would like to append to generated usernames. Example: "@domain.com"')
parser.set_defaults(users_file=False, output_file=False, domain=False)
args = parser.parse_args(sys.argv[1:])
arg_errors = arg_error_check(args)
if len(arg_errors) > 0:
for error in arg_errors:
print("[-] {0}".format(error))
print()
parser.print_help()
sys.exit(1)
return args
def arg_error_check(args):
arg_errors = []
if args.users_file and args.output_file and args.domain and len(vars(args)) == 3:
if(path.exists(args.output_file)):
arg_errors.append('The file \"' + args.output_file + '\" already exists')
else:
arg_errors.append('Argument error. Example: "UserNameGen.py -u <user file> -o <output file> -d <domain>"')
return arg_errors
def generator(user_file,output_file,domain):
output = open(output_file,'w')
nb_user=0
with open(user_file) as fp:
line = fp.readline().lower()
while line:
list_name=line.strip().split()
if(len(list_name)!=2):
print("Warning: The line \"" + line.rstrip() + "\" inside " + user_file + " is not correct. The data must be formatted with this format: [first name] [surname]")
line = fp.readline().lower()
else:
#### Just the Name
output.write(list_name[1]+ domain + '\n')
#### Just the firstname
output.write(list_name[0] + domain + '\n')
#### firstname.name
output.write(list_name[0] + "." + list_name[1] + domain + '\n')
#### name.firstname
output.write(list_name[1] + "." + list_name[0] + domain + '\n')
#### firstname-name
output.write(list_name[0] + "-" + list_name[1] + domain + '\n')
#### name-firstname
output.write(list_name[1] + "-" + list_name[0] + domain + '\n')
#### firstnamename
output.write(list_name[0] + list_name[1] + domain + '\n')
#### namefirstname
output.write(list_name[1] + list_name[0] + domain + '\n')
#### firstname_name
output.write(list_name[0] + "_" + list_name[1] + domain + '\n')
#### name_firstname
output.write(list_name[1] + "_" + list_name[0] + domain + '\n')
#### F.name
output.write(list_name[0][0] + "." + list_name[1] + domain + '\n')
#### N.firstname
output.write(list_name[1][0] + "." + list_name[0] + domain + '\n')
#### name.F
output.write(list_name[1] + "." + list_name[0][0] + domain + '\n')
#### firstname.N
output.write(list_name[0] + "." + list_name[1][0] + domain + '\n')
#### F-name
output.write(list_name[0][0] + "-" + list_name[1] + domain + '\n')
#### N-firstname
output.write(list_name[1][0] + "-" + list_name[0] + domain + '\n')
#### name-F
output.write(list_name[1] + "-" + list_name[0][0] + domain + '\n')
#### firstname-N
output.write(list_name[0] + "-" + list_name[1][0] + domain + '\n')
#### Fname
output.write(list_name[0][0] + list_name[1] + domain + '\n')
#### Nfirstname
output.write(list_name[1][0] + list_name[0] + domain + '\n')
#### nameF
output.write(list_name[1] + list_name[0][0] + domain + '\n')
#### firstnameN
output.write(list_name[0] + list_name[1][0] + domain + '\n')
#### F_name
output.write(list_name[0][0] + "_" + list_name[1] + domain + '\n')
#### N_firstname
output.write(list_name[1][0] + "_" + list_name[0] + domain + '\n')
#### name_F
output.write(list_name[1] + "_" + list_name[0][0] + domain + '\n')
#### firstname_N
output.write(list_name[0] + "_" + list_name[1][0] + domain + '\n')
#put maj
list_name[0]=list_name[0].capitalize()
list_name[1]=list_name[1].capitalize()
#### Just the Name with uppercase
output.write(list_name[1]+'\n')
#### Just the firstname with uppercase
output.write(list_name[0] + '\n')
#### firstname.name with uppercase
output.write(list_name[0] + "." + list_name[1] + domain + '\n')
#### name.firstname with uppercase
output.write(list_name[1] + "." + list_name[0] + domain + '\n')
#### firstname-name with uppercase
output.write(list_name[0] + "-" + list_name[1] + domain + '\n')
#### name-firstname with uppercase
output.write(list_name[1] + "-" + list_name[0] + domain + '\n')
#### firstnamename with uppercase
output.write(list_name[0] + list_name[1] + domain + '\n')
#### namefirstname with uppercase
output.write(list_name[1] + list_name[0] + domain + '\n')
#### firstname_name with uppercase
output.write(list_name[0] + "_" + list_name[1] + domain + '\n')
#### name_firstname with uppercase
output.write(list_name[1] + "_" + list_name[0] + domain + '\n')
#### F.name with uppercase
output.write(list_name[0][0] + "." + list_name[1] + domain + '\n')
#### N.firstname with uppercase
output.write(list_name[1][0] + "." + list_name[0] + domain + '\n')
#### name.F with uppercase
output.write(list_name[1] + "." + list_name[0][0] + domain + '\n')
#### firstname.N with uppercase
output.write(list_name[0] + "." + list_name[1][0] + domain + '\n')
#### F-name with uppercase
output.write(list_name[0][0] + "-" + list_name[1] + domain + '\n')
#### N-firstname with uppercase
output.write(list_name[1][0] + "-" + list_name[0] + domain + '\n')
#### name-F with uppercase
output.write(list_name[1] + "-" + list_name[0][0] + domain + '\n')
#### firstname-N with uppercase
output.write(list_name[0] + "-" + list_name[1][0] + domain + '\n')
#### Fname with uppercase
output.write(list_name[0][0] + list_name[1] + domain + '\n')
#### Nfirstname with uppercase
output.write(list_name[1][0] + list_name[0] + domain + '\n')
#### nameF with uppercase
output.write(list_name[1] + list_name[0][0] + domain + '\n')
#### firstnameN with uppercase
output.write(list_name[0] + list_name[1][0] + domain + '\n')
#### F_name with uppercase
output.write(list_name[0][0] + "_" + list_name[1] + domain + '\n')
#### N_firstname with uppercase
output.write(list_name[1][0] + "_" + list_name[0] + domain + '\n')
#### name_F with uppercase
output.write(list_name[1] + "_" + list_name[0][0] + domain + '\n')
#### firstname_N with uppercase
output.write(list_name[0] + "_" + list_name[1][0] + domain + '\n')
line = fp.readline().lower()
nb_user+=52
# time.sleep(.5)
print('[*] Number of usersnames created: ' + str(nb_user) )
# time.sleep(1)
print("[+] Usernames written to output file " + output_file)
def main():
welcome()
args = parse_args()
generator(args.users_file, args.output_file, args.domain)
if __name__ == '__main__':
main()