1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| from __future__ import division
import pefile
import os
import collections
import math
res =0
nom = "C:\\FNI"
for i in os.listdir(nom):
score=0
current= os.path.join(nom,i)
print current
pe =pefile.PE(current)
if pe.OPTIONAL_HEADER.CheckSum == 0 :
score=score+0.12
if pe.OPTIONAL_HEADER.MajorImageVersion == 0 :
score=score+0.12
if pe.OPTIONAL_HEADER.ImageBase == 4194304 :
score=score+0.12
if pe.OPTIONAL_HEADER.DllCharacteristics == 0 :
score=score+0.11
if pe.OPTIONAL_HEADER.MinorImageVersion == 0:
score=score+0.11
if pe.OPTIONAL_HEADER.MinorOperatingSystemVersion== 0:
score=score+0.11
if pe.OPTIONAL_HEADER.SizeOfStackReserve == 1048576:
score=score+0.10
if pe.OPTIONAL_HEADER.MajorOperatingSystemVersion == 4:
score=score+0.07
if pe.OPTIONAL_HEADER.MajorLinkerVersion ==2:
score=score+0.07
if pe.OPTIONAL_HEADER.MinorLinkerVersion == 25:
score=score+0.07
if score > 0.6 :
res=res+1
print res |
Partager