Installable from Pip and use in CMD

This commit is contained in:
Bipin 2023-08-28 20:17:34 +05:30
parent 4e61897e17
commit eb7d65bab5
18 changed files with 520 additions and 470 deletions

View file

@ -32,7 +32,7 @@ jobs:
- name: Build Executable
uses: Nuitka/Nuitka-Action@main
with:
script-name: DeGourou.py
script-name: DeGourou/DeGourou.py
onefile: true
standalone: true

29
DeGourou.py → DeGourou/DeGourou.py Executable file → Normal file
View file

@ -1,18 +1,18 @@
#!/usr/bin/env python
from setup.loginAccount import loginAndGetKey
from setup.fulfill import downloadFile
from .setup.loginAccount import loginAndGetKey
from .setup.fulfill import downloadFile
from decrypt.decodePDF import decryptPDF
from decrypt.decodeEPUB import decryptEPUB
from .decrypt.decodePDF import decryptPDF
from .decrypt.decodeEPUB import decryptEPUB
import argparse
from os import mkdir, remove, rename
from os.path import exists
from setup.params import FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
from decrypt.params import KEYPATH
from setup.data import createDefaultFiles
from setup.ia import SESSION_FILE, manage_login, get_book, return_book
from .setup.params import FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
from .decrypt.params import KEYPATH
from .setup.data import createDefaultFiles
from .setup.ia import SESSION_FILE, manage_login, get_book, return_book
def loginADE(email, password):
@ -32,7 +32,7 @@ def loginIA(email,password):
manage_login(email,password)
print()
def main(acsmFile, outputFilename):
def start(acsmFile, outputFilename):
if not exists('account'): mkdir('account')
# setting up the account and keys
@ -81,13 +81,13 @@ def handle_IA(url,format):
if acsmFile is None:
print("Could not get Book, try using ACSm file as input")
return
main(acsmFile,None)
start(acsmFile,None)
remove(acsmFile)
if(return_book(url) is None):
print("Please return it yourself")
if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser(description="Download and Decrypt an encrypted PDF or EPUB file.")
parser.add_argument("-f", type=str, nargs='?', default=None, help="path to the ACSM file")
parser.add_argument("-u", type=str, nargs='?', default=None, help="book url from InternetArchive")
@ -134,8 +134,11 @@ if __name__ == "__main__":
elif args.f == None:
if exists("URLLink.acsm"):
args.f = "URLLink.acsm"
main(args.f, args.o)
start(args.f, args.o)
else: parser.print_help()
else:
main(args.f, args.o)
start(args.f, args.o)
if __name__ == "__main__": main()

View file

@ -11,7 +11,7 @@
Decrypt Adobe Digital Editions encrypted ePub books.
"""
from decrypt.params import KEYPATH
from .params import KEYPATH
__license__ = 'GPL v3'
__version__ = "8.0"
@ -21,7 +21,7 @@ import traceback
import base64
import zlib
from zipfile import ZipInfo, ZipFile, ZIP_STORED, ZIP_DEFLATED
from decrypt.zeroedzipinfo import ZeroedZipInfo
from .zeroedzipinfo import ZeroedZipInfo
from contextlib import closing
from lxml import etree
from uuid import UUID

View file

@ -13,7 +13,7 @@
Decrypts Adobe ADEPT-encrypted PDF files.
"""
from decrypt.params import KEYPATH
from .params import KEYPATH
__license__ = 'GPL v3'
__version__ = "10.0.4"

View file

@ -1,5 +1,5 @@
from setup.params import FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
from decrypt.params import KEYPATH
from .params import FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
from ..decrypt.params import KEYPATH
keyContent = b'0\x82\x02\\\x02\x01\x00\x02\x81\x81\x00\xad*E\x8e0\n\x91\xd6\xbaj\xc1t3\xc2R2h\xa6\x18\x063i\xfd\x9bR/e\xa6\xec\x87\xab\x11\n\'\xb7\x93\x14\xb6\xbbm\xfa\xf0\xf4\xe8=\x18\xa6\xe9\x15$\xdao\xb3\x8d\xf5\xddT\n\xf5\t<\xe8\xb2\x93k\x02zi\xe6\x86\x10F\x13\xc9m\xcfZ\x83\xe6=\xd6G\xf2/]3\xff\x8ch#\xea|\xa9I\x9a\xf6\xbf\x19\xd9\x10\xe0\x18\xa1\rb\x801k~\xc03f\x84\x07{v\x88\x18\x9bH\x91+o \x90\x9b\xb7\xf5\x02\x03\x01\x00\x01\x02\x81\x80\x05\xfd\x95\xd3\x886\x9a\xba\x8ck\xc1\xb5\xc21\x86\xab\x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5qdep\x11\x85\x15\xbd)6\x16\xad\xd4\x9f\x13\x02@\x0f\x15\xc1Y"b\x19\x81Q\x81\x8d\x006\xe4\xf0e\xa2\xa7\xb8\x98{\x1c\x12\xe0\nw\xbe\x86A-\xd0\x1c7\xf3\x169\xadd3\x85\xaf\x13\x99\x08\x97e)c\xaf\xb1V\xf1\x15\xf6K\r\x16\xb4\xf9\xd1\x10\xe2\x92\xf9'

View file

@ -12,9 +12,9 @@ import os, time, shutil
import zipfile
from lxml import etree
from setup.libadobe import sendHTTPRequest_DL2FILE
from setup.libadobeFulfill import buildRights, fulfill
from setup.libpdf import patch_drm_into_pdf
from .libadobe import sendHTTPRequest_DL2FILE
from .libadobeFulfill import buildRights, fulfill
from .libpdf import patch_drm_into_pdf
#######################################################################

View file

@ -30,7 +30,7 @@ except ImportError:
#@@CALIBRE_COMPAT_CODE@@
from setup.customRSA import CustomRSA
from .customRSA import CustomRSA
from cryptography.hazmat.primitives.serialization.pkcs12 import load_key_and_certificates
from cryptography.hazmat.primitives import serialization
@ -38,7 +38,7 @@ from cryptography.hazmat.primitives import serialization
VAR_ACS_SERVER_HTTP = "http://adeactivate.adobe.com/adept"
VAR_ACS_SERVER_HTTPS = "https://adeactivate.adobe.com/adept"
from setup.params import FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
from .params import FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
# Lists of different ADE "versions" we know about
VAR_VER_SUPP_CONFIG_NAMES = [ "ADE 1.7.2", "ADE 2.0.1", "ADE 3.0.1", "ADE 4.0.3", "ADE 4.5.10", "ADE 4.5.11" ]

View file

@ -15,12 +15,12 @@ except ImportError:
#@@CALIBRE_COMPAT_CODE@@
from setup.libadobe import addNonce, sign_node, sendRequestDocu, sendHTTPRequest
from setup.libadobe import makeFingerprint, makeSerial, encrypt_with_device_key, decrypt_with_device_key
from setup.libadobe import get_devkey_path, get_device_path, get_activation_xml_path
from setup.libadobe import VAR_VER_SUPP_CONFIG_NAMES, VAR_VER_HOBBES_VERSIONS, VAR_VER_OS_IDENTIFIERS
from setup.libadobe import VAR_VER_ALLOWED_BUILD_IDS_SWITCH_TO, VAR_VER_SUPP_VERSIONS, VAR_ACS_SERVER_HTTP
from setup.libadobe import VAR_ACS_SERVER_HTTPS, VAR_VER_BUILD_IDS, VAR_VER_NEED_HTTPS_BUILD_ID_LIMIT, VAR_VER_ALLOWED_BUILD_IDS_AUTHORIZE
from .libadobe import addNonce, sign_node, sendRequestDocu, sendHTTPRequest
from .libadobe import makeFingerprint, makeSerial, encrypt_with_device_key, decrypt_with_device_key
from .libadobe import get_devkey_path, get_device_path, get_activation_xml_path
from .libadobe import VAR_VER_SUPP_CONFIG_NAMES, VAR_VER_HOBBES_VERSIONS, VAR_VER_OS_IDENTIFIERS
from .libadobe import VAR_VER_ALLOWED_BUILD_IDS_SWITCH_TO, VAR_VER_SUPP_VERSIONS, VAR_ACS_SERVER_HTTP
from .libadobe import VAR_ACS_SERVER_HTTPS, VAR_VER_BUILD_IDS, VAR_VER_NEED_HTTPS_BUILD_ID_LIMIT, VAR_VER_ALLOWED_BUILD_IDS_AUTHORIZE
def createDeviceFile(randomSerial, useVersionIndex = 0):
@ -213,7 +213,7 @@ def createUser(useVersionIndex = 0, authCert = None):
def encryptLoginCredentials(username, password, authenticationCertificate):
# type: (str, str, str) -> bytes
from setup.libadobe import devkey_bytes as devkey_adobe
from .libadobe import devkey_bytes as devkey_adobe
import struct
if devkey_adobe is not None:

View file

@ -5,10 +5,10 @@ import time
#@@CALIBRE_COMPAT_CODE@@
from setup.libadobe import addNonce, sign_node, get_cert_from_pkcs12, sendRequestDocu, sendRequestDocuRC, sendHTTPRequest
from setup.libadobe import get_devkey_path, get_device_path, get_activation_xml_path
from setup.libadobe import VAR_VER_SUPP_VERSIONS, VAR_VER_HOBBES_VERSIONS
from setup.libadobe import VAR_VER_BUILD_IDS, VAR_VER_USE_DIFFERENT_NOTIFICATION_XML_ORDER
from .libadobe import addNonce, sign_node, get_cert_from_pkcs12, sendRequestDocu, sendRequestDocuRC, sendHTTPRequest
from .libadobe import get_devkey_path, get_device_path, get_activation_xml_path
from .libadobe import VAR_VER_SUPP_VERSIONS, VAR_VER_HOBBES_VERSIONS
from .libadobe import VAR_VER_BUILD_IDS, VAR_VER_USE_DIFFERENT_NOTIFICATION_XML_ORDER
def buildFulfillRequest(acsm):
@ -143,7 +143,7 @@ def getDecryptedCert(pkcs12_b64_string = None):
pkcs12_data = base64.b64decode(pkcs12_b64_string)
try:
from setup.libadobe import devkey_bytes as devkey_adobe
from .libadobe import devkey_bytes as devkey_adobe
except:
pass

View file

@ -5,14 +5,14 @@
This is an experimental Python version of libgourou.
'''
from setup.libadobe import createDeviceKeyFile, FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
from setup.libadobeAccount import createDeviceFile, createUser, signIn, activateDevice, exportAccountEncryptionKeyDER, getAccountUUID
from .libadobe import createDeviceKeyFile, FILE_DEVICEKEY, FILE_DEVICEXML, FILE_ACTIVATIONXML
from .libadobeAccount import createDeviceFile, createUser, signIn, activateDevice, exportAccountEncryptionKeyDER, getAccountUUID
from os.path import exists
VAR_MAIL = ""
VAR_PASS = ""
VAR_VER = 1 # None # 1 for ADE2.0.1, 2 for ADE3.0.1
from decrypt.params import KEYPATH
from ..decrypt.params import KEYPATH
#################################################################

View file

@ -30,7 +30,7 @@ This tool is intended for educational purposes only. Its primary aim is to assis
## Usage
```
usage: DeGourou.py [-h] [-f [F]] [-u [U]] [-t [T]] [-o [O]] [-la] [-li] [-e [E]] [-p [P]] [-lo]
usage: DeGourou [-h] [-f [F]] [-u [U]] [-t [T]] [-o [O]] [-la] [-li] [-e [E]] [-p [P]] [-lo]
Download and Decrypt an encrypted PDF or EPUB file.
@ -74,17 +74,28 @@ optional arguments:
C. MacOS user's accordingly with name ```DeGourou.bin```
### For Middlemans
1. Install through Pip using
```
pip install git+https://gitea.com/bipinkrish/DeGourou.git
```
2. Use `degourou` in Terminal/CMD
### For Developers
1. Clone the repositary or Download zip file and extract it
2. Install requirements using pip
3. Run "DeGourou.py" file
3. Run "DeGourou.py" file in "DeGourou" directory
```
git clone https://github.com/bipinkrish/DeGourou.git
git clone https://gitea.com/bipinkrish/DeGourou.git
cd DeGourou
pip install -r requirements.txt
cd DeGourou
python DeGourou.py
```

36
setup.py Normal file
View file

@ -0,0 +1,36 @@
from setuptools import setup
setup(
name='DeGourou',
version='1.3.8',
description='Automate the process of getting decrypted ebook from InternetArchive without the need for Adobe Digital Editions and Calibre.',
url='https://gitea.com/bipinkrish/DeGourou',
author='Bipin krishna',
license='GPL3',
packages=['DeGourou',"DeGourou/setup","DeGourou/decrypt"],
install_requires=['pycryptodomex>=3.17',
'cryptography>=41.0.1',
'lxml>=4.9.2',
'requests>=2.31.0',
'charset-normalizer>=3.1.0'
],
entry_points={
'console_scripts': [
'degourou = DeGourou.DeGourou:main'
]
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
)