From 7a9e76a8bf449f1c7bd8699acc714c9929b13f94 Mon Sep 17 00:00:00 2001 From: Yun Zheng Hu Date: Fri, 17 Dec 2021 08:44:24 +0100 Subject: [PATCH] Don't use zipfile.Path to remain compatible with Python 3.6 --- log4j-finder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/log4j-finder.py b/log4j-finder.py index 9fd5aa8..572a09f 100755 --- a/log4j-finder.py +++ b/log4j-finder.py @@ -322,7 +322,10 @@ def main(): lookup_path = str( zpath.parent.parent / "lookup/JndiLookup.class" ) - has_lookup = zipfile.Path(zfile, lookup_path).exists() + try: + has_lookup = zfile.open(lookup_path) + except KeyError: + has_lookup = False check_vulnerable(zf, parents + [zpath], stats, has_lookup) except IOError as e: log.debug(f"{p}: {e}")