Hi guys, I've been trying to create a sqlite3 database to save the data fetched by wks-keys, I managed to create the table but I can't get it to save the data fetched by wks, can anyone help me? please...
import base64, requests, sys, xmltodict
import headers
from pywidevine.L3.cdm import cdm, deviceconfig
from base64 import b64encode
from pywidevine.L3.getPSSH import get_pssh
from pywidevine.L3.decrypt.wvdecryptcustom import WvDecrypt
import sqlite3
pssh = input('\nPSSH: ')
lic_url = input('License URL: ')
def WV_Function(pssh, lic_url, cert_b64=None):
wvdecrypt = WvDecrypt(init_data_b64=pssh, cert_data_b64=cert_b64, device=deviceconfig.device_android_generic)
widevine_license = requests.post(url=lic_url, data=wvdecrypt.get_challenge(), headers=headers.headers)
license_b64 = b64encode(widevine_license.content)
wvdecrypt.update_license(license_b64)
Correct, keyswvdecrypt = wvdecrypt.start_process()
if Correct:
return Correct, keyswvdecrypt
correct, keys = WV_Function(pssh, lic_url)
def insert_table(pssh, keys, lic_url):
conn = sqlite3.connect('Widevine.db')
cursor = conn.cursor()
cursor.execute(
f"INSERT INTO TBL_KEYS(PSSH,KEYS,LICENSE_URL) VALUES ('{pssh}','{keys}','{lic_url}')")
conn.commit()
conn.close()
print()
for key in keys:
print('--key ' + key)
+ Reply to Thread
Results 1 to 5 of 5
-
-
you havent actually said what the issue is other than "i cant get it to work".....
next time try to add some more detail, like what youre expecting to happen and any errors you get when running the script.
im assuming that when you run the script, you get the keys printed out but then nothing appears in the db.
is that correct?
if so, you havent called the insert_table function in your python script.
you need to add this under the "for key in keys:" line
Code:insert_table(pssh, key, lic_url)
[Attachment 69204 - Click to enlarge] -
-
can you upload a screenshot of your full script?
the one you pasted above has no indentation
Update: script is fixed, it had an extra parameter in the insert_table function.Last edited by ElCap; 14th Feb 2023 at 23:27.
-
BTW, instead of splicing strings into SQL queries like this
Code:f"INSERT INTO TBL_KEYS(PSSH,KEYS,LICENSE_URL) VALUES ('{pssh}','{keys}','{lic_url}')")
Code:cur.execute("insert into test(d, ts) values (?, ?)", (today, now))
Similar Threads
-
Looking for FREE DVD barcode lookup database
By 1hunglo in forum Newbie / General discussionsReplies: 0Last Post: 28th Jan 2023, 21:55 -
Lost Deluge torrent database
By Truenorth179 in forum Newbie / General discussionsReplies: 0Last Post: 15th Jun 2022, 18:37 -
EAC Database
By kirkmc in forum AudioReplies: 0Last Post: 25th May 2021, 00:25 -
movie database on HD to watch on tv
By tonedeaf2 in forum Newbie / General discussionsReplies: 7Last Post: 11th Apr 2021, 09:25 -
How can I get a great software tool added to the VH database search?
By crjackson in forum MacReplies: 2Last Post: 14th Sep 2019, 17:19