Example #1
0
def get_cookie_jar():
    firefox_path = firefox_finder.get_profile_dir()
    if None != firefox_path:
        return firefox_cookies.get_cookie_jar()

    chrome_path = chrome_cookies.get_cookie_file()
    if None != chrome_path:
        return chrome_cookies.get_cookie_jar()

    return None
Example #2
0
def get_cookie_jar():
    profile_dir = firefox_finder.get_profile_dir()
    if os.path.join(profile_dir, 'cookies.sqlite'):
        cookie_jar = os.path.join(profile_dir, 'cookies.sqlite')
    elif os.path.join(profile_dir, 'cookies.txt'):
        cookie_jar = os.path.join(profile_dir, 'cookies.txt')

    if cookie_jar.endswith('.sqlite'):
        return sqlite2cookie(cookie_jar)
    else:
        return cookielib.MozillaCookieJar(cookie_jar)
Example #3
0
def get_cookie_jar_interactive():
    profile_dir = firefox_finder.get_profile_dir()
    if os.path.join(profile_dir, 'cookies.sqlite'):
        cookie_jar = os.path.join(profile_dir, 'cookies.sqlite')
    elif os.path.join(profile_dir, 'cookies.txt'):
        cookie_jar = os.path.join(profile_dir, 'cookies.txt')

    path = raw_input('Path to cookie jar file [%s]: ' % cookie_jar)
    if path.strip():
        # Some input specified, set it
        cookie_jar = os.path.realpath(os.path.expanduser(path.strip()))

    if cookie_jar.endswith('.sqlite'):
        return sqlite2cookie(cookie_jar)
    else:
        return cookielib.MozillaCookieJar(cookie_jar)