def generate_accounts(amount):
    known_accounts = []

    for person in range(0, amount):
        accounts = []
        first_name, last_name = gen_data.create_name()
        zip, city, state = gen_data.create_city_state_zip()
        address_id = str(random.randint(0, sys.maxint))

        UID = str(random.randint(0, sys.maxint))
        birth_day = gen_data.create_birthday()
        street_address = gen_data.create_street()
        email_address = gen_data.create_email(name=(first_name, last_name))

        print_instance(get_random_uuid_uri(), "nco:PersonContact")
        print_property("nco:fullname", str.join(" ", [first_name, last_name]))
        print_property("nco:nameGiven", first_name)
        print_property("nco:nameFamily", last_name)

        for j in range(0, random.randint(0, 4)):
            account_data = get_random_in_list(ACCOUNTS)
            user_account = str.join("", [account_data[2], str(j), email_address])
            print_property("nco:hasIMAccount", user_account, t="uri")
            accounts.append((user_account, account_data))
            known_accounts.insert(0, user_account)

        print_property("nco:birthDate", str(birth_day), final=True)

    return known_accounts
def generate_accounts(amount):
    known_accounts = []

    for person in range(0, amount):
        accounts = []
        first_name, last_name = gen_data.create_name()
        zip, city, state = gen_data.create_city_state_zip()
        address_id = str(random.randint(0, sys.maxint))

        UID = str(random.randint(0, sys.maxint))
        birth_day = gen_data.create_birthday()
        street_address = gen_data.create_street()
        email_address = gen_data.create_email(name=(first_name, last_name))

        print_instance(get_random_uuid_uri(), "nco:PersonContact")
        print_property("nco:fullname", str.join(' ', [first_name, last_name]))
        print_property("nco:nameGiven", first_name)
        print_property("nco:nameFamily", last_name)

        for j in range(0, random.randint(0, 4)):
            account_data = get_random_in_list(ACCOUNTS)
            user_account = str.join(
                '', [account_data[2], str(j), email_address])
            print_property("nco:hasIMAccount", user_account, t="uri")
            accounts.append((user_account, account_data))
            known_accounts.insert(0, user_account)

        print_property("nco:birthDate", str(birth_day), final=True)

    return known_accounts
示例#3
0
def generate_vCard():
    gender_initial = gender_vcard_list[random.randint(0, 4)]
    gender = None
    if gender_initial == 'M':
        gender = 'Male'
    elif gender_initial == 'F':
        gender = 'Female'

    (first_name, last_name) = gen_data.create_name(gender=gender)
    adr = gen_data.create_street()
    zip, city, state = gen_data.create_city_state_zip()

    properties = []
    properties.append('FN:{} {}\r\n'.format(first_name, last_name))
    if random.randint(0, 1):
        properties.append('N:{};{};;;\r\n'.format(last_name, first_name))
    if random.randint(0, 1):
        properties.append('TEL:tel:{}\r\n'.format(gen_data.create_phone()))
    if random.randint(0, 1):
        properties.append('GENDER:{}\r\n'.format(gender_initial))
    if random.randint(0, 1):
        properties.append('EMAIL:{}\r\n'.format(
            gen_data.create_email(name=(first_name, last_name)).lower()))
    if random.randint(0, 1):
        properties.append('IMPP:sip:{}@{}\r\n'.format(first_name.lower(),
                                                      'sip.linphone.org'))
    if random.randint(0, 1):
        properties.append('ADR:;;{};{};{};{};\r\n'.format(
            adr, city, state, zip))
    if random.randint(0, 1):
        properties.append('NOTE:{}\r\n'.format(gen_data.create_sentence()))
    if random.randint(0, 1):
        properties.append('ORG:{}\r\n'.format(gen_data.create_company_name()))
    if random.randint(0, 1):
        properties.append('BDAY:{0:%Y%m%d}\r\n'.format(
            gen_data.create_birthday()))

    shuffle(properties)
    vCard = 'BEGIN:VCARD\r\n'
    vCard += 'VERSION:4.0\r\n'
    for property in properties:
        vCard += property
    vCard += 'END:VCARD\r\n'
    return vCard
def fake_user():
    f = open('test_user.txt', 'w')
    lat = 40.4365
    lng = -99.3925
    jobs = [gen_data.create_job_title() for i in xrange(200)]
    for i in xrange(100):
        lat += 0.001
        lng -= 0.001
        zipcode, city, state = gen_data.create_city_state_zip()
        f.write(fake.first_name() + '|' + fake.last_name() + '|' +
                gen_data.create_street() + '|' + city + '|' + state + '|' +
                zipcode + '|' + fake.date() + '|' + str(sample(jobs, 1)[0]) +
                '|' + str(i) + '|' + fake.email() + '|' +
                fake.password(length=6,
                              special_chars=True,
                              digits=True,
                              upper_case=True,
                              lower_case=True) + '|' + str(lat) + '|' +
                str(lng) + '\n')
    f.close()
def generate_vCard():
	gender_initial = gender_vcard_list[random.randint(0, 4)]
	gender = None
	if gender_initial == 'M':
		gender = 'Male'
	elif gender_initial == 'F':
		gender = 'Female'

	(first_name, last_name) = gen_data.create_name(gender=gender)
	adr = gen_data.create_street()
	zip, city, state = gen_data.create_city_state_zip()

	properties = []
	properties.append('FN:{} {}\r\n'.format(first_name, last_name))
	if random.randint(0, 1):
		properties.append('N:{};{};;;\r\n'.format(last_name, first_name))
	if random.randint(0, 1):
		properties.append('TEL:tel:{}\r\n'.format(gen_data.create_phone()))
	if random.randint(0, 1):
		properties.append('GENDER:{}\r\n'.format(gender_initial))
	if random.randint(0, 1):
		properties.append('EMAIL:{}\r\n'.format(gen_data.create_email(name=(first_name, last_name)).lower()))
	if random.randint(0, 1):
		properties.append('IMPP:sip:{}@{}\r\n'.format(first_name.lower(), 'sip.linphone.org'))
	if random.randint(0, 1):
		properties.append('ADR:;;{};{};{};{};\r\n'.format(adr, city, state, zip))
	if random.randint(0, 1):
		properties.append('NOTE:{}\r\n'.format(gen_data.create_sentence()))
	if random.randint(0, 1):
		properties.append('ORG:{}\r\n'.format(gen_data.create_company_name()))
	if random.randint(0, 1):
		properties.append('BDAY:{0:%Y%m%d}\r\n'.format(gen_data.create_birthday()))
	
	shuffle(properties)
	vCard = 'BEGIN:VCARD\r\n'
	vCard += 'VERSION:4.0\r\n'
	for property in properties:
		vCard += property
	vCard += 'END:VCARD\r\n'
	return vCard
myOwnPhoneNumberURI = "tel:+11111111111"
previousContacts = []
previousEmailAddresses = []
previousIMAccounts = []
allchars = string.maketrans('','')

for dummy in range (0, count):
    firstName, lastName = gen_data.create_name()
    zip, city, state = gen_data.create_city_state_zip()
    postalAddressID=str(random.randint(0, sys.maxint))

    UID = str(random.randint(0, sys.maxint))
    phoneNumber = gen_data.create_phone()
    phoneUri = 'tel:+1' + phoneNumber.translate(allchars,' -()')
    birthDay = gen_data.create_birthday()
    streetAddress = gen_data.create_street()
    emailAddress = gen_data.create_email(name=(firstName, lastName))
    xmppAddress = str(firstName+"." + lastName + "@gmail.com").lower()
    hasIMAccount = False
    hasPhoneNumber = False
    jobTitle = gen_data.create_job_title()

    generatePostalAddress()
    generateEmailAddress()

    #Only every 3rd have Phone or IM to add variation.
    if random.randint(0, 3) > 2 or count == 1:
        generateIMAccount(gen_data, str)
        hasIMAccount = True
    if random.randint(0, 3) > 2 or count == 1:
        generatePhoneNumber()
示例#7
0
import random

from barnum import gen_data

import addressbook_pb2


# Barnum generates US data but that's ok for the example
names = [gen_data.create_name() for _ in range(0, 15)]
phones = [gen_data.create_phone() for _ in range(0, 30)]
postcodes = [gen_data.create_city_state_zip() for _ in range(0, 15)]
streets = [gen_data.create_street() for _ in range(0, 30)]

contacts = []
for name in names:
    address = {}
    # Simulate the fact that postcode are optionals
    if random.choice([True, False]):
        address['postcode'] = random.choice(postcodes)[0]
    address['address_lines'] = random.sample(streets, random.randint(0, 2))

    phone_numbers = []
    for _ in range(0, random.randint(0, 2)):
        phone_numbers.append({
            'type': random.choice(['MOBILE', 'LANDLINE']),
            'number': random.choice(phones)
        })
    contacts.append({
        'first_name': name[0],
        'last_name': name[1],
        'address': address,
示例#8
0
import random

from barnum import gen_data

import addressbook_pb2

# Barnum generates US data but that's ok for the example
names = [gen_data.create_name() for _ in range(0, 15)]
phones = [gen_data.create_phone() for _ in range(0, 30)]
postcodes = [gen_data.create_city_state_zip() for _ in range(0, 15)]
streets = [gen_data.create_street() for _ in range(0, 30)]

contacts = []
for name in names:
    address = {}
    # Simulate the fact that postcode are optionals
    if random.choice([True, False]):
        address['postcode'] = random.choice(postcodes)[0]
    address['address_lines'] = random.sample(streets, random.randint(0, 2))

    phone_numbers = []
    for _ in range(0, random.randint(0, 2)):
        phone_numbers.append({
            'type': random.choice(['MOBILE', 'LANDLINE']),
            'number': random.choice(phones)
        })
    contacts.append({
        'first_name': name[0],
        'last_name': name[1],
        'address': address,
        'phone_numbers': phone_numbers
示例#9
0
myOwnPhoneNumberURI = "tel:+11111111111"
previousContacts = []
previousEmailAddresses = []
previousIMAccounts = []
allchars = string.maketrans('', '')

for dummy in range(0, count):
    firstName, lastName = gen_data.create_name()
    zip, city, state = gen_data.create_city_state_zip()
    postalAddressID = str(random.randint(0, sys.maxint))

    UID = str(random.randint(0, sys.maxint))
    phoneNumber = gen_data.create_phone()
    phoneUri = 'tel:+1' + phoneNumber.translate(allchars, ' -()')
    birthDay = gen_data.create_birthday()
    streetAddress = gen_data.create_street()
    emailAddress = gen_data.create_email(name=(firstName, lastName))
    xmppAddress = str(firstName + "." + lastName + "@gmail.com").lower()
    hasIMAccount = False
    hasPhoneNumber = False
    jobTitle = gen_data.create_job_title()

    generatePostalAddress()
    generateEmailAddress()

    #Only every 3rd have Phone or IM to add variation.
    if random.randint(0, 3) > 2 or count == 1:
        generateIMAccount(gen_data, str)
        hasIMAccount = True
    if random.randint(0, 3) > 2 or count == 1:
        generatePhoneNumber()
示例#10
0
import pandas as pd
# impor the barnum library
from barnum import gen_data

# Create an empty list to store users
users = []

# Create 1000 records
for i in range(1000):
    company = gen_data.create_company_name()
    fname = gen_data.create_name(full_name=False)
    lname = gen_data.create_name(full_name=False)
    title = gen_data.create_job_title()
    email = gen_data.create_email(name=(fname, lname))
    pw = gen_data.create_pw()
    street = gen_data.create_street()
    city_state_zip = gen_data.create_city_state_zip()
    cc = gen_data.create_cc_number()
    # append a new user to the users list
    users.append(
        (company, fname, lname, title, email, pw, street, city_state_zip, cc))

# Create a set of labels for the first row of the excel spreadsheet
labels = [
    'Company', 'First', 'Last', 'Title', 'Email', 'Password', 'Street',
    'City/State/ZIP', 'Credit Card'
]
# Create a pandas dataframe
df = pd.DataFrame(data=users, columns=labels)
# Sort the data
df.sort_values(['First'], inplace=True)