Exemplo n.º 1
0
    def test_save_account(self):
        '''
        Test to check if the new account inputted is saved into the accounts list
        '''
        self.new_account.save_account()
		Instagram = Account('Mariam','Instagram','mariri','6969')
		Instagram.save_account()
Exemplo n.º 2
0
	def set_account_write(self, privkeybytes):
		acc = Account()
		acc.set_key(privkeybytes)
		# node pubkey is prefixed with 04
		# \todo verify that the number can't be other than 4
		currentpubkey = self.account.get_public_key()
		if len(currentpubkey) > 0 and acc.get_public_key() != self.account.get_public_key():
			raise ValueError("private key does not match pss node public key " + rpchex(acc.get_public_key()) + " != " + rpchex(self.account.get_public_key()))

		self.account.set_key(privkeybytes)
Exemplo n.º 3
0
    def set_account_write(self, privkeybytes):
        eth = Account()
        eth.set_key(privkeybytes)
        # node pubkey is prefixed with 04
        # \todo verify that the number can't be other than 4
        if eth.publickeybytes.encode("hex") != self.key[2:]:
            raise ValueError(
                "private key does not match pss node public key " + self.key +
                " " + eth.publickeybytes.encode("hex"))
            return

        self.eth = eth
Exemplo n.º 4
0
    def add(self, nick, participant):

        # account reflects the peer's address / key
        acc = Account()
        # \todo fix this 04 prefix ambiguity bullshit
        acc.set_public_key(clean_pubkey(participant.key).decode("hex"))

        # incoming feed user is peer
        participantfeed_in = Feed(self.agent, acc, self.name, False)
        self.feedcollection_in.add(participant.nick, participantfeed_in)
        self.participants[nick] = participant
        self.hsh_room = self.save()
Exemplo n.º 5
0
	def __init__(self, name, host="127.0.0.1", port="8546"):
		""" set the pss instance name and create the fifo for catching msgs from subprocess
		"""
		self.name = name
		if host != "":
			self.host = host
		if port != "":
			self.port = port

		self.connected = False
		self.inputConnected = False
		self.account = Account()
		self.overlay = ""
		self.err = 0
		self.errstr = ""
		self.seq = 0
		self.ws = None
		self.run = False
		self.sub = ""
Exemplo n.º 6
0
    def load(self, hsh, owneraccount=None):
        savedJson = self.bzz.get(hsh.encode("hex"))
        print "savedj " + repr(savedJson)
        self.hsh_room = hsh
        r = json.loads(savedJson)
        self.name = clean_name(r['name'])
        for pubkeyhx in r['participants']:
            acc = Account()
            acc.set_public_key(clean_pubkey(pubkeyhx).decode("hex"))
            nick = acc.address.encode("hex")
            p = Participant(nick, "04" + acc.publickeybytes.encode("hex"),
                            acc.address.encode("hex"), "")
            self.add(nick, p)

        # outgoing feed user is room publisher
        if owneraccount == None:
            owneraccount = self.feed_room.account

        self.feed_out = Feed(self.agent, owneraccount, self.name, True)
        hd = self.feed_out.head()
        if len(hd) == 64:
            self.hsh_out = hd.decode("hex")
Exemplo n.º 7
0
def create_account(account_name,account_username,account_password):
    new_account = Account(account_name,account_username,account_password)
    return new_account
Exemplo n.º 8
0
 def test_delete_account(self):
     self.new_account.save_account()
     test_account = Account("Twitter", "Bonte", "kinder")
     test_account.save_account()
     test_account.delete_account()
     self.assertEqual(len(Account.account_list), 1)
Exemplo n.º 9
0
def create_account(accountname, accountusername, accountpassword):
    '''
    function to create account
    '''
    new_account = Account(accountname, accountusername, accountpassword)
    return new_account
Exemplo n.º 10
0
 def test_find_account_by_name(self):
     self.new_account.save_account()
     test_account = Account("Facebook", "uwimana", "1234567")
     test_account.save_account()
     found_account = Account.find_by_accountName("Facebook")
     self.assertEqual(found_account.account_name,"Facebook")
Exemplo n.º 11
0
 def test_delete_account(self):
     self.new_account.save_account()
     test_account = Account("Twitter", "angeange", "angeange2020")
     test_account.save_account()
     test_account.delete_account()
     self.assertEqual(len(Account.account_list),1)
Exemplo n.º 12
0
 def setUp(self):
     self.new_account = Account("Instagram", "Uwimana", "ange2020")
Exemplo n.º 13
0
def create_account(firstname, site_name, account_name, password):
    '''
	Function to create a new account
	'''
    new_account = Account(firstname, site_name, account_name, password)
    return new_account
Exemplo n.º 14
0
 def test_find_account_by_name(self):
     self.new_account.save_account()
     test_account = Account("Medium", "Tesire", "sweetest")
     test_account.save_account()
     found_account = Account.find_by_accountName("Medium")
     self.assertEqual(found_account.account_name,"Medium")
Exemplo n.º 15
0
 def test_find_account_by_name(self):
     self.new_account.save_account()
     test_account = Account("Medium", "Emma", "kindern")
     test_account.save_account()
     found_account = Account.find_by_accountName("Medium")
     self.assertEqual(found_account.account_name, "Medium")
Exemplo n.º 16
0
def main():
    print(' ')
    print('Hello! Welcome to Password Locker.')
    while True:
        print(' ')
        print("-" * 100)
        print(
            "Use these short codes : ca - create a new account, da - display accounts, fa -find a account, ex -exit the account list "
        )
        short_code = input('Enter a choice: ').lower().strip()
        if short_code == 'ex':
            break

        elif short_code == 'ca':
            print("-" * 100)
            print(' ')
            print('To create a new account:')
            account_name = input('Enter your account name - ').strip()
            user_name = input('Enter your user name - ').strip()
            phone_number = input('Enter your phone number - ').strip()
            email = input('Enter your email - ').strip()
            Account(account_name, user_name, phone_number, email)
            print(" ")
            print(
                f'New Account Created for: {account_name} {user_name} using phone-number: {phone_number}'
            )
        elif short_code == 'da':
            print("-" * 100)
            print(' ')
            print('To create, enter your account details:')
            user_name = input('Enter your account name - ').strip()
            phone_number = str(input('Enter your phone_number- '))
            user_exists = verify_user(user_name, phone_number)
            if user_exists == user_name:
                print(" ")
                print(
                    f'Welcome {user_name}. Please choose an option to continue.'
                )
                print(' ')
                while True:

                    print("-" * 100)
                    print(
                        "Use these short codes : cc - create a new Credentials, dc - display Credentials, fc -find a Credentials, ex -exit the Credentials list"
                    )

                    short_code = input('Enter a choice: ').lower().strip()
                    print("-" * 100)
                    if short_code == 'ex':
                        print(" ")
                        print(f'Goodbye {user_name}')
                        break
                    elif short_code == 'cc':
                        print(' ')
                        print('Enter your Credentials details:')
                        site_name = input('Enter the site\'s name- ').strip()
                        account_name = input(
                            'Enter your account\'s name - ').strip()
                        while True:
                            print(' ')
                            print("-" * 100)
                            print(
                                'Please choose an option for entering a phone_number: \n ep-enter existing phone_number \n gp-generate a phone_number \n ex-exit'
                            )
                            phon_number_choice = input(
                                'Enter an option: ').lower().strip()
                            print("-" * 100)
                            if phn_choice == 'ep':
                                print(" ")
                                phone_number = input(
                                    'Enter your phone_number: ').strip()
                                break
                            elif phn_choice == 'gp':
                                phone_number = generate_phone_number()
                                break
                            elif psw_choice == 'ex':
                                break
                            else:
                                print('Oops! Wrong option entered. Try again.')
                        save_credential(
                            create_credential(user_name, site_name,
                                              account_name, phone_number))
                        print(' ')
                        print(
                            f'Credential Created: Site Name: {site_name} - Account Name: {account_name} - Phone_number: {phone_number}'
                        )
                        print(' ')
                    elif short_code == 'dc':
                        print(' ')
                        if display_credentials(user_name):

                            print('Here is a list of all your credentials')
                            print(' ')
                            for credential in display_credentials(user_name):
                                print(
                                    f'Site Name: {credential.site_name} - Account Name: {credential.account_name} - Phone_number: {credential.phone_number}'
                                )
                            print(' ')
                        else:
                            print(' ')
                            print(
                                "You don't seem to have any credentials saved yet"
                            )
                            print(' ')
                    elif short_code == 'copy':
                        print(' ')
                        chosen_site = input(
                            'Enter the site name for the credential phone_number to copy: '
                        )
                        copy_credential(chosen_site)
                        print('')
                    else:
                        print('Try again.')

            else:
                print(' ')
                print('Oops!Try again or Create an Account.')

        else:
            print("-" * 100)
            print(' ')
            print('Oops!Try again.')
Exemplo n.º 17
0
def create_account(aname, uname, phone, email):
    '''
        Function to create a new contact
        '''
    new_account = Account(aname, uname, phone, email)
    return new_account
Exemplo n.º 18
0
 def setUp(self):
     self.new_account = Account("Instagram", "Bonte", "kind")
Exemplo n.º 19
0
 def setUp(self):
     self.new_account = Account("Instagram", "Gisele", "sweet")