modify windows paths, untested!
This commit is contained in:
parent
536b4d23f8
commit
c35f43ce8a
@ -8,6 +8,7 @@ import sqlite3
|
|||||||
import shutil
|
import shutil
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import manipulateString as ms
|
import manipulateString as ms
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
def log(*s):
|
def log(*s):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
@ -29,13 +30,17 @@ def findDefaultProfile(path):
|
|||||||
return target
|
return target
|
||||||
|
|
||||||
def getCookiesFromBrowser(url):
|
def getCookiesFromBrowser(url):
|
||||||
|
DBFILE = "../db/sqlite3.db"
|
||||||
|
if os.name == 'posix':
|
||||||
homePath = os.path.expanduser('~')
|
homePath = os.path.expanduser('~')
|
||||||
cookiePath = homePath + "/.mozilla/firefox/" + findDefaultProfile(homePath + "/.mozilla/firefox/") + "/cookies.sqlite"
|
cookiePath = homePath + "/.mozilla/firefox/" + findDefaultProfile(homePath + "/.mozilla/firefox/") + "/cookies.sqlite"
|
||||||
tmpPath = "/tmp/cookies.sqlite"
|
tmpPath = "/tmp/cookies.sqlite"
|
||||||
DBFILE = "../db/sqlite3.db"
|
if os.name == 'nt':
|
||||||
winFirefoxPath = f"""C:\\Program Files\\Mozilla Firefox\\firefox.exe"""
|
appdata = os.getenv('APPDATA')
|
||||||
wintTmpPath = tempfile.gettempdir()
|
winCookiePath = appdata + "\\Mozilla\\Firefox\\Profiles\\" + findDefaultProfile(appdata + "\\Mozilla\\Firefox\\Profiles\\") + "cookies.sqlite"
|
||||||
#workaround for loked database
|
winFirefoxPath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe"
|
||||||
|
tmpPath = tempfile.gettempdir() + "\\cookies.sqlite"
|
||||||
|
|
||||||
tries=0
|
tries=0
|
||||||
cookie = ''
|
cookie = ''
|
||||||
rows = [0]
|
rows = [0]
|
||||||
@ -44,10 +49,7 @@ def getCookiesFromBrowser(url):
|
|||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
shutil.copyfile(cookiePath,tmpPath)
|
shutil.copyfile(cookiePath,tmpPath)
|
||||||
elif os.name == 'nt':
|
elif os.name == 'nt':
|
||||||
appdata = os.getenv('APPDATA')
|
shutil.copyfile(winCookiePath,tmpPath)#workaround for loked database
|
||||||
winCookiePath = appdata + "\\Mozilla\\Firefox\\Profiles\\" + profile + "cookies.sqlite"
|
|
||||||
shutil.copyfile(winCookiePath,wintTmpPath)
|
|
||||||
|
|
||||||
with sqlite3.connect(tmpPath) as connection:
|
with sqlite3.connect(tmpPath) as connection:
|
||||||
cmd_read_cookies = f"""SELECT name,value FROM moz_cookies WHERE host like ?;"""
|
cmd_read_cookies = f"""SELECT name,value FROM moz_cookies WHERE host like ?;"""
|
||||||
print(cmd_read_cookies)
|
print(cmd_read_cookies)
|
||||||
|
Loading…
Reference in New Issue
Block a user