antivirus_demo icon indicating copy to clipboard operation
antivirus_demo copied to clipboard

Syntax Error

Open Tominium opened this issue 4 years ago • 2 comments

When I run checkpe.py I get the syntax error File "checkpe.py", line 188, in <module> data = extract_infos(args.FILE) File "checkpe.py", line 108, in extract_infos res['SectionsMeanEntropy'] = sum(entropy)/float(len(entropy)) TypeError: object of type 'map' has no len()

I am a noob, so can someone help me fix this. Oh yeah and entropy = map(lambda x:x.get_entropy(), pe.sections)

Tominium avatar Jul 24 '20 16:07 Tominium

just put len(list(entropy)). this solves the issue of len. but its giving an error of giving division by zero error.

RishiGG avatar Feb 24 '21 18:02 RishiGG

The zero error is because the entropy variable is not getting generated correctly. You can change those lines to this : list_pe_sections = [] for i in pe.sections: list_pe_sections.append(i)

entropy = list(map(lambda x:x.get_entropy(), list_pe_sections)).

You will get similar errors at many places with the map function. Just put the map function in list(). Making these changes will remove the syntax errors, but the code is predicting legitimate files as Malicious. Still need to look into that.

Srilekha26 avatar Sep 26 '21 14:09 Srilekha26