Beispiel #1
0
    def setUp(self):
        self.unittest_dir = cd_unittest()

        self.msg = ("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean condimentum consectetur purus quis"
                    " dapibus. Fusce venenatis lacus ut rhoncus faucibus. Cras sollicitudin commodo sapien, sed bibendu"
                    "m velit maximus in. Aliquam ac metus risus. Sed cursus ornare luctus. Integer aliquet lectus id ma"
                    "ssa blandit imperdiet. Ut sed massa eget quam facilisis rutrum. Mauris eget luctus nisl. Sed ut el"
                    "it iaculis, faucibus lacus eget, sodales magna. Nunc sed commodo arcu. In hac habitasse platea dic"
                    "tumst. Integer luctus aliquam justo, at vestibulum dolor iaculis ac. Etiam laoreet est eget odio r"
                    "utrum, vel malesuada lorem rhoncus. Cras finibus in neque eu euismod. Nulla facilisi. Nunc nec ali"
                    "quam quam, quis ullamcorper leo. Nunc egestas lectus eget est porttitor, in iaculis felis sceleris"
                    "que. In sem elit, fringilla id viverra commodo, sagittis varius purus. Pellentesque rutrum loborti"
                    "s neque a facilisis. Mauris id tortor placerat, aliquam dolor ac, venenatis arcu.")

        self.ts         = datetime.now()
        self.master_key = MasterKey()
        self.settings   = Settings(log_file_masking=True)
        self.file_name  = f'{DIR_USER_DATA}{self.settings.software_operation}_logs'

        self.contact_list = ContactList(nicks=['Alice', 'Bob', 'Charlie', LOCAL_ID])
        self.key_list     = KeyList(    nicks=['Alice', 'Bob', 'Charlie', LOCAL_ID])
        self.group_list   = GroupList( groups=['test_group'])
        self.packet_list  = PacketList(contact_list=self.contact_list, settings=self.settings)
        self.window_list  = WindowList(contact_list=self.contact_list, settings=self.settings, 
                                       group_list=self.group_list, packet_list=self.packet_list)
        self.group_id     = group_name_to_group_id('test_group')
        self.file_keys    = dict()

        self.group_list.get_group('test_group').log_messages = True
        self.args = (self.window_list, self.packet_list, self.contact_list, self.key_list, 
                     self.group_list, self.settings, self.master_key, self.file_keys)

        ensure_dir(DIR_USER_DATA)
Beispiel #2
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.contact_list = ContactList()
     self.settings = Settings(disable_gui_dialog=True)
     self.queues = gen_queue_dict()
     self.onion_service = OnionService()
     self.args = self.contact_list, self.settings, self.onion_service, self.queues
Beispiel #3
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.old_key = MasterKey()
     self.new_key = MasterKey(master_key=os.urandom(SYMMETRIC_KEY_LENGTH))
     self.settings = Settings()
     self.tmp_file_name = f"{DIR_USER_DATA}{self.settings.software_operation}_logs_temp"
     self.time = STATIC_TIMESTAMP
Beispiel #4
0
    def setUp(self):
        self.short_msg = "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
        self.msg = ("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean condimentum consectetur purus quis"
                    " dapibus. Fusce venenatis lacus ut rhoncus faucibus. Cras sollicitudin commodo sapien, sed bibendu"
                    "m velit maximus in. Aliquam ac metus risus. Sed cursus ornare luctus. Integer aliquet lectus id ma"
                    "ssa blandit imperdiet. Ut sed massa eget quam facilisis rutrum. Mauris eget luctus nisl. Sed ut el"
                    "it iaculis, faucibus lacus eget, sodales magna. Nunc sed commodo arcu. In hac habitasse platea dic"
                    "tumst. Integer luctus aliquam justo, at vestibulum dolor iaculis ac. Etiam laoreet est eget odio r"
                    "utrum, vel malesuada lorem rhoncus. Cras finibus in neque eu euismod. Nulla facilisi. Nunc nec ali"
                    "quam quam, quis ullamcorper leo. Nunc egestas lectus eget est porttitor, in iaculis felis sceleris"
                    "que. In sem elit, fringilla id viverra commodo, sagittis varius purus. Pellentesque rutrum loborti"
                    "s neque a facilisis. Mauris id tortor placerat, aliquam dolor ac, venenatis arcu.")

        self.unittest_dir  = cd_unittest()
        self.ts            = datetime.now()
        self.contact       = create_contact('Alice')
        self.settings      = Settings(log_file_masking=True)
        self.onion_pub_key = nick_to_pub_key('Alice')
        self.window_list   = WindowList()
        self.whisper_header = b'\x00'

        compressed        = zlib.compress(b'file_data', level=COMPRESSION_LEVEL)
        file_key          = os.urandom(SYMMETRIC_KEY_LENGTH)
        encrypted         = encrypt_and_sign(compressed, key=file_key)
        encrypted        += file_key
        self.short_f_data = (int_to_bytes(1) + int_to_bytes(2) + b'testfile.txt' + US_BYTE + encrypted)
Beispiel #5
0
    def setUp(self):
        self.unittest_dir = cd_unittest()
        self.master_key = MasterKey()
        self.settings = Settings()
        self.window = RxWindow(type=WIN_TYPE_CONTACT,
                               uid=nick_to_pub_key('Alice'),
                               name='Alice',
                               type_print='contact')

        self.contact_list = ContactList(self.master_key, self.settings)
        self.contact_list.contacts = list(
            map(create_contact, ['Alice', 'Charlie']))

        self.time = STATIC_TIMESTAMP

        self.group_list = GroupList(groups=['test_group'])
        self.group = self.group_list.get_group('test_group')
        self.group.members = self.contact_list.contacts
        self.args = self.window, self.contact_list, self.group_list, self.settings, self.master_key

        self.msg = (
            "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean condimentum consectetur purus quis"
            " dapibus. Fusce venenatis lacus ut rhoncus faucibus. Cras sollicitudin commodo sapien, sed bibendu"
            "m velit maximus in. Aliquam ac metus risus. Sed cursus ornare luctus. Integer aliquet lectus id ma"
            "ssa blandit imperdiet. Ut sed massa eget quam facilisis rutrum. Mauris eget luctus nisl. Sed ut el"
            "it iaculis, faucibus lacus eget, sodales magna. Nunc sed commodo arcu. In hac habitasse platea dic"
            "tumst. Integer luctus aliquam justo, at vestibulum dolor iaculis ac. Etiam laoreet est eget odio r"
            "utrum, vel malesuada lorem rhoncus. Cras finibus in neque eu euismod. Nulla facilisi. Nunc nec ali"
            "quam quam, quis ullamcorper leo. Nunc egestas lectus eget est porttitor, in iaculis felis sceleris"
            "que. In sem elit, fringilla id viverra commodo, sagittis varius purus. Pellentesque rutrum loborti"
            "s neque a facilisis. Mauris id tortor placerat, aliquam dolor ac, venenatis arcu."
        )
Beispiel #6
0
    def setUp(self):
        self.unittest_dir = cd_unittest()
        self.master_key = MasterKey()
        self.settings = Settings()
        self.file_name = f'{DIR_USER_DATA}{self.settings.software_operation}_groups'
        self.contact_list = ContactList(self.master_key, self.settings)
        self.group_list = GroupList(self.master_key, self.settings,
                                    self.contact_list)
        self.nicks = [
            'Alice', 'Bob', 'Charlie', 'David', 'Eric', 'Fido', 'Guido',
            'Heidi', 'Ivan', 'Joana', 'Karol'
        ]
        self.group_names = [
            'test_group_1', 'test_group_2', 'test_group_3', 'test_group_4',
            'test_group_5', 'test_group_6', 'test_group_7', 'test_group_8',
            'test_group_9', 'test_group_10', 'test_group_11'
        ]
        members = list(map(create_contact, self.nicks))

        self.contact_list.contacts = members

        self.group_list.groups = \
            [Group(name         =name,
                   group_id     =group_name_to_group_id(name),
                   log_messages =False,
                   notifications=False,
                   members      =members,
                   settings     =self.settings,
                   store_groups =self.group_list.store_groups)
             for name in self.group_names]

        self.single_member_data_len = (
            GROUP_STATIC_LENGTH + self.settings.max_number_of_group_members *
            ONION_SERVICE_PUBLIC_KEY_LENGTH)
Beispiel #7
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.win_name     = nick_to_pub_key("Alice")
     self.contact_list = ContactList()
     self.group_list   = GroupList()
     self.settings     = Settings()
     self.master_key   = MasterKey()
Beispiel #8
0
 def setUp(self):
     self.settings = Settings()
     self.unittest_dir = cd_unittest()
     self.gateway = Gateway()
     self.rs = RSCodec(2 * self.gateway.settings.serial_error_correction)
     self.ts = datetime.now()
     self.queues = gen_queue_dict()
     self.args = self.queues, self.gateway
Beispiel #9
0
 def setUp(self):
     self.unittest_dir  = cd_unittest()
     self.settings      = Settings()
     self.queues        = gen_queue_dict()
     self.window        = TxWindow()
     self.onion_service = OnionService()
     self.contact_list  = ContactList(nicks=['Alice', 'Bob', 'Charlie'])
     self.args          = self.settings, self.queues, self.window
Beispiel #10
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.ts           = datetime.now()
     self.window_list  = WindowList()
     self.cmd_data     = nick_to_pub_key("Bob")
     self.settings     = Settings()
     self.master_key   = MasterKey()
     self.args         = self.cmd_data, self.ts, self.window_list
Beispiel #11
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.window = TxWindow(name='Alice', uid=nick_to_pub_key('Alice'))
     self.contact_list = ContactList()
     self.group_list = GroupList()
     self.settings = Settings()
     self.queues = gen_queue_dict()
     self.master_key = MasterKey()
     self.args = self.window, self.contact_list, self.group_list, self.settings, self.queues, self.master_key
Beispiel #12
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.ts = datetime.now()
     self.onion_pub_key = nick_to_pub_key('Alice')
     self.nick = 'Alice'
     self.settings = Settings()
     self.window_list = WindowList(nick=['Alice', 'Bob'])
     self.key = os.urandom(SYMMETRIC_KEY_LENGTH)
     self.args = self.onion_pub_key, self.nick, self.settings, self.window_list
Beispiel #13
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.contact_list = ContactList(nicks=['Alice'])
     self.group_list = GroupList(groups=['test_group'])
     self.settings = Settings()
     self.queues = gen_queue_dict()
     self.master_key = MasterKey()
     self.file_name = f'{DIR_USER_DATA}{self.settings.software_operation}_logs'
     self.args = self.contact_list, self.group_list, self.settings, self.queues, self.master_key
Beispiel #14
0
 def setUp(self):
     self.unittest_dir         = cd_unittest()
     self.file_name            = f"{DIR_USER_DATA}{TX}_settings"
     self.master_key           = MasterKey()
     self.settings             = Settings(self.master_key, operation=TX, local_test=False)
     self.contact_list         = ContactList(nicks=[f'contact_{n}' for n in range(18)])
     self.group_list           = GroupList(groups=[f'group_{n}' for n in range(18)])
     self.group_list.groups[0] = create_group('group_0', [f'contact_{n}' for n in range(18)])
     self.args                 = self.contact_list, self.group_list
Beispiel #15
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.user_input = UserInput()
     self.contact_list = ContactList(nicks=['Alice', 'Bob'])
     self.group_list = GroupList(groups=['test_group'])
     self.settings = Settings()
     self.queues = gen_queue_dict()
     self.master_key = MasterKey()
     self.args = self.contact_list, self.group_list, self.settings, self.queues, self.settings
Beispiel #16
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.contact_list = ContactList(nicks=['Alice'])
     self.group_list   = GroupList(groups=['test_group'])
     self.settings     = Settings()
     self.queues       = gen_queue_dict()
     self.master_key   = MasterKey()
     self.pub_key      = nick_to_pub_key('Alice')
     self.args         = self.contact_list, self.group_list, self.settings, self.queues, self.master_key
Beispiel #17
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.ts = datetime.now()
     self.account = nick_to_pub_key('Alice')
     self.file_key = SYMMETRIC_KEY_LENGTH * b'a'
     self.file_ct = encrypt_and_sign(50 * b'a', key=self.file_key)
     self.contact_list = ContactList(nicks=['Alice'])
     self.window_list = WindowList()
     self.settings = Settings()
     self.args = self.file_key, self.contact_list, self.window_list, self.settings
Beispiel #18
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.packet = b'\x00' + nick_to_pub_key("Alice")
     self.ts = datetime.now()
     self.window_list = WindowList(nicks=['Alice', LOCAL_ID])
     self.contact_list = ContactList(nicks=['Alice', LOCAL_ID])
     self.key_list = KeyList(nicks=['Alice', LOCAL_ID])
     self.settings = Settings(disable_gui_dialog=True)
     self.file_name = self.file_name
     self.args = self.packet, self.ts, self.window_list, self.contact_list, self.key_list, self.settings
Beispiel #19
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.master_key = MasterKey()
     self.settings = Settings()
     self.file_name = f'{DIR_USER_DATA}{self.settings.software_operation}_keys'
     self.keylist = KeyList(self.master_key, self.settings)
     self.full_contact_list = ['Alice', 'Bob', 'Charlie', LOCAL_ID]
     self.keylist.keysets = [
         create_keyset(n, store_f=self.keylist.store_keys)
         for n in self.full_contact_list
     ]
Beispiel #20
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.ts           = datetime.now()
     self.master_key   = MasterKey()
     self.settings     = Settings()
     self.contact_list = ContactList(nicks=[LOCAL_ID])
     self.window_list  = WindowList(nicks=[LOCAL_ID])
     self.group_list   = GroupList()
     self.key_list     = KeyList()
     self.args         = (self.ts, self.window_list, self.contact_list, self.group_list, 
                          self.key_list, self.settings, self.master_key)
Beispiel #21
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.contact_list = ContactList()
     self.group_list = GroupList()
     self.settings = Settings()
     self.queues = gen_queue_dict()
     self.master_key = MasterKey()
     self.onion_service = OnionService(
         master_key=self.master_key, file_name=f'{DIR_USER_DATA}/unittest')
     self.args = (self.contact_list, self.group_list, self.settings,
                  self.queues, self.master_key, self.onion_service)
Beispiel #22
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.nicks = ['Alice', 'Bob', 'Charlie']
     members = list(map(create_contact, self.nicks))
     self.settings = Settings()
     self.group = Group(name='test_group',
                        group_id=group_name_to_group_id('test_group'),
                        log_messages=False,
                        notifications=False,
                        members=members,
                        settings=self.settings,
                        store_groups=lambda: None)
     ensure_dir(DIR_USER_DATA)
Beispiel #23
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.master_key = MasterKey()
     self.settings = Settings()
     self.file_name = f'{DIR_USER_DATA}{self.settings.software_operation}_contacts'
     self.contact_list = ContactList(self.master_key, self.settings)
     self.full_contact_list = [
         'Alice', 'Bob', 'Charlie', 'David', 'Eric', LOCAL_ID
     ]
     self.contact_list.contacts = list(
         map(create_contact, self.full_contact_list))
     self.real_contact_list = self.full_contact_list[:]
     self.real_contact_list.remove(LOCAL_ID)
Beispiel #24
0
    def setUp(self):
        self.cwd = os.getcwd()
        self.unittest_dir = cd_unittest()

        # Create test directory structure for the completer.
        os.mkdir('outer')
        os.chdir('outer/')
        with open('file', 'w+') as f:
            f.write('text')
        os.mkdir('middle')
        os.chdir('middle/')
        os.mkdir('inner')
        os.chdir('..')
        os.chdir('..')
Beispiel #25
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.ts = datetime.now()
     self.packet = b''
     self.file_keys = dict()
     self.file_buf = dict()
     self.contact_list = ContactList(nicks=['Alice'])
     self.window_list = WindowList()
     self.file_key = SYMMETRIC_KEY_LENGTH * b'a'
     self.settings = Settings()
     self.compressed = zlib.compress(str_to_bytes("test_file.txt") +
                                     b'file_data',
                                     level=COMPRESSION_LEVEL)
     self.args = self.file_keys, self.file_buf, self.contact_list, self.window_list, self.settings
Beispiel #26
0
    def setUp(self):
        self.unittest_dir = cd_unittest()
        self.ts           = datetime.now()
        self.settings     = Settings()
        self.master_key   = MasterKey()
        self.group_list   = GroupList()
        self.exit_queue   = Queue()
        self.gateway      = Gateway()
        self.window_list  = WindowList(nicks=[LOCAL_ID])
        self.contact_list = ContactList(nicks=[LOCAL_ID])
        self.packet_list  = PacketList(self.settings, self.contact_list)
        self.key_list     = KeyList(nicks=[LOCAL_ID])
        self.key_set      = self.key_list.get_keyset(LOCAL_PUBKEY)

        self.args = (self.window_list, self.packet_list, self.contact_list, self.key_list, self.group_list,
                     self.settings, self.master_key, self.gateway, self.exit_queue)
Beispiel #27
0
    def setUp(self):
        self.unittest_dir      = cd_unittest()
        self.cmd_data          = int_to_bytes(1) + nick_to_pub_key("Bob")
        self.ts                = datetime.now()
        self.window_list       = WindowList(nicks=['Alice', 'Bob'])
        self.window            = self.window_list.get_window(nick_to_pub_key("Bob"))
        self.window.type_print = 'contact'
        self.window.name       = 'Bob'
        self.window.type       = WIN_TYPE_CONTACT
        self.contact_list      = ContactList(nicks=['Alice', 'Bob'])
        self.group_list        = GroupList()
        self.settings          = Settings()
        self.master_key        = MasterKey()
        self.args              = (self.ts, self.window_list, self.contact_list,
                                  self.group_list, self.settings, self.master_key)

        time_float = struct.unpack('<L', bytes.fromhex('08ceae02'))[0]
        self.time  = datetime.fromtimestamp(time_float).strftime("%H:%M:%S.%f")[:-4]
Beispiel #28
0
    def setUp(self):
        self.unittest_dir  = cd_unittest()
        self.master_key    = MasterKey()
        self.settings      = Settings()
        self.time          = STATIC_TIMESTAMP
        self.contact_list  = ContactList(self.master_key, self.settings)
        self.group_list    = GroupList(groups=['test_group'])
        self.file_name     = f'{DIR_USER_DATA}{self.settings.software_operation}_logs'
        self.tmp_file_name = self.file_name + "_temp"
        self.args          = self.contact_list, self.group_list, self.settings, self.master_key

        self.msg = ("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean condimentum consectetur purus quis"
                    " dapibus. Fusce venenatis lacus ut rhoncus faucibus. Cras sollicitudin commodo sapien, sed bibendu"
                    "m velit maximus in. Aliquam ac metus risus. Sed cursus ornare luctus. Integer aliquet lectus id ma"
                    "ssa blandit imperdiet. Ut sed massa eget quam facilisis rutrum. Mauris eget luctus nisl. Sed ut el"
                    "it iaculis, faucibus lacus eget, sodales magna. Nunc sed commodo arcu. In hac habitasse platea dic"
                    "tumst. Integer luctus aliquam justo, at vestibulum dolor iaculis ac. Etiam laoreet est eget odio r"
                    "utrum, vel malesuada lorem rhoncus. Cras finibus in neque eu euismod. Nulla facilisi. Nunc nec ali"
                    "quam quam, quis ullamcorper leo. Nunc egestas lectus eget est porttitor, in iaculis felis sceleris"
                    "que. In sem elit, fringilla id viverra commodo, sagittis varius purus. Pellentesque rutrum loborti"
                    "s neque a facilisis. Mauris id tortor placerat, aliquam dolor ac, venenatis arcu.")
Beispiel #29
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
Beispiel #30
0
 def setUp(self):
     self.unittest_dir = cd_unittest()
     self.queues       = gen_queue_dict()