mobidedrm 0.06 and Applescript
This commit is contained in:
committed by
Apprentice Alf
parent
bf1161192e
commit
2df89db8f2
@@ -4,8 +4,10 @@
|
||||
# Changelog
|
||||
# 0.01 - Initial version
|
||||
# 0.02 - Huffdic compressed books were not properly decrypted
|
||||
# 0.03 - fix 0.02 to work with all Mobipocket eBooks
|
||||
# 0.04 - Wasn't checking MOBI header length
|
||||
# 0.03 - Wasn't checking MOBI header length
|
||||
# 0.04 - Wasn't sanity checking size of data record
|
||||
# 0.05 - It seems that the extra data flags take two bytes not four
|
||||
# 0.06 - And that low bit does mean something after all :-)
|
||||
|
||||
import sys,struct,binascii
|
||||
|
||||
@@ -72,14 +74,15 @@ def getSizeOfTrailingDataEntries(ptr, size, flags):
|
||||
if (v & 0x80) != 0 or (bitpos >= 28) or (size == 0):
|
||||
return result
|
||||
num = 0
|
||||
flags >>= 1
|
||||
while flags:
|
||||
if flags & 1:
|
||||
testflags = flags >> 1
|
||||
while testflags:
|
||||
if testflags & 1:
|
||||
num += getSizeOfTrailingDataEntry(ptr, size - num)
|
||||
flags >>= 1
|
||||
testflags >>= 1
|
||||
if flags & 1:
|
||||
num += (ord(ptr[size - num - 1]) & 0x3) + 1
|
||||
return num
|
||||
|
||||
|
||||
class DrmStripper:
|
||||
def loadSection(self, section):
|
||||
if (section + 1 == self.num_sections):
|
||||
@@ -140,7 +143,7 @@ class DrmStripper:
|
||||
mobi_length, = struct.unpack('>L',sect[0x14:0x18])
|
||||
extra_data_flags = 0
|
||||
if mobi_length >= 0xE4:
|
||||
extra_data_flags, = struct.unpack('>L', sect[0xF0:0xF4])
|
||||
extra_data_flags, = struct.unpack('>H', sect[0xF2:0xF4])
|
||||
|
||||
|
||||
crypto_type, = struct.unpack('>H', sect[0xC:0xC+2])
|
||||
@@ -170,7 +173,7 @@ class DrmStripper:
|
||||
def getResult(self):
|
||||
return self.data_file
|
||||
|
||||
print "MobiDeDrm v0.04. Copyright (c) 2008 The Dark Reverser"
|
||||
print "MobiDeDrm v0.06. Copyright (c) 2008 The Dark Reverser"
|
||||
if len(sys.argv)<4:
|
||||
print "Removes protection from Mobipocket books"
|
||||
print "Usage:"
|
||||
|
||||
Binary file not shown.
@@ -36,14 +36,14 @@ end unlockfolder
|
||||
on run
|
||||
set MobiDeDRMPath to POSIX path of file ((path to me as text) & "Contents:Resources:MobiDeDRM.py")
|
||||
set encryptedFolder to choose folder with prompt "Please choose the folder of encrypted Mobipocket files."
|
||||
set encryptionKey to (display dialog "Enter Mobipocket key for encrypted Mobipocket files." default answer "X12QIL1M3D" buttons {"Cancel", "OK"} default button 2)
|
||||
set encryptionKey to (display dialog "Enter Mobipocket key for encrypted Mobipocket files." default answer "Your PID Here" buttons {"Cancel", "OK"} default button 2)
|
||||
set encryptionKey to text returned of encryptionKey
|
||||
unlockfolder(encryptedFolder, MobiDeDRMPath, encryptionKey)
|
||||
end run
|
||||
|
||||
on open some_items
|
||||
set MobiDeDRMPath to POSIX path of file ((path to me as text) & "Contents:Resources:MobiDeDRM.py")
|
||||
set encryptionKey to (display dialog "Enter Mobipocket key for encrypted Mobipocket files." default answer "X12QIL1M3D" buttons {"Cancel", "OK"} default button 2)
|
||||
set encryptionKey to (display dialog "Enter Mobipocket key for encrypted Mobipocket files." default answer "Your PID Here" buttons {"Cancel", "OK"} default button 2)
|
||||
set encryptionKey to text returned of encryptionKey
|
||||
repeat with this_item in some_items
|
||||
if (folder of (info for this_item) is true) then
|
||||
@@ -55,5 +55,6 @@ on open some_items
|
||||
end if
|
||||
end if
|
||||
end repeat
|
||||
display dialog "Finished Unlocking." buttons {"OK"} default button 1
|
||||
end open
|
||||
|
||||
|
||||
Reference in New Issue
Block a user