From 4565995be748a661ffc7e2b14ed37ff32b9fa3fa Mon Sep 17 00:00:00 2001 From: Timothy Noel Date: Wed, 11 Oct 2023 16:05:44 -0400 Subject: [PATCH] fix for incorrect alpn in ja4s. Issue #11 --- python/ja4.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/ja4.py b/python/ja4.py index 81b778e..76a5ccd 100644 --- a/python/ja4.py +++ b/python/ja4.py @@ -186,8 +186,11 @@ def to_ja4s(x, debug_stream): alpn = '00' if 'alpn' in x: alpn = x['alpn'] - elif 'alpn_list' in x and isinstance(x['alpn_list'], list): - alpn = x['alpn_list'][0] + elif 'alpn_list' in x: + if isinstance(x['alpn_list'], list): + alpn = x['alpn_list'][0] + else: + alpn = x['alpn_list'] x['JA4S'] = f"{ptype}{version}{ext_len}{alpn}_{x['ciphers']}_{extensions}" x['JA4S_r'] = f"{ptype}{version}{ext_len}{alpn}_{x['ciphers']}_{','.join(x['extensions'])}"