llSourcell / antivirus_demo

Antivirus Demo for Fresh Machine Learning #7
MIT License
108 stars 89 forks source link

Syntax Error #12

Open Tominium opened 4 years ago

Tominium commented 4 years ago

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)

RishiGG commented 3 years ago

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

Srilekha26 commented 3 years ago

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.