antivirus_demo
antivirus_demo copied to clipboard
Syntax Error
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)
just put len(list(entropy)). this solves the issue of len. but its giving an error of giving division by zero error.
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.