Last active
February 11, 2026 05:06
-
Star
(221)
You must be signed in to star a gist -
Fork
(84)
You must be signed in to fork a gist
-
-
Save superkojiman/11076951 to your computer and use it in GitHub Desktop.
Revisions
-
superkojiman revised this gist
Mar 25, 2022 . 1 changed file with 57 additions and 27 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,36 +1,66 @@ #!/usr/bin/env python3 ''' NameMash by superkojiman Generate a list of possible usernames from a person's first and last name. https://blog.techorganic.com/2011/07/17/creating-a-user-name-list-for-brute-force-attacks/ ''' import sys import os.path if __name__ == '__main__': if len(sys.argv) != 2: print(f'usage: {sys.argv[0]} names.txt') sys.exit(0) if not os.path.exists(sys.argv[1]): print(f'{sys.argv[1]} not found') sys.exit(0) with open(sys.argv[1]) as f: for line in enumerate(f): # remove anything in the name that aren't letters or spaces name = ''.join([c for c in line[1] if c == ' ' or c.isalpha()]) tokens = name.lower().split() if len(tokens) < 1: # skip empty lines continue # assume tokens[0] is the first name fname = tokens[0] # remaining elements in tokens[] must be the last name lname = '' if len(tokens) == 2: # assume traditional first and last name # e.g. John Doe lname = tokens[-1] elif len(tokens) > 2: # assume multi-barrelled surname # e.g. Jane van Doe # remove the first name del tokens[0] # combine the multi-barrelled surname lname = ''.join([s for s in tokens]) # create possible usernames print(fname + lname) # johndoe print(lname + fname) # doejohn print(fname + '.' + lname) # john.doe print(lname + '.' + fname) # doe.john print(lname + fname[0]) # doej print(fname[0] + lname) # jdoe print(lname[0] + fname) # djoe print(fname[0] + '.' + lname) # j.doe print(lname[0] + '.' + fname) # d.john print(fname) # john print(lname) # joe -
superkojiman revised this gist
Apr 14, 2020 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,11 @@ name = ''.join([c for c in line if c == " " or c.isalpha()]) tokens = name.lower().split() # skip empty lines if len(tokens) < 1: continue fname = tokens[0] lname = tokens[-1] -
superkojiman revised this gist
Apr 14, 2020 . 1 changed file with 24 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,31 @@ #!/usr/bin/env python import sys import os.path if __name__ == "__main__": if len(sys.argv) != 2: print("usage: {} names.txt".format((sys.argv[0]))) sys.exit(0) if not os.path.exists(sys.argv[1]): print("{} not found".format(sys.argv[1])) sys.exit(0) for line in open(sys.argv[1]): name = ''.join([c for c in line if c == " " or c.isalpha()]) tokens = name.lower().split() fname = tokens[0] lname = tokens[-1] print(fname + lname) # johndoe print(lname + fname) # doejohn print(fname + "." + lname) # john.doe print(lname + "." + fname) # doe.john print(lname + fname[0]) # doej print(fname[0] + lname) # jdoe print(lname[0] + fname) # djoe print(fname[0] + "." + lname) # j.doe print(lname[0] + "." + fname) # d.john print(fname) # john print(lname) # joe -
superkojiman created this gist
Apr 19, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/usr/bin/env python import sys if __name__ == "__main__": if len(sys.argv) != 2: print "usage: %s names.txt" % (sys.argv[0]) sys.exit(0) for line in open(sys.argv[1]): name = ''.join([c for c in line if c == " " or c.isalpha()]) tokens = name.lower().split() fname = tokens[0] lname = tokens[-1] print fname + lname # johndoe print lname + fname # doejohn print fname + "." + lname # john.doe print lname + "." + fname # doe.john print lname + fname[0] # doej print fname[0] + lname # jdoe print lname[0] + fname # djoe print fname[0] + "." + lname # j.doe print lname[0] + "." + fname # d.john print fname # john print lname # joe