chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Thread Rating:
  • 0 Vote(s) - 0 Average


Generate possible usernames filter_list
Author
Message
Generate possible usernames #1
When attacking an account, especially when dealing with companies, the usersnames often is a combination of first and last name. Here's a script that will generate, to my knowledge, some of the most combinations.

You can either provide a single name of a file with one name per line

Syntax: ./genuname.py [option] [filename|name]

Code:
#!/usr/bin/python

import sys

def makeUsernames(names):
    result = []
    for name in names:
        name = name.replace("\n", '')
        name = name.lower()
        parts = name.split(' ')

        fname = parts[0]
        if len(parts) > 1:
            lname = parts[len(parts) - 1]

            result.append(fname + lname)
            result.append(lname + fname)
            result.append(fname[0] + lname)
            result.append(fname + lname[0])
            result.append(lname[0] + fname)
            result.append(lname + fname[0])
            result.append(fname + '.' + lname)
            result.append(lname + '.' + fname)
            result.append(fname[0] + '.' + lname)
            result.append(lname[0] + '.' + fname)
            result.append(fname + '_' + lname)
            result.append(lname + '_' + fname)
            result.append(fname[0] + '_' + lname)
            result.append(lname[0] + '_' + fname)
            result.append(fname + '-' + lname)
            result.append(lname + '-' + fname)
            result.append(fname[0] + '-' + lname)
            result.append(lname[0] + '-' + fname)
        else:
             result.append(fname)

    return result

names = []
if len(sys.argv) < 2:
    sys.exit('Syntax error: Not enough arguments')
elif sys.argv[1] == '-f':
    if len(sys.argv) != 3:
        sys.exit('Syntax error: You must supply an existing file')
    else:
        filename = sys.argv[2]
        try:
            with open(filename) as f:
                names = f.readlines()
        except IOError:
            sys.exit('IOError: No such file or directory')
else:
    names = [' '.join(sys.argv[1:])]

if len(names) > 0:
    result = makeUsernames(names)
    for name in result:
        print name
else:
    sys.exit('Unable to generate data')

Usage
Single name:
Code:
./genuname.py Jane Doe
janedoe
doejane
jdoe
janed
djane
doej
jane.doe
doe.jane
j.doe
d.jane
jane_doe

Name list (John Doe & Eric Smith)
Code:
./genuname.py -f filename
johndoe
doejohn
jdoe
johnd
djohn
doej
john.doe
doe.john
j.doe
d.john
john_doe
doe_john
j_doe
d_john
john-doe
doe-john
j-doe
d-john
ericsmith
smitheric
esmith
erics
seric
smithe
eric.smith
smith.eric
e.smith
s.eric
eric_smith
smith_eric
e_smith
s_eric
eric-smith
smith-eric
e-smith
s-eric

Note: This was my very first Python script Smile

Reply

RE: Generate possible usernames #2
Interesting script! I haven't really used Python very much in the past unless I'm reading through a local root exploit but I now have to learn it for a qualification in computing.
Today I learned: The existence of the append, split, and lower string variable properties.

Reply

RE: Generate possible usernames #3
Wow interesting, this is something I could use. Great share.

Reply






Users browsing this thread: 1 Guest(s)