4elta / recon

automate the boring stuff!
GNU General Public License v3.0
8 stars 3 forks source link

Analyzer testssl exception on Python 3.11.6 #74

Closed Yuuichi89 closed 12 months ago

Yuuichi89 commented 12 months ago

The testssl tls analyzer is creating an exception with newer python3 versions:

> Traceback (most recent call last):
  File "/home/vowe/tools/recon/analyze.py", line 281, in <module>
    main()
  File "/home/vowe/tools/recon/analyze.py", line 278, in main
    process(parser.parse_args())
  File "/home/vowe/tools/recon/analyze.py", line 209, in process
    analyze_service(
  File "/home/vowe/tools/recon/analyze.py", line 64, in analyze_service
    services = analyzer.analyze(files)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vowe/tools/recon/analyzers/tls/__init__.py", line 97, in analyze
    services = self.parser.parse_files(files[self.parser_name])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vowe/tools/recon/analyzers/__init__.py", line 75, in parse_files
    self.parse_file(path)
  File "/home/vowe/tools/recon/analyzers/tls/testssl.py", line 97, in parse_file
    self._parse_public_key(
  File "/home/vowe/tools/recon/analyzers/tls/testssl.py", line 268, in _parse_public_key
    key_type, key_bits, _ = description.split(' ')
    ^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 3)

when description is something like =

RSA 4096 bits (exponent is 65537)

a possible solution seems to be changing line 268 in testssl.py from: key_type, key_bits, _ = description.split(' ') to something like key_type, key_bits, *_ = description.split(' ') so it catches more than 3 values.

Yuuichi89 commented 12 months ago

This happens when using "Develop" Branch

4elta commented 12 months ago

thank you for catching this bug and also for providing a fix for it :pray:

Yuuichi89 commented 12 months ago

Works like a charm. :)