Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed some small bugs. Thanks to STATE OF CHAOS.

  • Loading branch information...
commit ae2173b44b4574f2c8c1ebc3227f1292b58a7581 1 parent ce9c09a
@hellman authored
Showing with 18 additions and 6 deletions.
  1. +11 −3 README.md
  2. +1 −1  routine.py
  3. +6 −2 xortool.py
View
14 README.md
@@ -48,10 +48,10 @@ tests $ python ../xortool.py binary_xored -l 10 -c 00
1 possible key(s) of length 10:
secret_key
-# decrypted ciphertexts are placed in ./xortool/Number_<key repr>
+# decrypted ciphertexts are placed in ./xortool_out/Number_<key repr>
# ( have no better idea )
-tests $ md5sum xortool/0_secret_key /bin/ls
-29942e290876703169e1b614d0b4340a xortool/0_secret_key
+tests $ md5sum xortool_out/0_secret_key /bin/ls
+29942e290876703169e1b614d0b4340a xortool_out/0_secret_key
29942e290876703169e1b614d0b4340a /bin/ls
</pre>
@@ -77,6 +77,8 @@ Key-length can be 5*n
an0ther s3cret \xdd key
</pre>
+Here, the key is longer then default 32 limit:
+
<pre>
tests $ xortool ls_xored -c 00 -m 64
Probable key lengths:
@@ -107,6 +109,12 @@ Key-length can be 3*n
really long s3cr3t k3y... PADDING
</pre>
+So, if automated decryption fails, you can calibrate:
+
+- (-m) max length to try longer keys
+- (-l) selected length to see some interesting keys
+- (-c) the most frequent char to produce right plaintext
+
Author: hellman ( hellman1908@gmail.com )
License: GNU General Public License v2 (http://opensource.org/licenses/gpl-2.0.php)
View
2  routine.py
@@ -45,7 +45,7 @@ def rmdir(dirname):
continue
path = dirname + os.sep + f
if os.path.isdir(path):
- cleardir(path)
+ rmdir(path)
else:
os.unlink(path)
os.rmdir(dirname)
View
8 xortool.py
@@ -26,7 +26,7 @@
from routine import *
from args import parse_parameters, ArgError
-DIRNAME = 'xortool' # here plaintexts will be placed
+DIRNAME = 'xortool_out' # here plaintexts will be placed
PARAMETERS = dict()
def main():
@@ -150,11 +150,15 @@ def guess_and_print_divizors(fitnesses):
divizors_counts[number] += 1
max_divizors = max(divizors_counts)
+ limit = 3
ret = 2
for number, divizors_count in enumerate(divizors_counts):
if divizors_count == max_divizors:
print "Key-length can be " + str(number) + "*n"
ret = number
+ limit -= 1
+ if limit == 0:
+ return ret
return ret
@@ -251,7 +255,7 @@ def produce_plaintexts(ciphertext, keys):
key_repr = repr(key)[1:-1].replace("/", "\\x2f")
if not is_linux():
key_repr = alphanum(key)
- file_name = os.path.join("xortool", key_index + "_" + key_repr)
+ file_name = os.path.join(DIRNAME, key_index + "_" + key_repr)
f = open(file_name, "wb")
f.write(dexor(ciphertext, key))
f.close()
Please sign in to comment.
Something went wrong with that request. Please try again.