1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| import common.SleevedResource;
import java.io.*;
public class Csdecrypt { public static void saveFile(String filename, byte[] data) throws Exception { if (data != null) { String filepath = filename; File file = new File(filepath); if (file.exists()) { file.delete(); } FileOutputStream fos = new FileOutputStream(file); fos.write(data, 0, data.length); fos.flush(); fos.close(); } }
public static byte[] toByteArray(File f) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream((int) f.length()); BufferedInputStream in = null; try { in = new BufferedInputStream(new FileInputStream(f)); int buf_size = 1024; byte[] buffer = new byte[buf_size]; int len = 0; while (-1 != (len = in.read(buffer, 0, buf_size))) { bos.write(buffer, 0, len); } return bos.toByteArray(); } catch (IOException e) { e.printStackTrace(); throw e; } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); } bos.close(); } }
public static void main(String[] var0) throws Exception { byte[] csdecrypt = new byte[]{1, -55, -61, 127, 102, 0, 0, 0, 100, 1, 0, 27, -27, -66, 82, -58, 37, 92, 51, 85, -114, -118, 28, -74, 103, -53, 6};
SleevedResource.Setup(csdecrypt); byte[] var7 = null; File file = new File("/home/kali/Desktop/CSDecrypt/src/sleeve"); File[] fs = file.listFiles();
for (File ff : fs) { if (!ff.isDirectory()) var7 = SleevedResource.readResource(ff.getPath()); saveFile("/home/kali/Desktop/CSDecrypt/src/sleevedecrypt/" + ff.getName(), var7); System.out.println("解密成功: " + ff.getName()); } } }
|