Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working on Python 3.7 #18

Closed
art3mHQ opened this issue Feb 24, 2019 · 3 comments
Closed

not working on Python 3.7 #18

art3mHQ opened this issue Feb 24, 2019 · 3 comments

Comments

@art3mHQ
Copy link

art3mHQ commented Feb 24, 2019

Not working properly on Python 3.7
even with this patch #16

eg:
art3mk@akmac:xortool$ xortool encryptedtext -l 24 -c 20
2 possible key(s) of length 24:
\n\x0c\x1a\x1e\x11\x10\x11\x06\x12\x16\x05\x1a\r\x0c\x16\x0c\r\x16\x18\x17\x0b\x08\x1e\x06
\n\x0c\x1a\x1e\x11\x10\x11\x06\x12\x16\x05\x1a\r\x0c\x16\x0c\r\x16\x18\x17\x0b2\x1e\x06
Traceback (most recent call last):
File "/usr/local/bin/xortool", line 381, in
main()
File "/usr/local/bin/xortool", line 71, in main
produce_plaintexts(ciphertext, probable_keys, key_char_used)
File "/usr/local/bin/xortool", line 349, in produce_plaintexts
key_repr = alphanum(key)
File "/usr/local/lib/python3.7/site-packages/xortool/routine.py", line 95, in alphanum
if char in (string.letters + string.digits):
AttributeError: module 'string' has no attribute 'letters'

after changing "letters" to "ascii_letters"

art3mk@akmac:xortool$ xortool encryptedtext -l 24 -c 20
2 possible key(s) of length 24:
\n\x0c\x1a\x1e\x11\x10\x11\x06\x12\x16\x05\x1a\r\x0c\x16\x0c\r\x16\x18\x17\x0b\x08\x1e\x06
\n\x0c\x1a\x1e\x11\x10\x11\x06\x12\x16\x05\x1a\r\x0c\x16\x0c\r\x16\x18\x17\x0b2\x1e\x06
Traceback (most recent call last):
File "/usr/local/bin/xortool", line 381, in
main()
File "/usr/local/bin/xortool", line 71, in main
produce_plaintexts(ciphertext, probable_keys, key_char_used)
File "/usr/local/bin/xortool", line 349, in produce_plaintexts
key_repr = alphanum(key)
File "/usr/local/lib/python3.7/site-packages/xortool/routine.py", line 97, in alphanum
lst[index] = char.encode("hex")
LookupError: 'hex' is not a text encoding; use codecs.encode() to handle arbitrary codecs

xortool_out folder files are empty (just headers in there)

@noraj
Copy link

noraj commented Mar 8, 2019

I takes a file not a string in argument.

xortool -h
xortool
  A tool to do some xor analysis:
  - guess the key length (based on count of equal chars)
  - guess the key (base on knowledge of most frequent char)

Usage:
  xortool [-x] [-m MAX-LEN] [FILE]
  xortool [-x] [-l LEN] [-c CHAR | -b | -o] [FILE]
  xortool [-x] [-m MAX-LEN| -l LEN] [-c CHAR | -b | -o] [FILE]
  xortool [-h | --help]
  xortool --version

Options:
  -x --hex                          input is hex-encoded str
  -l LEN, --key-length=LEN          length of the key
  -m MAX-LEN, --max-keylen=MAX-LEN  maximum key length to probe [default: 65]
  -c CHAR, --char=CHAR              most frequent char (one char or hex code)
  -b --brute-chars                  brute force all possible most frequent chars
  -o --brute-printable              same as -b but will only check printable chars
  -h --help                         show this help

Examples:
  xortool file.bin
  xortool -l 11 -c 20 file.bin
  xortool -x -c ' ' file.hex

@maage
Copy link

maage commented Sep 18, 2019

Also #26 fixes this issue.

@hellman
Copy link
Owner

hellman commented Oct 25, 2019

I think should work now on master (not on PyPI yet)

@hellman hellman closed this as completed Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants