Skip to content

Commit

Permalink
Fix for issue #6 (#43)
Browse files Browse the repository at this point in the history
* fix for issue #21, original order

* fix for issue #30 ALPN values

* fix for issue #16

* fix for issue #6

* update to check Cookie and Referer for all cases
  • Loading branch information
noeltimothy authored Jan 4, 2024
1 parent 86a5522 commit 96a9e7a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/ja4h.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ def http_language(lang):

def to_ja4h(x, debug_stream=-1):
cookie = 'c' if 'cookies' in x else 'n'
referer = 'r' if 'referer' in x['headers'] else 'n'
referer = 'r' if 'referer' in [ y.lower() for y in x['headers'] ] else 'n'
method = http_method(x['method'])
version = 11 if x['hl'] == 'http' else 20
unsorted_cookie_fields = []
unsorted_cookie_values = []

x['headers'] = [ h.split(':')[0] for h in x['headers'] ]
x['headers'] = [ h for h in x['headers'] if not h.startswith(':') and not h.startswith('cookie') and h != 'referer' and h ]
x['headers'] = [ h for h in x['headers']
if not h.startswith(':') and not h.lower().startswith('cookie')
and h.lower() != 'referer' and h ]

raw_headers = x['headers'][:]

Expand Down

0 comments on commit 96a9e7a

Please sign in to comment.