summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2015-07-15 22:49:11 +1000
committerDamien Zammit <damien@zamaudio.com>2015-07-15 22:49:11 +1000
commit3dd7e1a8598bd5c7db3d1c75797f8aa69c854b26 (patch)
tree533be614f0e53cdea021580d8f2f038de7cadf26
Initial commit
-rw-r--r--10.ptfbin0 -> 17834 bytes
-rw-r--r--11.ptfbin0 -> 17834 bytes
-rw-r--r--12.ptfbin0 -> 17834 bytes
-rw-r--r--13.ptfbin0 -> 17834 bytes
-rw-r--r--14.ptfbin0 -> 17834 bytes
-rw-r--r--15.ptfbin0 -> 17834 bytes
-rw-r--r--16.ptfbin0 -> 17834 bytes
-rw-r--r--17.ptfbin0 -> 17834 bytes
-rw-r--r--18.ptfbin0 -> 17834 bytes
-rw-r--r--19.ptfbin0 -> 17834 bytes
-rw-r--r--20.ptfbin0 -> 17834 bytes
-rw-r--r--4.ptfbin0 -> 17832 bytes
-rw-r--r--5.ptfbin0 -> 17832 bytes
-rw-r--r--6.ptfbin0 -> 17832 bytes
-rw-r--r--7.ptfbin0 -> 17832 bytes
-rw-r--r--8.ptfbin0 -> 17832 bytes
-rw-r--r--9.ptfbin0 -> 17832 bytes
-rw-r--r--ptunxor.c329
18 files changed, 329 insertions, 0 deletions
diff --git a/10.ptf b/10.ptf
new file mode 100644
index 0000000..9763c7f
--- /dev/null
+++ b/10.ptf
Binary files differ
diff --git a/11.ptf b/11.ptf
new file mode 100644
index 0000000..b14fc1d
--- /dev/null
+++ b/11.ptf
Binary files differ
diff --git a/12.ptf b/12.ptf
new file mode 100644
index 0000000..eb9716e
--- /dev/null
+++ b/12.ptf
Binary files differ
diff --git a/13.ptf b/13.ptf
new file mode 100644
index 0000000..c5518b5
--- /dev/null
+++ b/13.ptf
Binary files differ
diff --git a/14.ptf b/14.ptf
new file mode 100644
index 0000000..cd541ca
--- /dev/null
+++ b/14.ptf
Binary files differ
diff --git a/15.ptf b/15.ptf
new file mode 100644
index 0000000..92e2593
--- /dev/null
+++ b/15.ptf
Binary files differ
diff --git a/16.ptf b/16.ptf
new file mode 100644
index 0000000..2a6e98a
--- /dev/null
+++ b/16.ptf
Binary files differ
diff --git a/17.ptf b/17.ptf
new file mode 100644
index 0000000..0d376fb
--- /dev/null
+++ b/17.ptf
Binary files differ
diff --git a/18.ptf b/18.ptf
new file mode 100644
index 0000000..7d0533d
--- /dev/null
+++ b/18.ptf
Binary files differ
diff --git a/19.ptf b/19.ptf
new file mode 100644
index 0000000..8702b90
--- /dev/null
+++ b/19.ptf
Binary files differ
diff --git a/20.ptf b/20.ptf
new file mode 100644
index 0000000..10529f1
--- /dev/null
+++ b/20.ptf
Binary files differ
diff --git a/4.ptf b/4.ptf
new file mode 100644
index 0000000..741467d
--- /dev/null
+++ b/4.ptf
Binary files differ
diff --git a/5.ptf b/5.ptf
new file mode 100644
index 0000000..64ec7c8
--- /dev/null
+++ b/5.ptf
Binary files differ
diff --git a/6.ptf b/6.ptf
new file mode 100644
index 0000000..ccdff40
--- /dev/null
+++ b/6.ptf
Binary files differ
diff --git a/7.ptf b/7.ptf
new file mode 100644
index 0000000..a7f5428
--- /dev/null
+++ b/7.ptf
Binary files differ
diff --git a/8.ptf b/8.ptf
new file mode 100644
index 0000000..306ccc7
--- /dev/null
+++ b/8.ptf
Binary files differ
diff --git a/9.ptf b/9.ptf
new file mode 100644
index 0000000..58cd6aa
--- /dev/null
+++ b/9.ptf
Binary files differ
diff --git a/ptunxor.c b/ptunxor.c
new file mode 100644
index 0000000..bc41618
--- /dev/null
+++ b/ptunxor.c
@@ -0,0 +1,329 @@
+#include <stdio.h>
+#include <inttypes.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv) {
+ FILE *fp;
+ unsigned char c0;
+ unsigned char c1;
+ unsigned char xor[256];
+ unsigned char ct;
+ unsigned char px;
+ unsigned char lutseenwild[16] = {
+ 1, 1, 1, 0, 1, 1, 1, 1,
+ 0, 0, 0, 1, 0, 1, 0, 0,
+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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 3,
+ 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+
+ },
+ /* e */ {},
+ /* f */ {}
+ };
+
+ uint16_t i;
+ int j;
+ int li;
+ int len;
+ unsigned char message;
+ int blocks;
+ int bl;
+
+ fp = fopen(argv[1], "rb");
+ fseek(fp, 0, SEEK_END);
+ len = ftell(fp);
+ fseek(fp, 0x40, SEEK_SET);
+ fread(&c0, 1, 1, fp);
+ fread(&c1, 1, 1, fp);
+ i = 2;
+
+ fseek(fp, 0x0, SEEK_SET);
+
+ switch (c0) {
+ case 0x00:
+ fprintf(stderr, "Success! easy one\n");
+ xor[0] = c0;
+ xor[1] = c1;
+ for (i = 2; i < 64; i++) {
+ xor[i] = (xor[i-1] + c1 - c0) & 0xff;
+ }
+
+ px = xor[0];
+ fread(&ct, 1, 1, fp);
+ message = px ^ ct;
+ printf("%c", message);
+
+ px = xor[1];
+ fread(&ct, 1, 1, fp);
+ message = px ^ ct;
+ printf("%c", message);
+
+ i = 2;
+ while (fread(&ct, 1, 1, fp) != 0) {
+ if (i%64 == 0) {
+ i = 0;
+ }
+ message = xor[i] ^ ct;
+ printf("%c", message);
+ i++;
+ }
+ break;
+ case 0x80:
+ fprintf(stderr, "Success! easy two\n");
+ xor[0] = c0;
+ xor[1] = c1;
+ for (i = 2; i < 256; i++) {
+ if (i%64 == 0) {
+ xor[i] = c0;
+ } else {
+ xor[i] = ((xor[i-1] + c1 - c0) & 0xff);
+ }
+ }
+
+ for (i = 0; i < 64; i++) {
+ xor[i] ^= 0x80;
+ }
+ for (i = 128; i < 192; i++) {
+ xor[i] ^= 0x80;
+ }
+
+ px = xor[0];
+ fread(&ct, 1, 1, fp);
+ message = px ^ ct;
+ printf("%c", message);
+
+ px = xor[1];
+ fread(&ct, 1, 1, fp);
+ message = px ^ ct;
+ printf("%c", message);
+
+ i = 2;
+ while (fread(&ct, 1, 1, fp) != 0) {
+ if (i%256 == 0) {
+ i = 0;
+ }
+ message = xor[i] ^ ct;
+ printf("%c", message);
+ i++;
+ }
+ break;
+
+ case 0x40:
+ case 0xc0:
+ li = (((c1 & 0xf0) >> 4) + (c1 & 0x0f)) & 0xf;
+ if (lutvalid[li]) {
+ fprintf(stderr, "Success! Found lookup table 0x%x\n", li);
+ } else {
+ fprintf(stderr, "Can't find lookup table for c1=%x 0x%x\n", c1, li);
+ }
+ xor[0] = c0;
+ xor[1] = c1;
+ for (i = 2; i < 256; i++) {
+ if (i%64 == 0) {
+ xor[i] = c0;
+ } else {
+ xor[i] = ((xor[i-1] + c1 - c0) & 0xff);
+ }
+ }
+
+ for (i = 0; i < 256; i++) {
+ xor[i] ^= (lut[li][i] * 0x40);
+ }
+
+ px = xor[0];
+ fread(&ct, 1, 1, fp);
+ message = px ^ ct;
+ printf("%c", message);
+
+ px = xor[1];
+ fread(&ct, 1, 1, fp);
+ message = px ^ ct;
+ printf("%c", message);
+
+ i = 2;
+ while (fread(&ct, 1, 1, fp) != 0) {
+ if (i%256 == 0) {
+ i = 0;
+ }
+ message = xor[i] ^ ct;
+ printf("%c", message);
+ i++;
+ }
+ break;
+ default:
+ fprintf(stderr, "Failed c[0] c[1]: %02x %02x\n", c0, c1);
+ }
+
+ fclose(fp);
+ return 0;
+}
+
+