Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.IO;
- using System.IO.Compression;
- using System.Linq;
- using System.Net;
- using System.Text;
- using System.Xml;
- namespace ConsoleApplication87
- {
- class Program
- {
- static void Main(string[] args)
- {
- string baseUrl = args.Last();
- Console.Write(">");
- var wc = new WebClient();
- byte[] propSwf = wc.DownloadData(baseUrl + "assets/flash/properties.swf");
- Console.Write("*");
- propSwf[0] = 0x50;
- propSwf[1] = 0x4B;
- propSwf[2] = 0x03;
- propSwf[3] = 0x04;
- var pms = new MemoryStream();
- new ZipArchive(new MemoryStream(propSwf)).Entries[0].Open().CopyTo(pms);
- var propXml = Encoding.UTF8.GetString(pms.ToArray().Skip(3).ToArray());
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(propXml);
- int pageCount = doc.SelectNodes("/Properties/bookProperties/pages/elements/page").Count;
- byte[] fbSwf = wc.DownloadData(baseUrl + "flash/flippingbook.swf");
- Console.Write("*");
- var ms = new MemoryStream(fbSwf);
- var msInner = new MemoryStream();
- ms.Seek(10, SeekOrigin.Begin);
- var z = new DeflateStream(ms, CompressionMode.Decompress);
- z.CopyTo(msInner);
- msInner.Seek(0x7ED9B, SeekOrigin.Begin);
- byte[] keyRaw = new byte[32];
- msInner.Read(keyRaw, 0, 32);
- string key = Encoding.ASCII.GetString(keyRaw);
- int so = 8 + int.Parse(key.Substring(0, 2), NumberStyles.HexNumber) % 8;
- int sx = int.Parse(key.Substring(4, 2), NumberStyles.HexNumber);
- Directory.CreateDirectory("pages");
- for (int i = 1; i <= pageCount; i++)
- {
- var fileName = "page" + i.ToString("0000") + "_l.jpg";
- var filePath = "pages\\" + fileName;
- if (File.Exists(filePath))
- continue;
- byte[] v = wc.DownloadData(baseUrl + "assets/flash/pages/" + fileName);
- int a = so;
- int x = sx + 1;
- while (a < v.Length)
- {
- v[a] = (byte)(v[a] ^ x++);
- a = a + ((a ^ sx) & 3) + 1;
- }
- File.WriteAllBytes(filePath, v);
- Console.Write(".");
- }
- Console.WriteLine("Done");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement