Fix wine parsing code

This commit is contained in:
Florian Bach 2021-12-09 16:50:58 +01:00
parent f7eb9e5d79
commit f453dd7391
3 changed files with 8 additions and 4 deletions

View File

@ -90,7 +90,7 @@ class DeACSM(FileTypePlugin):
names = ["cryptography.zip", "rsa.zip", "oscrypto.zip", "asn1crypto.zip", "pyasn1.zip"] names = ["cryptography.zip", "rsa.zip", "oscrypto.zip", "asn1crypto.zip", "pyasn1.zip"]
lib_dict = self.load_resources(names) lib_dict = self.load_resources(names)
print("{0} v{1}: Copying needed library files from plugin zip".format(PLUGIN_NAME, PLUGIN_VERSION)) # print("{0} v{1}: Copying needed library files from plugin zip".format(PLUGIN_NAME, PLUGIN_VERSION))
for entry, data in lib_dict.items(): for entry, data in lib_dict.items():
file_path = os.path.join(self.moddir, entry) file_path = os.path.join(self.moddir, entry)

View File

@ -128,13 +128,13 @@ class ConfigWidget(QWidget):
self.chkNotifyFulfillment.setChecked(self.tempdeacsmprefs["notify_fulfillment"]) self.chkNotifyFulfillment.setChecked(self.tempdeacsmprefs["notify_fulfillment"])
layout.addWidget(self.chkNotifyFulfillment) layout.addWidget(self.chkNotifyFulfillment)
self.chkDetailedLogging = QtGui.QCheckBox("Enable detailed debug logging") self.chkDetailedLogging = QtGui.QCheckBox("Enable verbose debug logging")
self.chkDetailedLogging.setToolTip("Default: False\n\nIf this is enabled, the plugin debug logs will be more verbose which might be helpful in case of errors.\nHowever, it will also mean that private data like encryption keys or account credentials might end up in the logfiles.") self.chkDetailedLogging.setToolTip("Default: False\n\nIf this is enabled, the plugin debug logs will be more verbose which might be helpful in case of errors.\nHowever, it will also mean that private data like encryption keys or account credentials might end up in the logfiles.")
self.chkDetailedLogging.setChecked(self.tempdeacsmprefs["detailed_logging"]) self.chkDetailedLogging.setChecked(self.tempdeacsmprefs["detailed_logging"])
self.chkDetailedLogging.toggled.connect(self.toggle_logging) self.chkDetailedLogging.toggled.connect(self.toggle_logging)
layout.addWidget(self.chkDetailedLogging) layout.addWidget(self.chkDetailedLogging)
# Key shortcut Ctrl+Shift+D to remove authorization, just like in ADE. # Key shortcut Ctrl+Shift+D / Cmd+Shift+D to remove authorization, just like in ADE.
self.deauthShortcut = QShortcut(QKeySequence("Ctrl+Shift+D"), self) self.deauthShortcut = QShortcut(QKeySequence("Ctrl+Shift+D"), self)
self.deauthShortcut.activated.connect(self.delete_ade_auth) self.deauthShortcut.activated.connect(self.delete_ade_auth)

View File

@ -49,7 +49,9 @@ def unfuck(user):
if char not in hex_char_list: if char not in hex_char_list:
user_new.append(ord('x')) user_new.append(ord('x'))
# This seems to be fallback code. # This seems to be fallback code.
# Probably a bug in wine: We should also add "char" - but Wine doesn't either ... # Subtract 1 so the next char (the one that's not a hex char)
# is handled normally.
i -= 1
else: else:
ival = "" + chr(char) ival = "" + chr(char)
@ -346,6 +348,8 @@ def CryptUnprotectDataExecuteWine(wineprefix, data, entropy):
key_string = prog_output.decode("utf-8").split(':')[2] key_string = prog_output.decode("utf-8").split(':')[2]
if verbose_logging: if verbose_logging:
print("Successfully got encryption key from WINE: " + key_string) print("Successfully got encryption key from WINE: " + key_string)
#print("Debug log:")
#print(prog_stderr.decode("utf-8"))
else: else:
print("Successfully got encryption key from WINE.") print("Successfully got encryption key from WINE.")
master_key = bytes.fromhex(key_string) master_key = bytes.fromhex(key_string)