def test_queue_file_normal(self): # Setup packet_list = split_to_assembly_packets(os.urandom(200), FILE) # Test self.assertIsNone( queue_packets(packet_list, FILE, self.settings, self.queue, self.window, log_as_ph=True)) time.sleep(0.1) self.assertEqual(self.queue.qsize(), 1) packet, settings, rx_account, tx_account, log_setting, log_as_ph, window_uid = self.queue.get( ) self.assertIsInstance(packet, bytes) self.assertIsInstance(settings, Settings) self.assertEqual(rx_account, '*****@*****.**') self.assertEqual(tx_account, '*****@*****.**') self.assertEqual(window_uid, '*****@*****.**') self.assertTrue(log_setting) self.assertTrue(log_as_ph)
def test_queue_command_normal(self): # Setup packet_list = split_to_assembly_packets(os.urandom(200), COMMAND) # Test self.assertIsNone( queue_packets(packet_list, COMMAND, self.settings, self.queue, self.window)) time.sleep(0.1) self.assertEqual(self.queue.qsize(), 1) packet, settings = self.queue.get() self.assertIsInstance(packet, bytes) self.assertIsInstance(settings, Settings)
def test_queue_command_traffic_masking(self): # Setup packet_list = split_to_assembly_packets(os.urandom(200), COMMAND) self.settings.session_traffic_masking = True # Test self.assertIsNone( queue_packets(packet_list, COMMAND, self.settings, self.queue, self.window)) time.sleep(0.1) self.assertEqual(self.queue.qsize(), 1) data, log_messages = self.queue.get() self.assertIsInstance(data, bytes) self.assertTrue(log_messages)
def test_queue_file_traffic_masking(self): # Setup packet_list = split_to_assembly_packets(os.urandom(200), FILE) self.settings.session_traffic_masking = True # Test self.assertIsNone( queue_packets(packet_list, FILE, self.settings, self.queue, self.window)) time.sleep(0.1) self.assertEqual(self.queue.qsize(), 1) packet, log_messages, log_as_ph = self.queue.get() self.assertIsInstance(packet, bytes) self.assertTrue(log_messages) self.assertFalse(log_as_ph)