updating all of my config, specifically doing this to fix the nvim configurations

This commit is contained in:
klein panic
2025-01-29 15:26:21 -05:00
parent c15409e848
commit 47a02e4479
949 changed files with 127542 additions and 6069 deletions

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,3 @@
json:{
"output_profile": "generic_eink"
}

View File

View File

View File

16
calibre/customize.py.json Normal file
View File

@@ -0,0 +1,16 @@
{
"disabled_plugins": {
"__class__": "set",
"__value__": []
},
"enabled_plugins": {
"__class__": "set",
"__value__": []
},
"filetype_mapping": {},
"plugin_customization": {},
"plugins": {
"DeDRM": "/home/klein/.config/calibre/plugins/DeDRM.zip",
"Obok DeDRM": "/home/klein/.config/calibre/plugins/Obok DeDRM.zip"
}
}

View File

@@ -0,0 +1,17 @@
{
"add a plugin dialog": "/home/klein/Downloads/DeDRM",
"add books dialog dir": "/home/klein/Downloads",
"add books dialog dir-last-used-filter-spec-all-files": false,
"sort_history": [
[
"timestamp",
false
],
[
"timestamp",
false
]
],
"welcome_wizard_device": "default",
"welcome_wizard_was_run": true
}

File diff suppressed because it is too large Load Diff

51
calibre/global.py.json Normal file
View File

@@ -0,0 +1,51 @@
{
"add_formats_to_existing": false,
"case_sensitive": false,
"check_for_dupes_on_ctl": false,
"database_path": "/home/klein/library1.db",
"filename_pattern": "(?P<title>.+) - (?P<author>[^_]+)",
"input_format_order": [
"EPUB",
"AZW3",
"MOBI",
"LIT",
"PRC",
"FB2",
"HTML",
"HTM",
"XHTM",
"SHTML",
"XHTML",
"ZIP",
"DOCX",
"ODT",
"RTF",
"PDF",
"TXT"
],
"installation_uuid": "1fd2d2cc-8de5-4969-867e-780b64502661",
"isbndb_com_key": "",
"language": "en",
"library_path": "/home/klein/Calibre Library",
"limit_search_columns": false,
"limit_search_columns_to": [
"title",
"authors",
"tags",
"series",
"publisher"
],
"manage_device_metadata": "manual",
"mark_new_books": false,
"migrated": false,
"network_timeout": 5,
"new_book_tags": [],
"numeric_collation": false,
"output_format": "epub",
"read_file_metadata": true,
"saved_searches": {},
"swap_author_names": false,
"use_primary_find_in_search": true,
"user_categories": {},
"worker_process_priority": "normal"
}

566
calibre/gui.json Normal file
View File

@@ -0,0 +1,566 @@
{
"action-layout-context-menu": [
"Edit Metadata",
"Send To Device",
"Save To Disk",
"Connect Share",
"Copy To Library",
null,
"Convert Books",
"View",
"Open Folder",
"Show Book Details",
"Similar Books",
"Tweak ePub",
null,
"Remove Books",
"Obok DeDRM"
],
"action-layout-context-menu-cover-browser": [
"Edit Metadata",
"Send To Device",
"Save To Disk",
"Connect Share",
"Copy To Library",
null,
"Convert Books",
"View",
"Open Folder",
"Show Book Details",
"Similar Books",
"Tweak ePub",
null,
"Remove Books",
null,
"Autoscroll Books",
"Obok DeDRM"
],
"action-layout-context-menu-device": [
"View",
"Save To Disk",
null,
"Remove Books",
null,
"Add To Library",
"Edit Collections",
"Match Books",
"Show Matched Book In Library",
"Obok DeDRM"
],
"action-layout-context-menu-split": [
"Edit Metadata",
"Send To Device",
"Save To Disk",
"Connect Share",
"Copy To Library",
null,
"Convert Books",
"View",
"Open Folder",
"Show Book Details",
"Similar Books",
"Tweak ePub",
null,
"Remove Books",
"Obok DeDRM"
],
"action-layout-menubar": [
"Obok DeDRM"
],
"action-layout-menubar-device": [
"Obok DeDRM"
],
"action-layout-searchbar": [
"Saved searches",
"Obok DeDRM"
],
"action-layout-toolbar": [
"Add Books",
"Edit Metadata",
null,
"Convert Books",
"View",
null,
"Store",
"Donate",
"Fetch News",
"Help",
null,
"Remove Books",
"Choose Library",
"Save To Disk",
"Connect Share",
"Tweak ePub",
"Preferences",
"Obok DeDRM"
],
"action-layout-toolbar-child": [
"Obok DeDRM"
],
"action-layout-toolbar-device": [
"Add Books",
"Edit Metadata",
null,
"Convert Books",
"View",
"Send To Device",
null,
null,
"Location Manager",
null,
null,
"Fetch News",
"Save To Disk",
"Store",
"Connect Share",
null,
"Remove Books",
null,
"Help",
"Preferences",
"Obok DeDRM"
],
"basic_metadata_widget_splitter_state": {
"__class__": "bytearray",
"__value__": "AAAA/wAAAAEAAAADAAAA9QAAAWgAAAEKAf////8BAAAAAQA="
},
"book_details_splitter_horizontal_state": [
true,
200
],
"book_list_pin_splitter_state": {
"__class__": "bytearray",
"__value__": "AAAA/wAAAAEAAAACAAABAAAAAEYA/////wEAAAABAA=="
},
"cover_browser_splitter_vertical_state": [
false,
300
],
"custom_colors_for_color_dialog": [
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
]
],
"geometry-of-calibre_main_window_geometry": {
"frame_geometry": {
"height": 1171,
"width": 1920,
"x": -2,
"y": 27
},
"full_screened": false,
"geometry": {
"height": 1167,
"width": 1916,
"x": 0,
"y": 29
},
"maximized": false,
"normal_geometry": {
"height": 1167,
"width": 1916,
"x": 0,
"y": 29
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAD////+AAAAGwAAB30AAAStAAAAAAAAAB0AAAd7AAAEqwAAAAAAAAAAB4AAAAAAAAAAHQAAB3sAAASr"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
}
}
},
"geometry-of-convert_single_dialog_geom": {
"frame_geometry": {
"height": 1104,
"width": 1854,
"x": 33,
"y": 48
},
"full_screened": false,
"geometry": {
"height": 1100,
"width": 1850,
"x": 35,
"y": 50
},
"maximized": false,
"normal_geometry": {
"height": 1100,
"width": 1850,
"x": 35,
"y": 50
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAAAAAAhAAAAMAAAB14AAAR/AAAAIwAAADIAAAdcAAAEfQAAAAAAAAAAB4AAAAAjAAAAMgAAB1wAAAR9"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
}
}
},
"geometry-of-metasingle_window_geometry3": {
"frame_geometry": {
"height": 1154,
"width": 1854,
"x": 33,
"y": 23
},
"full_screened": false,
"geometry": {
"height": 1150,
"width": 1850,
"x": 35,
"y": 25
},
"maximized": false,
"normal_geometry": {
"height": 1150,
"width": 1850,
"x": 35,
"y": 25
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAAAAAAhAAAAFwAAB14AAASYAAAAIwAAABkAAAdcAAAElgAAAAAAAAAAB4AAAAAjAAAAGQAAB1wAAASW"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
}
}
},
"geometry-of-plugin config dialog:File type:DeDRM": {
"frame_geometry": {
"height": 488,
"width": 270,
"x": 825,
"y": 356
},
"full_screened": false,
"geometry": {
"height": 484,
"width": 266,
"x": 827,
"y": 358
},
"maximized": false,
"normal_geometry": {
"height": 484,
"width": 266,
"x": 827,
"y": 358
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAAAAAM5AAABZAAABEYAAANLAAADOwAAAWYAAAREAAADSQAAAAAAAAAAB4AAAAM7AAABZgAABEQAAANJ"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
}
}
},
"geometry-of-plugin config dialog:User interface action:Obok DeDRM": {
"frame_geometry": {
"height": 180,
"width": 481,
"x": 719,
"y": 510
},
"full_screened": false,
"geometry": {
"height": 176,
"width": 477,
"x": 721,
"y": 512
},
"maximized": false,
"normal_geometry": {
"height": 176,
"width": 477,
"x": 721,
"y": 512
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAAAAALPAAAB/gAABK8AAAKxAAAC0QAAAgAAAAStAAACrwAAAAAAAAAAB4AAAALRAAACAAAABK0AAAKv"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
}
}
},
"geometry-of-preferences dialog geometry": {
"frame_geometry": {
"height": 724,
"width": 934,
"x": 646,
"y": 232
},
"full_screened": false,
"geometry": {
"height": 720,
"width": 930,
"x": 648,
"y": 234
},
"maximized": false,
"normal_geometry": {
"height": 720,
"width": 930,
"x": 648,
"y": 234
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAAAAAKGAAAA6AAABisAAAO7AAACiAAAAOoAAAYpAAADuQAAAAAAAAAAB4AAAAKIAAAA6gAABikAAAO5"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 1920,
"x": 0,
"y": 0
}
}
},
"grid view visible": false,
"library_usage_stats": {
"/home/klein/Calibre Library": 8
},
"quick_start_guide_added": true,
"quickview visible": false,
"replace_scene_breaks_history": [
"",
"<hr />",
" ",
"• • •",
"♦ ♦ ♦",
"† †",
"‡ ‡ ‡",
"∞ ∞ ∞",
"¤ ¤ ¤"
],
"search bar visible": true,
"tag browser search box visible": false,
"tag_browser_splitter_horizontal_state": [
true,
200
]
}

78
calibre/gui.py.json Normal file
View File

@@ -0,0 +1,78 @@
{
"LRF_conversion_defaults": [],
"LRF_ebook_viewer_options": null,
"asked_library_thing_password": false,
"auto_download_cover": false,
"autolaunch_server": false,
"column_map": [
"title",
"ondevice",
"authors",
"size",
"timestamp",
"rating",
"publisher",
"tags",
"series",
"pubdate"
],
"confirm_delete": false,
"cover_flow_queue_length": 6,
"default_send_to_device_action": "DeviceAction:main::False:False",
"delete_news_from_library_on_upload": false,
"disable_animations": false,
"disable_tray_notification": false,
"enforce_cpu_limit": true,
"get_social_metadata": true,
"gui_layout": "wide",
"highlight_search_matches": false,
"internally_viewed_formats": [
"LRF",
"EPUB",
"LIT",
"MOBI",
"PRC",
"POBI",
"AZW",
"AZW3",
"HTML",
"FB2",
"FBZ",
"PDB",
"RB",
"SNB",
"HTMLZ",
"KEPUB"
],
"jobs_search_history": [],
"lrf_viewer_search_history": [],
"main_search_history": [],
"main_window_geometry": null,
"match_tags_type": "any",
"new_version_notification": true,
"oldest_news": 60,
"overwrite_author_title_metadata": true,
"plugin_search_history": [
"DeDRM"
],
"save_to_disk_template_history": [],
"scheduler_search_history": [],
"search_as_you_type": false,
"send_to_device_template_history": [],
"send_to_storage_card_by_default": false,
"separate_cover_flow": false,
"shortcuts_search_history": [],
"show_avg_rating": true,
"sort_tags_by": "name",
"systray_icon": false,
"tag_browser_hidden_categories": {
"__class__": "set",
"__value__": []
},
"tweaks_search_history": [],
"upload_news_to_device": true,
"use_roman_numerals_for_series_number": true,
"viewer_search_history": [],
"viewer_toc_search_history": [],
"worker_limit": 6
}

BIN
calibre/plugins/DeDRM.zip Normal file

Binary file not shown.

View File

@@ -0,0 +1,626 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# adobekey.pyw, version 7.4
# Copyright © 2009-2022 i♥cabbages, Apprentice Harper et al.
# Released under the terms of the GNU General Public Licence, version 3
# <http://www.gnu.org/licenses/>
# Revision history:
# 1 - Initial release, for Adobe Digital Editions 1.7
# 2 - Better algorithm for finding pLK; improved error handling
# 3 - Rename to INEPT
# 4 - Series of changes by joblack (and others?) --
# 4.1 - quick beta fix for ADE 1.7.2 (anon)
# 4.2 - added old 1.7.1 processing
# 4.3 - better key search
# 4.4 - Make it working on 64-bit Python
# 5 - Clean up and improve 4.x changes;
# Clean up and merge OS X support by unknown
# 5.1 - add support for using OpenSSL on Windows in place of PyCrypto
# 5.2 - added support for output of key to a particular file
# 5.3 - On Windows try PyCrypto first, OpenSSL next
# 5.4 - Modify interface to allow use of import
# 5.5 - Fix for potential problem with PyCrypto
# 5.6 - Revised to allow use in Plugins to eliminate need for duplicate code
# 5.7 - Unicode support added, renamed adobekey from ineptkey
# 5.8 - Added getkey interface for Windows DeDRM application
# 5.9 - moved unicode_argv call inside main for Windows DeDRM compatibility
# 6.0 - Work if TkInter is missing
# 7.0 - Python 3 for calibre 5
# 7.1 - Fix "failed to decrypt user key key" error (read username from registry)
# 7.2 - Fix decryption error on Python2 if there's unicode in the username
# 7.3 - Fix OpenSSL in Wine
# 7.4 - Remove OpenSSL support to only support PyCryptodome
"""
Retrieve Adobe ADEPT user key.
"""
__license__ = 'GPL v3'
__version__ = '7.4'
import sys, os, struct, getopt
from base64 import b64decode
# Wrap a stream so that output gets flushed immediately
# and also make sure that any unicode strings get
# encoded using "replace" before writing them.
class SafeUnbuffered:
def __init__(self, stream):
self.stream = stream
self.encoding = stream.encoding
if self.encoding == None:
self.encoding = "utf-8"
def write(self, data):
if isinstance(data,str) or isinstance(data,unicode):
# str for Python3, unicode for Python2
data = data.encode(self.encoding,"replace")
try:
buffer = getattr(self.stream, 'buffer', self.stream)
# self.stream.buffer for Python3, self.stream for Python2
buffer.write(data)
buffer.flush()
except:
# We can do nothing if a write fails
raise
def __getattr__(self, attr):
return getattr(self.stream, attr)
try:
from calibre.constants import iswindows, isosx
except:
iswindows = sys.platform.startswith('win')
isosx = sys.platform.startswith('darwin')
def unicode_argv():
if iswindows:
# Uses shell32.GetCommandLineArgvW to get sys.argv as a list of Unicode
# strings.
# Versions 2.x of Python don't support Unicode in sys.argv on
# Windows, with the underlying Windows API instead replacing multi-byte
# characters with '?'. So use shell32.GetCommandLineArgvW to get sys.argv
# as a list of Unicode strings and encode them as utf-8
from ctypes import POINTER, byref, cdll, c_int, windll
from ctypes.wintypes import LPCWSTR, LPWSTR
GetCommandLineW = cdll.kernel32.GetCommandLineW
GetCommandLineW.argtypes = []
GetCommandLineW.restype = LPCWSTR
CommandLineToArgvW = windll.shell32.CommandLineToArgvW
CommandLineToArgvW.argtypes = [LPCWSTR, POINTER(c_int)]
CommandLineToArgvW.restype = POINTER(LPWSTR)
cmd = GetCommandLineW()
argc = c_int(0)
argv = CommandLineToArgvW(cmd, byref(argc))
if argc.value > 0:
# Remove Python executable and commands if present
start = argc.value - len(sys.argv)
return [argv[i] for i in
range(start, argc.value)]
# if we don't have any arguments at all, just pass back script name
# this should never happen
return ["adobekey.py"]
else:
argvencoding = sys.stdin.encoding or "utf-8"
return [arg if (isinstance(arg, str) or isinstance(arg,unicode)) else str(arg, argvencoding) for arg in sys.argv]
class ADEPTError(Exception):
pass
if iswindows:
from ctypes import windll, c_char_p, c_wchar_p, c_uint, POINTER, byref, \
create_unicode_buffer, create_string_buffer, CFUNCTYPE, addressof, \
string_at, Structure, c_void_p, cast, c_size_t, memmove, CDLL, c_int, \
c_long, c_ulong
from ctypes.wintypes import LPVOID, DWORD, BOOL
try:
import winreg
except ImportError:
import _winreg as winreg
try:
from Cryptodome.Cipher import AES
except ImportError:
from Crypto.Cipher import AES
def unpad(data, padding=16):
if sys.version_info[0] == 2:
pad_len = ord(data[-1])
else:
pad_len = data[-1]
return data[:-pad_len]
DEVICE_KEY_PATH = r'Software\Adobe\Adept\Device'
PRIVATE_LICENCE_KEY_PATH = r'Software\Adobe\Adept\Activation'
MAX_PATH = 255
kernel32 = windll.kernel32
advapi32 = windll.advapi32
crypt32 = windll.crypt32
def GetSystemDirectory():
GetSystemDirectoryW = kernel32.GetSystemDirectoryW
GetSystemDirectoryW.argtypes = [c_wchar_p, c_uint]
GetSystemDirectoryW.restype = c_uint
def GetSystemDirectory():
buffer = create_unicode_buffer(MAX_PATH + 1)
GetSystemDirectoryW(buffer, len(buffer))
return buffer.value
return GetSystemDirectory
GetSystemDirectory = GetSystemDirectory()
def GetVolumeSerialNumber():
GetVolumeInformationW = kernel32.GetVolumeInformationW
GetVolumeInformationW.argtypes = [c_wchar_p, c_wchar_p, c_uint,
POINTER(c_uint), POINTER(c_uint),
POINTER(c_uint), c_wchar_p, c_uint]
GetVolumeInformationW.restype = c_uint
def GetVolumeSerialNumber(path):
vsn = c_uint(0)
GetVolumeInformationW(
path, None, 0, byref(vsn), None, None, None, 0)
return vsn.value
return GetVolumeSerialNumber
GetVolumeSerialNumber = GetVolumeSerialNumber()
def GetUserName():
GetUserNameW = advapi32.GetUserNameW
GetUserNameW.argtypes = [c_wchar_p, POINTER(c_uint)]
GetUserNameW.restype = c_uint
def GetUserName():
buffer = create_unicode_buffer(32)
size = c_uint(len(buffer))
while not GetUserNameW(buffer, byref(size)):
buffer = create_unicode_buffer(len(buffer) * 2)
size.value = len(buffer)
return buffer.value.encode('utf-16-le')[::2]
return GetUserName
GetUserName = GetUserName()
def GetUserName2():
try:
from winreg import OpenKey, QueryValueEx, HKEY_CURRENT_USER
except ImportError:
# We're on Python 2
try:
# The default _winreg on Python2 isn't unicode-safe.
# Check if we have winreg_unicode, a unicode-safe alternative.
# Without winreg_unicode, this will fail with Unicode chars in the username.
from adobekey_winreg_unicode import OpenKey, QueryValueEx, HKEY_CURRENT_USER
except:
from _winreg import OpenKey, QueryValueEx, HKEY_CURRENT_USER
try:
DEVICE_KEY_PATH = r'Software\Adobe\Adept\Device'
regkey = OpenKey(HKEY_CURRENT_USER, DEVICE_KEY_PATH)
userREG = QueryValueEx(regkey, 'username')[0].encode('utf-16-le')[::2]
return userREG
except:
return None
PAGE_EXECUTE_READWRITE = 0x40
MEM_COMMIT = 0x1000
MEM_RESERVE = 0x2000
def VirtualAlloc():
_VirtualAlloc = kernel32.VirtualAlloc
_VirtualAlloc.argtypes = [LPVOID, c_size_t, DWORD, DWORD]
_VirtualAlloc.restype = LPVOID
def VirtualAlloc(addr, size, alloctype=(MEM_COMMIT | MEM_RESERVE),
protect=PAGE_EXECUTE_READWRITE):
return _VirtualAlloc(addr, size, alloctype, protect)
return VirtualAlloc
VirtualAlloc = VirtualAlloc()
MEM_RELEASE = 0x8000
def VirtualFree():
_VirtualFree = kernel32.VirtualFree
_VirtualFree.argtypes = [LPVOID, c_size_t, DWORD]
_VirtualFree.restype = BOOL
def VirtualFree(addr, size=0, freetype=MEM_RELEASE):
return _VirtualFree(addr, size, freetype)
return VirtualFree
VirtualFree = VirtualFree()
class NativeFunction(object):
def __init__(self, restype, argtypes, insns):
self._buf = buf = VirtualAlloc(None, len(insns))
memmove(buf, insns, len(insns))
ftype = CFUNCTYPE(restype, *argtypes)
self._native = ftype(buf)
def __call__(self, *args):
return self._native(*args)
def __del__(self):
if self._buf is not None:
try:
VirtualFree(self._buf)
self._buf = None
except TypeError:
# Apparently this sometimes gets cleared on application exit
# Causes a useless exception in the log, so let's just catch and ignore that.
pass
if struct.calcsize("P") == 4:
CPUID0_INSNS = (
b"\x53" # push %ebx
b"\x31\xc0" # xor %eax,%eax
b"\x0f\xa2" # cpuid
b"\x8b\x44\x24\x08" # mov 0x8(%esp),%eax
b"\x89\x18" # mov %ebx,0x0(%eax)
b"\x89\x50\x04" # mov %edx,0x4(%eax)
b"\x89\x48\x08" # mov %ecx,0x8(%eax)
b"\x5b" # pop %ebx
b"\xc3" # ret
)
CPUID1_INSNS = (
b"\x53" # push %ebx
b"\x31\xc0" # xor %eax,%eax
b"\x40" # inc %eax
b"\x0f\xa2" # cpuid
b"\x5b" # pop %ebx
b"\xc3" # ret
)
else:
CPUID0_INSNS = (
b"\x49\x89\xd8" # mov %rbx,%r8
b"\x49\x89\xc9" # mov %rcx,%r9
b"\x48\x31\xc0" # xor %rax,%rax
b"\x0f\xa2" # cpuid
b"\x4c\x89\xc8" # mov %r9,%rax
b"\x89\x18" # mov %ebx,0x0(%rax)
b"\x89\x50\x04" # mov %edx,0x4(%rax)
b"\x89\x48\x08" # mov %ecx,0x8(%rax)
b"\x4c\x89\xc3" # mov %r8,%rbx
b"\xc3" # retq
)
CPUID1_INSNS = (
b"\x53" # push %rbx
b"\x48\x31\xc0" # xor %rax,%rax
b"\x48\xff\xc0" # inc %rax
b"\x0f\xa2" # cpuid
b"\x5b" # pop %rbx
b"\xc3" # retq
)
def cpuid0():
_cpuid0 = NativeFunction(None, [c_char_p], CPUID0_INSNS)
buf = create_string_buffer(12)
def cpuid0():
_cpuid0(buf)
return buf.raw
return cpuid0
cpuid0 = cpuid0()
cpuid1 = NativeFunction(c_uint, [], CPUID1_INSNS)
class DataBlob(Structure):
_fields_ = [('cbData', c_uint),
('pbData', c_void_p)]
DataBlob_p = POINTER(DataBlob)
def CryptUnprotectData():
_CryptUnprotectData = crypt32.CryptUnprotectData
_CryptUnprotectData.argtypes = [DataBlob_p, c_wchar_p, DataBlob_p,
c_void_p, c_void_p, c_uint, DataBlob_p]
_CryptUnprotectData.restype = c_uint
def CryptUnprotectData(indata, entropy):
indatab = create_string_buffer(indata)
indata = DataBlob(len(indata), cast(indatab, c_void_p))
entropyb = create_string_buffer(entropy)
entropy = DataBlob(len(entropy), cast(entropyb, c_void_p))
outdata = DataBlob()
if not _CryptUnprotectData(byref(indata), None, byref(entropy),
None, None, 0, byref(outdata)):
raise ADEPTError("Failed to decrypt user key key (sic)")
return string_at(outdata.pbData, outdata.cbData)
return CryptUnprotectData
CryptUnprotectData = CryptUnprotectData()
def adeptkeys():
root = GetSystemDirectory().split('\\')[0] + '\\'
serial = GetVolumeSerialNumber(root)
vendor = cpuid0()
signature = struct.pack('>I', cpuid1())[1:]
user = GetUserName2()
if user is None:
user = GetUserName()
entropy = struct.pack('>I12s3s13s', serial, vendor, signature, user)
cuser = winreg.HKEY_CURRENT_USER
try:
regkey = winreg.OpenKey(cuser, DEVICE_KEY_PATH)
device = winreg.QueryValueEx(regkey, 'key')[0]
except (WindowsError, FileNotFoundError):
raise ADEPTError("Adobe Digital Editions not activated")
keykey = CryptUnprotectData(device, entropy)
userkey = None
keys = []
names = []
try:
plkroot = winreg.OpenKey(cuser, PRIVATE_LICENCE_KEY_PATH)
except (WindowsError, FileNotFoundError):
raise ADEPTError("Could not locate ADE activation")
i = -1
while True:
i = i + 1 # start with 0
try:
plkparent = winreg.OpenKey(plkroot, "%04d" % (i,))
except:
# No more keys
break
ktype = winreg.QueryValueEx(plkparent, None)[0]
if ktype != 'credentials':
continue
uuid_name = ""
for j in range(0, 16):
try:
plkkey = winreg.OpenKey(plkparent, "%04d" % (j,))
except (WindowsError, FileNotFoundError):
break
ktype = winreg.QueryValueEx(plkkey, None)[0]
if ktype == 'user':
# Add Adobe UUID to key name
uuid_name = uuid_name + winreg.QueryValueEx(plkkey, 'value')[0][9:] + "_"
if ktype == 'username':
# Add account type & email to key name, if present
try:
uuid_name = uuid_name + winreg.QueryValueEx(plkkey, 'method')[0] + "_"
except:
pass
try:
uuid_name = uuid_name + winreg.QueryValueEx(plkkey, 'value')[0] + "_"
except:
pass
if ktype == 'privateLicenseKey':
userkey = winreg.QueryValueEx(plkkey, 'value')[0]
userkey = unpad(AES.new(keykey, AES.MODE_CBC, b'\x00'*16).decrypt(b64decode(userkey)))[26:]
# print ("found " + uuid_name + " key: " + str(userkey))
keys.append(userkey)
if uuid_name == "":
names.append("Unknown")
else:
names.append(uuid_name[:-1])
if len(keys) == 0:
raise ADEPTError('Could not locate privateLicenseKey')
print("Found {0:d} keys".format(len(keys)))
return keys, names
elif isosx:
import xml.etree.ElementTree as etree
import subprocess
NSMAP = {'adept': 'http://ns.adobe.com/adept',
'enc': 'http://www.w3.org/2001/04/xmlenc#'}
def findActivationDat():
import warnings
warnings.filterwarnings('ignore', category=FutureWarning)
home = os.getenv('HOME')
cmdline = 'find "' + home + '/Library/Application Support/Adobe/Digital Editions" -name "activation.dat"'
cmdline = cmdline.encode(sys.getfilesystemencoding())
p2 = subprocess.Popen(cmdline, shell=True, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=False)
out1, out2 = p2.communicate()
reslst = out1.split(b'\n')
cnt = len(reslst)
ActDatPath = b"activation.dat"
for j in range(cnt):
resline = reslst[j]
pp = resline.find(b'activation.dat')
if pp >= 0:
ActDatPath = resline
break
if os.path.exists(ActDatPath):
return ActDatPath
return None
def adeptkeys():
# TODO: All the code to support extracting multiple activation keys
# TODO: seems to be Windows-only currently, still needs to be added for Mac.
actpath = findActivationDat()
if actpath is None:
raise ADEPTError("Could not find ADE activation.dat file.")
tree = etree.parse(actpath)
adept = lambda tag: '{%s}%s' % (NSMAP['adept'], tag)
expr = '//%s/%s' % (adept('credentials'), adept('privateLicenseKey'))
userkey = tree.findtext(expr)
exprUUID = '//%s/%s' % (adept('credentials'), adept('user'))
keyName = ""
try:
keyName = tree.findtext(exprUUID)[9:] + "_"
except:
pass
try:
exprMail = '//%s/%s' % (adept('credentials'), adept('username'))
keyName = keyName + tree.find(exprMail).attrib["method"] + "_"
keyName = keyName + tree.findtext(exprMail) + "_"
except:
pass
if keyName == "":
keyName = "Unknown"
else:
keyName = keyName[:-1]
userkey = b64decode(userkey)
userkey = userkey[26:]
return [userkey], [keyName]
else:
def adeptkeys():
raise ADEPTError("This script only supports Windows and Mac OS X.")
return [], []
# interface for Python DeDRM
def getkey(outpath):
keys, names = adeptkeys()
if len(keys) > 0:
if not os.path.isdir(outpath):
outfile = outpath
with open(outfile, 'wb') as keyfileout:
keyfileout.write(keys[0])
print("Saved a key to {0}".format(outfile))
else:
keycount = 0
name_index = 0
for key in keys:
while True:
keycount += 1
outfile = os.path.join(outpath,"adobekey{0:d}_uuid_{1}.der".format(keycount, names[name_index]))
if not os.path.exists(outfile):
break
with open(outfile, 'wb') as keyfileout:
keyfileout.write(key)
print("Saved a key to {0}".format(outfile))
name_index += 1
return True
return False
def usage(progname):
print("Finds, decrypts and saves the default Adobe Adept encryption key(s).")
print("Keys are saved to the current directory, or a specified output directory.")
print("If a file name is passed instead of a directory, only the first key is saved, in that file.")
print("Usage:")
print(" {0:s} [-h] [<outpath>]".format(progname))
def cli_main():
sys.stdout=SafeUnbuffered(sys.stdout)
sys.stderr=SafeUnbuffered(sys.stderr)
argv=unicode_argv()
progname = os.path.basename(argv[0])
print("{0} v{1}\nCopyright © 2009-2020 i♥cabbages, Apprentice Harper et al.".format(progname,__version__))
try:
opts, args = getopt.getopt(argv[1:], "h")
except getopt.GetoptError as err:
print("Error in options or arguments: {0}".format(err.args[0]))
usage(progname)
sys.exit(2)
for o, a in opts:
if o == "-h":
usage(progname)
sys.exit(0)
if len(args) > 1:
usage(progname)
sys.exit(2)
if len(args) == 1:
# save to the specified file or directory
outpath = args[0]
if not os.path.isabs(outpath):
outpath = os.path.abspath(outpath)
else:
# save to the same directory as the script
outpath = os.path.dirname(argv[0])
# make sure the outpath is the
outpath = os.path.realpath(os.path.normpath(outpath))
keys, names = adeptkeys()
if len(keys) > 0:
if not os.path.isdir(outpath):
outfile = outpath
with open(outfile, 'wb') as keyfileout:
keyfileout.write(keys[0])
print("Saved a key to {0}".format(outfile))
else:
keycount = 0
name_index = 0
for key in keys:
while True:
keycount += 1
outfile = os.path.join(outpath,"adobekey{0:d}_uuid_{1}.der".format(keycount, names[name_index]))
if not os.path.exists(outfile):
break
with open(outfile, 'wb') as keyfileout:
keyfileout.write(key)
print("Saved a key to {0}".format(outfile))
name_index += 1
else:
print("Could not retrieve Adobe Adept key.")
return 0
def gui_main():
try:
import tkinter
import tkinter.constants
import tkinter.messagebox
import traceback
except:
return cli_main()
class ExceptionDialog(tkinter.Frame):
def __init__(self, root, text):
tkinter.Frame.__init__(self, root, border=5)
label = tkinter.Label(self, text="Unexpected error:",
anchor=tkinter.constants.W, justify=tkinter.constants.LEFT)
label.pack(fill=tkinter.constants.X, expand=0)
self.text = tkinter.Text(self)
self.text.pack(fill=tkinter.constants.BOTH, expand=1)
self.text.insert(tkinter.constants.END, text)
argv=unicode_argv()
root = tkinter.Tk()
root.withdraw()
progpath, progname = os.path.split(argv[0])
success = False
try:
keys, names = adeptkeys()
print(keys)
print(names)
keycount = 0
name_index = 0
for key in keys:
while True:
keycount += 1
outfile = os.path.join(progpath,"adobekey{0:d}_uuid_{1}.der".format(keycount, names[name_index]))
if not os.path.exists(outfile):
break
with open(outfile, 'wb') as keyfileout:
keyfileout.write(key)
success = True
tkinter.messagebox.showinfo(progname, "Key successfully retrieved to {0}".format(outfile))
name_index += 1
except ADEPTError as e:
tkinter.messagebox.showerror(progname, "Error: {0}".format(str(e)))
except Exception:
root.wm_state('normal')
root.title(progname)
text = traceback.format_exc()
ExceptionDialog(root, text).pack(fill=tkinter.constants.BOTH, expand=1)
root.mainloop()
if not success:
return 1
return 0
if __name__ == '__main__':
if len(sys.argv) > 1:
sys.exit(cli_main())
sys.exit(gui_main())

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,148 @@
#!/usr/bin/env python
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
import os, sys
import signal
import threading
import subprocess
from subprocess import Popen, PIPE, STDOUT
# **heavily** chopped up and modfied version of asyncproc.py
# to make it actually work on Windows as well as Mac/Linux
# For the original see:
# "http://www.lysator.liu.se/~bellman/download/"
# author is "Thomas Bellman <bellman@lysator.liu.se>"
# available under GPL version 3 or Later
# create an asynchronous subprocess whose output can be collected in
# a non-blocking manner
# What a mess! Have to use threads just to get non-blocking io
# in a cross-platform manner
# luckily all thread use is hidden within this class
class Process(object):
def __init__(self, *params, **kwparams):
if len(params) <= 3:
kwparams.setdefault('stdin', subprocess.PIPE)
if len(params) <= 4:
kwparams.setdefault('stdout', subprocess.PIPE)
if len(params) <= 5:
kwparams.setdefault('stderr', subprocess.PIPE)
self.__pending_input = []
self.__collected_outdata = []
self.__collected_errdata = []
self.__exitstatus = None
self.__lock = threading.Lock()
self.__inputsem = threading.Semaphore(0)
self.__quit = False
self.__process = subprocess.Popen(*params, **kwparams)
if self.__process.stdin:
self.__stdin_thread = threading.Thread(
name="stdin-thread",
target=self.__feeder, args=(self.__pending_input,
self.__process.stdin))
self.__stdin_thread.setDaemon(True)
self.__stdin_thread.start()
if self.__process.stdout:
self.__stdout_thread = threading.Thread(
name="stdout-thread",
target=self.__reader, args=(self.__collected_outdata,
self.__process.stdout))
self.__stdout_thread.setDaemon(True)
self.__stdout_thread.start()
if self.__process.stderr:
self.__stderr_thread = threading.Thread(
name="stderr-thread",
target=self.__reader, args=(self.__collected_errdata,
self.__process.stderr))
self.__stderr_thread.setDaemon(True)
self.__stderr_thread.start()
def pid(self):
return self.__process.pid
def kill(self, signal):
self.__process.send_signal(signal)
# check on subprocess (pass in 'nowait') to act like poll
def wait(self, flag):
if flag.lower() == 'nowait':
rc = self.__process.poll()
else:
rc = self.__process.wait()
if rc != None:
if self.__process.stdin:
self.closeinput()
if self.__process.stdout:
self.__stdout_thread.join()
if self.__process.stderr:
self.__stderr_thread.join()
return self.__process.returncode
def terminate(self):
if self.__process.stdin:
self.closeinput()
self.__process.terminate()
# thread gets data from subprocess stdout
def __reader(self, collector, source):
while True:
data = os.read(source.fileno(), 65536)
self.__lock.acquire()
collector.append(data)
self.__lock.release()
if data == "":
source.close()
break
return
# thread feeds data to subprocess stdin
def __feeder(self, pending, drain):
while True:
self.__inputsem.acquire()
self.__lock.acquire()
if not pending and self.__quit:
drain.close()
self.__lock.release()
break
data = pending.pop(0)
self.__lock.release()
drain.write(data)
# non-blocking read of data from subprocess stdout
def read(self):
self.__lock.acquire()
outdata = "".join(self.__collected_outdata)
del self.__collected_outdata[:]
self.__lock.release()
return outdata
# non-blocking read of data from subprocess stderr
def readerr(self):
self.__lock.acquire()
errdata = "".join(self.__collected_errdata)
del self.__collected_errdata[:]
self.__lock.release()
return errdata
# non-blocking write to stdin of subprocess
def write(self, data):
if self.__process.stdin is None:
raise ValueError("Writing to process with stdin not a pipe")
self.__lock.acquire()
self.__pending_input.append(data)
self.__inputsem.release()
self.__lock.release()
# close stdinput of subprocess
def closeinput(self):
self.__lock.acquire()
self.__quit = True
self.__inputsem.release()
self.__lock.release()

Binary file not shown.

View File

@@ -0,0 +1,16 @@
{
"adeptkeys": {},
"adobe_pdf_passphrases": [],
"adobewineprefix": "",
"androidkeys": {},
"bandnkeys": {},
"configured": true,
"deobfuscate_fonts": true,
"ereaderkeys": {},
"kindlekeys": {},
"kindlewineprefix": "",
"lcp_passphrases": [],
"pids": [],
"remove_watermarks": true,
"serials": []
}

180
calibre/tweak_book_gui.json Normal file
View File

@@ -0,0 +1,180 @@
{
"check-book-splitter-state": {
"__class__": "bytearray",
"__value__": "AAAA/wAAAAEAAAAC//////////8A/////wEAAAABAA=="
},
"custom_colors_for_color_dialog": [
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
],
[
255,
255,
255,
255
]
],
"find-widget-state": {
"case_sensitive": false,
"direction": "down",
"dot_all": false,
"mode": "normal",
"where": "current",
"wrap": true
},
"geometry-of-main_window_geometry": {
"frame_geometry": {
"height": 1171,
"width": 1920,
"x": 1598,
"y": 27
},
"full_screened": false,
"geometry": {
"height": 1167,
"width": 1916,
"x": 1600,
"y": 29
},
"maximized": false,
"normal_geometry": {
"height": 1167,
"width": 1916,
"x": 1600,
"y": 29
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAAAAAY+AAAAGwAADb0AAAStAAAGQAAAAB0AAA27AAAEqwAAAAAAAAAAB4AAAAZAAAAAHQAADbsAAASr"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 1600,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 3520,
"x": 0,
"y": 0
}
}
},
"main_window_state": {
"__class__": "bytearray",
"__value__": "AAAA/wAAAAD9AAAABAAAAAAAAAEAAAAEPfwCAAAABfsAAAAkAGYAaQBsAGUAcwAtAGIAcgBvAHcAcwBlAHIALQBkAG8AYwBrAQAAADwAAAQ9AAAAWQD////7AAAAHgB0AG8AYwAtAHYAaQBlAHcAZQByAC0AZABvAGMAawAAAAAA/////wAAAFkA////+wAAACAAdABlAHgAdAAtAHMAZQBhAHIAYwBoAC0AZABvAGMAawAAAAAA/////wAAAHkA////+wAAACAAYwBoAGUAYwBrAHAAbwBpAG4AdABzAC0AZABvAGMAawAAAAAA/////wAAAIkA////+wAAACYAcwBhAHYAZQBkAC0AcwBlAGEAcgBjAGgAZQBzAC0AZABvAGMAawAAAAAA/////wAAAfgA////AAAAAQAAAhUAAAQ9/AIAAAAC+wAAABgAcAByAGUAdgBpAGUAdwAtAGQAbwBjAGsBAAAAPAAABD0AAABQAP////sAAAAaAGwAaQB2AGUALQBjAHMAcwAtAGQAbwBjAGsAAAAAAP////8AAABZAP///wAAAAIAAAAAAAAAAPwBAAAAAfsAAAAeAGMAaABlAGMAawAtAGIAbwBvAGsALQBkAG8AYwBrAAAAAAD/////AAAAkAD///8AAAADAAAAAAAAAAD8AQAAAAH7AAAAHABpAG4AcwBwAGUAYwB0AG8AcgAtAGQAbwBjAGsAAAAAAP////8AAAA6AP///wAABFsAAAQ9AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAMAAAAUAGcAbABvAGIAYQBsAC0AYgBhAHIBAAAAAP////8AAAAAAAAAAAAAABIAdABvAG8AbABzAC0AYgBhAHIBAAABJv////8AAAAAAAAAAAAAABYAcABsAHUAZwBpAG4AcwAtAGIAYQByAAAAAAD/////AAAAAAAAAAA="
},
"reports-ui-state": {},
"saved_seaches_state": {
"direction": "down",
"where": "current",
"wrap": true
},
"search-panel-visible": false,
"text_search_widget_state": {
"case_sensitive": false,
"dot_all": true,
"mode": "normal",
"where": "current"
}
}

View File

@@ -0,0 +1,76 @@
{
"geometry-of-main_window_geometry": {
"frame_geometry": {
"height": 1151,
"width": 1046,
"x": 1610,
"y": 39
},
"full_screened": false,
"geometry": {
"height": 1147,
"width": 1042,
"x": 1612,
"y": 41
},
"maximized": false,
"normal_geometry": {
"height": 1147,
"width": 1042,
"x": 1612,
"y": 41
},
"qt": {
"__class__": "bytearray",
"__value__": "AdnQywADAAAAAAZKAAAAJwAACl8AAASlAAAGTAAAACkAAApdAAAEowAAAAAAAAAAB4AAAAZMAAAAKQAACl0AAASj"
},
"screen": {
"depth": 24,
"device_pixel_ratio": 1.0,
"geometry_in_logical_pixels": {
"height": 1200,
"width": 1920,
"x": 1600,
"y": 0
},
"index_in_screens_list": 0,
"manufacturer": "BOE",
"model": "",
"name": "eDP-1",
"serial": "",
"size_in_logical_pixels": {
"height": 1200,
"width": 1920
},
"virtual_geometry": {
"height": 1200,
"width": 3520,
"x": 0,
"y": 0
}
}
},
"main_window_state": {
"__class__": "bytearray",
"__value__": "AAAA/wAAAAH9AAAAAgAAAAAAAAAAAAAAAPwCAAAAAvsAAAAQAHQAbwBjAC0AZABvAGMAawAAAAAA/////wAAAIcA////+wAAABYAcwBlAGEAcgBjAGgALQBkAG8AYwBrAAAAAAD/////AAAAlQD///8AAAABAAAAAAAAAAD8AgAAAAT7AAAAFgBsAG8AbwBrAHUAcAAtAGQAbwBjAGsAAAAAAP////8AAAB9AP////sAAAAcAGIAbwBvAGsAbQBhAHIAawBzAC0AZABvAGMAawAAAAAA/////wAAAOcA////+wAAABwAaQBuAHMAcABlAGMAdABvAHIALQBkAG8AYwBrAAAAAAD/////AAAAEwD////7AAAAHgBoAGkAZwBoAGwAaQBnAGgAdABzAC0AZABvAGMAawAAAAAA/////wAAAMkA////AAAEEgAABHsAAAAEAAAABAAAAAgAAAAI/AAAAAEAAAAAAAAAAQAAAB4AYQBjAHQAaQBvAG4AcwBfAHQAbwBvAGwAYgBhAHICAAAAAP////8AAAAAAAAAAA=="
},
"old_prefs_migrated": true,
"session_data": {
"controls_help_shown_count": 2,
"standalone_font_settings": {},
"standalone_misc_settings": {
"remember_last_read": true,
"remember_window_geometry": false,
"save_annotations_in_ebook": false,
"singleinstance": false
},
"standalone_recently_opened": [
{
"key": "/home/klein/vimwiki/SupportingFiles/latex.pdf",
"pathtoebook": "/home/klein/vimwiki/SupportingFiles/latex.pdf",
"timestamp": "2025-01-26T08:11:55.821Z",
"title": "latex"
}
]
}
}