Closed goldeneye5599 closed 1 year ago
Cool! When I made this the web app was off due to security reasons 😅 Want to add this code to the repo? You can open a pull request
@goldeneye5599 your code which was merged (and then was reverted by the repo owner) has been working till recently.
I see that they have published a new version of the file named 5.e78ff86c.chunk.js
so your injector code is now not up to date anymore.
Is there a chance that you can guide how to make it working again?
@ron94 did you manage to solve this issue?
@omerfrydman no
Evrit
has web app similar to theAndroid
app, It decryptes the book too, so this code extract the decrypted book. Instructions in the top of the fileBy the way, in the webapp it uses
aes
inCBC
mode, so I guess that it uses the same encryption in theAndroid
app too.Code Is Here
```python import asyncio import subprocess import json import base64 import zipfile import shutil import re from pathlib import Path from io import BytesIO from mitmproxy import options from mitmproxy.tools import dump from Crypto.Cipher import AES """ This program export encrypted books from read.e-vrit.co.il and decrypt them Please don't use this to pirate books You must install chrome browser on windows and it should located at C:/Program Files/Google/Chrome/Application/chrome.exe Install dependencies: pip install mitmproxy pycryptodome Then run the program python main.py navigate to the book you want to download, open it and it will be downloaded automatically then you can open and read it with https://calibre-ebook.com/ and also you can convert it to PDF using calibre """ CHROME_PATH = Path('C:/Program Files/Google/Chrome/Application/chrome.exe') APP_URL = 'https://read.e-vrit.co.il/main' def decrypt_book(book_b64, key): book = base64.b64decode(book_b64) zf = zipfile.ZipFile(BytesIO(book)) zf.extractall('book') # open each page recursively inside book/ folder which ends with .xhtml, read, decrypt, and rewrite for file in Path('book/').rglob('*.xhtml'): with file.open('rb') as f: page = f.read() try: cipher = AES.new(key.encode('utf-8'), AES.MODE_CBC) dec = cipher.decrypt(page) # for some reason in the beggining and end of file it's corrupted try: dec = dec[dec.index(b'') + 7] dec = b'\n' + dec except Exception as e: pass with file.open('wb') as f: f.write(dec) except Exception as e: print(e) with file.open('wb') as f: f.write(page) # fix font size in css book_css = Path('book/OEBPS/css/idGeneratedStyles.css') if book_css.exists(): with book_css.open('r') as f: css = f.read() css += """\n p { font-size: 2em; padding: 12px; } """ with book_css.open('w') as f: f.write(css) # extract title, remove username title = 'book' content_file = Path('book/OEBPS/content.opf') if content_file.exists(): with content_file.open('r', encoding='utf-8') as f: content = f.read() title_re = re.search('