Created
November 19, 2021 10:19
-
-
Save qinlili23333/109ccb0321866b7dc34eb072f8f4ad33 to your computer and use it in GitHub Desktop.
100xuexi_DecryptEpub.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.nio.file.*; | |
import java.security.*; | |
import javax.crypto.*; | |
import javax.crypto.spec.*; | |
public class dec { | |
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, | |
InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { | |
System.out.println("Initializing..."); | |
File directory = new File("."); | |
directory = new File(directory.getCanonicalPath()); | |
File[] fs = directory.listFiles(); | |
for (File f : fs) { | |
if (f.getName().endsWith(".html")) { | |
System.out.println("Found file to process:" + f.getName()); | |
Path path = f.toPath(); | |
byte[] file = Files.readAllBytes(path); | |
SecretKeySpec secretKeySpec = new SecretKeySpec("0c5863bcd5f04a80".getBytes("UTF-8"), "AES"); | |
Cipher instance = Cipher.getInstance("AES/CBC/PKCS5Padding"); | |
instance.init(2, secretKeySpec, new IvParameterSpec("2f3e6b5cc0154f84".getBytes("UTF-8"))); | |
String str4; | |
try { | |
str4 = new String(instance.doFinal(file), "UTF-8"); | |
} catch (IllegalBlockSizeException e) { | |
System.out.println("Decrypt fail, skip:" + f.getName()); | |
str4=""; | |
} | |
// System.out.println(str4); | |
if (str4.indexOf("</") > 1) { | |
System.out.println("Decrypt Success, write back:" + f.getName()); | |
BufferedWriter out = new BufferedWriter(new FileWriter(f.getName())); | |
out.write(str4); | |
out.close(); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
搜索GetBookAESKey:Ljava/lang/String;
在requestByRSA下面用logcat把Json打印出来就有key和iv了,替换到本java文件内,把本文件放在OEBPS文件夹内运行即可