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):
|
||||||
homePath = os.path.expanduser('~')
|
|
||||||
cookiePath = homePath + "/.mozilla/firefox/" + findDefaultProfile(homePath + "/.mozilla/firefox/") + "/cookies.sqlite"
|
|
||||||
tmpPath = "/tmp/cookies.sqlite"
|
|
||||||
DBFILE = "../db/sqlite3.db"
|
DBFILE = "../db/sqlite3.db"
|
||||||
winFirefoxPath = f"""C:\\Program Files\\Mozilla Firefox\\firefox.exe"""
|
if os.name == 'posix':
|
||||||
wintTmpPath = tempfile.gettempdir()
|
homePath = os.path.expanduser('~')
|
||||||
#workaround for loked database
|
cookiePath = homePath + "/.mozilla/firefox/" + findDefaultProfile(homePath + "/.mozilla/firefox/") + "/cookies.sqlite"
|
||||||
|
tmpPath = "/tmp/cookies.sqlite"
|
||||||
|
if os.name == 'nt':
|
||||||
|
appdata = os.getenv('APPDATA')
|
||||||
|
winCookiePath = appdata + "\\Mozilla\\Firefox\\Profiles\\" + findDefaultProfile(appdata + "\\Mozilla\\Firefox\\Profiles\\") + "cookies.sqlite"
|
||||||
|
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