1
2
3
4
5
6
7
8
9
10
11
import pefile

def is_packed(pe):
    entropy_threshold = 7.0
    for section in pe.sections:
        if section.get_entropy() > entropy_threshold:
            return True
    return False

pe = pefile.PE("sample.exe")
print("Likely Packed" if is_packed(pe) else "Not Packed")