mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2026-03-20 04:58:56 +00:00
Compare commits
1 Commits
57ad7bf4d0
...
482dbbc232
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
482dbbc232 |
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
run: python3 make_release.py
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: plugin
|
||||
path: |
|
||||
|
||||
@@ -255,7 +255,7 @@ class EreaderProcessor(object):
|
||||
encrypted_key = r[172:172+8]
|
||||
encrypted_key_sha = r[56:56+20]
|
||||
self.content_key = des.decrypt(encrypted_key)
|
||||
if hashlib.sha1(self.content_key).digest() != encrypted_key_sha:
|
||||
if sha1(self.content_key).digest() != encrypted_key_sha:
|
||||
raise ValueError('Incorrect Name and/or Credit Card')
|
||||
|
||||
def getNumImages(self):
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""ion.py: Decrypt Kindle KFX files.
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
Revision history:
|
||||
Pascal implementation by lulzkabulz.
|
||||
BinaryIon.pas + DrmIon.pas + IonSymbols.pas
|
||||
1.0 - Python translation by apprenticenaomi.
|
||||
1.1 - DeDRM integration by anon.
|
||||
1.2 - Added pylzma import fallback
|
||||
1.3 - Fixed lzma support for calibre 4.6+
|
||||
2.0 - VoucherEnvelope v2/v3 support by apprenticesakuya.
|
||||
3.0 - Added Python 3 compatibility for calibre 5.0
|
||||
# ion.py
|
||||
# Copyright © 2013-2020 Apprentice Harper et al.
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = '3.0'
|
||||
|
||||
# Revision history:
|
||||
# Pascal implementation by lulzkabulz.
|
||||
# BinaryIon.pas + DrmIon.pas + IonSymbols.pas
|
||||
# 1.0 - Python translation by apprenticenaomi.
|
||||
# 1.1 - DeDRM integration by anon.
|
||||
# 1.2 - Added pylzma import fallback
|
||||
# 1.3 - Fixed lzma support for calibre 4.6+
|
||||
# 2.0 - VoucherEnvelope v2/v3 support by apprenticesakuya.
|
||||
# 3.0 - Added Python 3 compatibility for calibre 5.0
|
||||
|
||||
Copyright © 2013-2020 Apprentice Harper et al.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
Decrypt Kindle KFX files.
|
||||
"""
|
||||
|
||||
import collections
|
||||
import hashlib
|
||||
@@ -24,9 +30,6 @@ import struct
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__version__ = '3.0'
|
||||
|
||||
#@@CALIBRE_COMPAT_CODE@@
|
||||
|
||||
|
||||
@@ -1346,7 +1349,7 @@ class DrmIonVoucher(object):
|
||||
process_V4648(shared), process_V5683(shared)]
|
||||
|
||||
decrypted=False
|
||||
lastexception: Exception | None = None
|
||||
ex=None
|
||||
for sharedsecret in sharedsecrets:
|
||||
key = hmac.new(sharedsecret, b"PIDv3", digestmod=hashlib.sha256).digest()
|
||||
aes = AES.new(key[:32], AES.MODE_CBC, self.cipheriv[:16])
|
||||
@@ -1363,10 +1366,9 @@ class DrmIonVoucher(object):
|
||||
print("Decryption succeeded")
|
||||
break
|
||||
except Exception as ex:
|
||||
lastexception = ex
|
||||
print("Decryption failed, trying next fallback ")
|
||||
if not decrypted:
|
||||
raise lastexception
|
||||
raise ex
|
||||
|
||||
self.drmkey.stepin()
|
||||
while self.drmkey.hasnext():
|
||||
|
||||
@@ -374,11 +374,7 @@ class InterfacePluginAction(InterfaceAction):
|
||||
result['success'] = False
|
||||
result['fileobj'] = None
|
||||
|
||||
try:
|
||||
zin = zipfile.ZipFile(book.filename, 'r')
|
||||
except FileNotFoundError:
|
||||
print (_('{0} - File "{1}" not found. Make sure the eBook has been properly downloaded in the Kobo app.').format(PLUGIN_NAME, book.filename))
|
||||
return result
|
||||
zin = zipfile.ZipFile(book.filename, 'r')
|
||||
#print ('Kobo library filename: {0}'.format(book.filename))
|
||||
for userkey in self.userkeys:
|
||||
print (_('Trying key: '), codecs.encode(userkey, 'hex'))
|
||||
|
||||
@@ -449,15 +449,9 @@ class KoboLibrary(object):
|
||||
for m in matches:
|
||||
# print "m:{0}".format(m[0])
|
||||
macaddrs.append(m[0].upper())
|
||||
elif sys.platform.startswith('linux'):
|
||||
for interface in os.listdir('/sys/class/net'):
|
||||
with open('/sys/class/net/' + interface + '/address', 'r') as f:
|
||||
mac = f.read().strip().upper()
|
||||
# some interfaces, like Tailscale's VPN interface, do not have a MAC address
|
||||
if mac != '':
|
||||
macaddrs.append(mac)
|
||||
else:
|
||||
# final fallback
|
||||
# probably linux
|
||||
|
||||
# let's try ip
|
||||
c = re.compile('\s(' + '[0-9a-f]{2}:' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
|
||||
for line in os.popen('ip -br link'):
|
||||
|
||||
Reference in New Issue
Block a user