4elta / recon

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

Analyzer: Ike Analyzer fails if no keylength is presented in output #80

Closed ikstream closed 11 months ago

ikstream commented 11 months ago

If the ike-scan tool returns some output that does not include a KeyLengthvalue, the isakmp analyzer fails with a TypeError exception

Traceback (most recent call last):
  File "/usr/local/bin/analyze", line 281, in <module>
    main()
  File "/usr/local/bin/analyze", line 278, in main
    process(parser.parse_args())
  File "/usr/local/bin/analyze", line 209, in process
    analyze_service(
  File "/usr/local/bin/analyze", line 64, in analyze_service
    services = analyzer.analyze(files)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/tools/recon/analyzers/isakmp/__init__.py", line 38, in analyze
    services = self.parser.parse_files(files[self.parser_name])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/tools/recon/analyzers/__init__.py", line 76, in parse_files
    self.parse_file(path)
  File "/home/kali/tools/recon/analyzers/isakmp/ike.py", line 119, in parse_file
    key_length = int(m.group('key_length'))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

An example output can be seen below.

ike-scan --sport=500 --trans=5,2,1,2 --dport=500 10.10.10.2

Starting ike-scan 1.9.5 with 1 hosts (http://www.nta-monitor.com/tools/ike-scan/)
10.10.10.2  Main Mode Handshake returned HDR=(CKY-R=foobar) SA=(Enc=3DES Hash=SHA1 Group=2:modp1024 Auth=PSK LifeType=Seconds LifeDuration=28800) VID=lame-number (Boring-15)
4elta commented 11 months ago

thanks for bringing this up :pray:

ikstream commented 11 months ago

I can confirm, it's fixed for me. Thanks for the quick fix.