prbinu / tls-scan

An Internet scale, blazing fast SSL/TLS scanner ( non-blocking, event-driven )
https://prbinu.github.io/tls-scan
Other
283 stars 54 forks source link

Missing certificate chain and invalid JSON is produced with a dangling comma #58

Open manuelbua opened 1 year ago

manuelbua commented 1 year ago

I encountered an error while parsing the JSON produced by tls-scan and pinpointed it to a case where the certificate chain is missing from the JSON output and a dangling comma is left before closing the JSON object.

{ "host": "18.236.255.249", "ip": "18.236.255.249", "port": 443, "elapsedTime": 571, "tlsVersion": "TLSv1.2", "cipher": "ADH-AES256-SHA          SSLv3 Kx=DH       Au=None Enc=AES(256)  Mac=SHA1", "tempPublicKeyAlg": "DH", "tempPublicKeySize": 2048, "secureRenego": true, "compression": "NONE", "expansion": "NONE", "sessionLifetimeHint": 300, "x509ChainDepth": -1, "verifyCertResult": true, "verifyHostResult": false, "ocspStapled": false, }

To reproduce what i'm seeing you can try the following:

echo '18.236.255.249' | tls-scan | jq
parse error: Expected another key-value pair at line 1, column 441
prbinu commented 1 year ago

Thanks for reporting this issue. This host appears to be unreachable.

ping 18.236.255.249 
PING 18.236.255.249 (18.236.255.249): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
^C
--- 18.236.255.249 ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss

Based on my quick analysis of your scan output, it appears that the output is incomplete. That could be the issue. It might a good idea to find the reason behind it.