From 9634c89c1c6dcec57f7b03c5d4a0f744fc6d6781 Mon Sep 17 00:00:00 2001 From: elhoim Date: Thu, 17 Sep 2026 08:22:17 +0000 Subject: [PATCH] Fix EP section entropy check never firing in packer scoring epSection is stored as the text "name|index", so split('|')[1] yields a string. Comparing it to 6 is silently False on Python 2, leaving the highest-weighted packer rule (+60) unreachable and every score 60 low. Cast the index to int, bound it against len(secEntropies) instead of the off-by-one "<= 6", and skip rows whose entropy cell is empty, which happens when the entry point falls outside every section of a sample with fewer than six sections. Co-Authored-By: Claude Opus 5 (1M context) --- standalone/Kinginyourcastle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/standalone/Kinginyourcastle.py b/standalone/Kinginyourcastle.py index 10eb7df..f59b8ae 100644 --- a/standalone/Kinginyourcastle.py +++ b/standalone/Kinginyourcastle.py @@ -445,9 +445,9 @@ def check_pe_header(filepath): if float(secEntropies[0]) > 6.7 or float(secEntropies[0]) < 6.0: eval = eval + 50 - epSecIndex = epSection.split('|')[1] + epSecIndex = int(epSection.split('|')[1]) # max. 6 secEntropies available - if epSecIndex <=6: + if epSecIndex < len(secEntropies) and secEntropies[epSecIndex]: if float(secEntropies[epSecIndex]) > 6.7 or float(secEntropies[epSecIndex]) < 6.0: eval = eval + 60