aboutsummaryrefslogtreecommitdiff
path: root/bin/keyCalculator.py
diff options
context:
space:
mode:
authorn0p <0x90@n0p.cc>2014-10-27 19:07:43 +0100
committern0p <0x90@n0p.cc>2014-10-27 19:07:43 +0100
commit0bcd78be9657f35dd27a02c16cb70234b1e44d5b (patch)
tree4f1eb291ab604beaac47f011bcec6b53fc300a2d /bin/keyCalculator.py
downloadJonahHex-0bcd78be9657f35dd27a02c16cb70234b1e44d5b.tar.gz
JonahHex-0bcd78be9657f35dd27a02c16cb70234b1e44d5b.zip
Reversing challenge 300 from hack.lu 2014.
Diffstat (limited to 'bin/keyCalculator.py')
-rw-r--r--bin/keyCalculator.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/keyCalculator.py b/bin/keyCalculator.py
new file mode 100644
index 0000000..9b96700
--- /dev/null
+++ b/bin/keyCalculator.py
@@ -0,0 +1,16 @@
+import pefile
+
+pe = pefile.PE("JonahHex.exe")
+
+ccCount = 0
+text_section = pe.get_data(pe.sections[0].VirtualAddress, pe.sections[0].Misc_VirtualSize)
+
+for byte in text_section:
+ if byte == '\xCC':
+ ccCount += 1
+ if ccCount % 22 == 0:
+ ccCount *= ccCount + 42
+ ccCount %= 0x100
+
+print "AddressOfEntryPoint: " + hex(pe.OPTIONAL_HEADER.AddressOfEntryPoint)
+print "DES key: " + 8*hex(ccCount)[2:] \ No newline at end of file