def test_get_tbb_profile_path(self):
        ver_str = "2.3.25-16"
        tbb_prof_path_v2_3_25_16 = cm.get_tbb_profile_path(ver_str)
        self.assert_(cm.TBB_V2_PROFILE_PATH in tbb_prof_path_v2_3_25_16)
        self.assert_(cm.get_tbb_dirname(ver_str) in tbb_prof_path_v2_3_25_16)
        self.assert_(cm.TBB_BASE_DIR in tbb_prof_path_v2_3_25_16)

        tbb_prof_path_v3_5 = cm.get_tbb_profile_path(cm.TBB_V_3_5)
        self.assert_(cm.TBB_V3_PROFILE_PATH in tbb_prof_path_v3_5)
        self.assert_(cm.get_tbb_dirname(cm.TBB_V_3_5) in tbb_prof_path_v3_5)
        self.assert_(cm.TBB_BASE_DIR in tbb_prof_path_v3_5)

        tbb_prof_path_v4_0_8 = cm.get_tbb_profile_path(cm.TBB_V_4_0_8)
        self.assert_(cm.TBB_V3_PROFILE_PATH in tbb_prof_path_v4_0_8)
        self.assert_(
            cm.get_tbb_dirname(cm.TBB_V_4_0_8) in tbb_prof_path_v4_0_8)
        self.assert_(cm.TBB_BASE_DIR in tbb_prof_path_v4_0_8)
Exemple #2
0
 def test_tb_orig_profile_not_modified(self):
     """Visiting a site should not modify the original profile contents."""
     tbb_profile_dir = cm.get_tbb_profile_path(cm.TBB_DEFAULT_VERSION)
     profile_hash_before = get_hash_of_directory(tbb_profile_dir)
     tb_driver = TorBrowserDriver()
     tb_driver.get("http://check.torproject.org")
     tb_driver.quit()
     profile_hash_after = get_hash_of_directory(tbb_profile_dir)
     assert (profile_hash_after == profile_hash_before)
    def test_get_tbb_profile_path(self):
        ver_str = "2.3.25-16"
        tbb_prof_path_v2_3_25_16 = cm.get_tbb_profile_path(ver_str)
        self.assert_(cm.TBB_V2_PROFILE_PATH in tbb_prof_path_v2_3_25_16)
        self.assert_(cm.get_tbb_dirname(ver_str) in
                     tbb_prof_path_v2_3_25_16)
        self.assert_(cm.TBB_BASE_DIR in tbb_prof_path_v2_3_25_16)

        tbb_prof_path_v3_5 = cm.get_tbb_profile_path(cm.TBB_V_3_5)
        self.assert_(cm.TBB_V3_PROFILE_PATH in tbb_prof_path_v3_5)
        self.assert_(cm.get_tbb_dirname(cm.TBB_V_3_5) in
                     tbb_prof_path_v3_5)
        self.assert_(cm.TBB_BASE_DIR in tbb_prof_path_v3_5)

        tbb_prof_path_v4_0_8 = cm.get_tbb_profile_path(cm.TBB_V_4_0_8)
        self.assert_(cm.TBB_V3_PROFILE_PATH in tbb_prof_path_v4_0_8)
        self.assert_(cm.get_tbb_dirname(cm.TBB_V_4_0_8) in
                     tbb_prof_path_v4_0_8)
        self.assert_(cm.TBB_BASE_DIR in tbb_prof_path_v4_0_8)
 def init_tbb_profile(self, version):
     profile_directory = cm.get_tbb_profile_path(version)
     self.prof_dir_path = clone_dir_with_timestap(profile_directory)
     if self.capture_screen and self.page_url:
         self.add_canvas_permission()
     try:
         tbb_profile = webdriver.FirefoxProfile(self.prof_dir_path)
     except Exception:
         wl_log.error("Error creating the TB profile", exc_info=True)
     else:
         return tbb_profile
Exemple #5
0
    def __init__(self, torrc_dict, tbb_version, tor_log='/dev/null'):
        self.torrc_dict = torrc_dict
        self.controller = None
        self.tbb_version = tbb_version
        self.tmp_tor_data_dir = None
        self.tor_process = None
        self.log_file = tor_log

        if tbb_version:
            tbb_path = cm.get_tbb_path(self.tbb_version)
            print(tbb_path)
            tor_binary_path = cm.get_tor_bin_path(self.tbb_version)
            tor_profile_path = cm.get_tbb_profile_path(self.tbb_version)
            tor_data_path = cm.get_tor_data_path(self.tbb_version)

        self.tor_binary_path = tor_binary_path
        self.tor_data_path = tor_data_path
        self.tor_profile_path = tor_profile_path
        self.control_port = int(self.torrc_dict['controlport'])
        self.socks_port = int(self.torrc_dict['socksport'])
        self.export_lib_path()
 def test_tbb_profile_path(self):
     tbb_profile_path = cm.get_tbb_profile_path(version=get_recommended_tbb_version())
     self.assertTrue(os.path.isdir(tbb_profile_path),
                     'Cannot find Tor Browser profile dir %s'
                     % tbb_profile_path)
Exemple #7
0
 def test_tbb_profile_path(self):
     tbb_profile_path = cm.get_tbb_profile_path(cm.TBB_DEFAULT_VERSION)
     self.assertTrue(os.path.isdir(tbb_profile_path),
                     'Cannot find Tor Browser profile dir %s'
                     % tbb_profile_path)