Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fobj += ' {:4}{:<16} {}\n'.format('', "Size", self.filesize)
fobj += ' {:4}{:<16} {}\n\n'.format('', "First Bytes", self.getbytestring(0, 16))
fobj += ' Hashes\n'
fobj += ' {:4}{:<16} {}\n'.format('', "MD5", self.gethash('md5'))
fobj += ' {:4}{:<16} {}\n'.format('', "SHA1", self.gethash('sha1'))
fobj += ' {:4}{:<16} {}\n'.format('', "SHA256", self.gethash('sha256'))
fobj += ' {:4}{:<16} {}\n'.format('', "Import Hash", self.getimphash())
fobj += ' {:4}{:<16} {}\n\n'.format('', "ssdeep", self.getfuzzyhash())
fobj += ' Headers\n'
if self.pe is not None:
for str_key in self.metadata:
fobj += ' {:4}{:<16} {}\n'.format('', str_key, self.metadata[str_key])
fobj += ' {:4}{:<16} {}\n'.format('', "PDB Path", self.get_pdb_path())
iflags = pefile.retrieve_flags(pefile.IMAGE_CHARACTERISTICS, 'IMAGE_FILE_')
fobj += ' {:4}{:<16} \n'.format('', "Characteristics")
for flag in iflags:
if getattr(self.pe.FILE_HEADER, flag[0]):
fobj += " {:20s} {:<20s}\n".format('', str(flag[0]))
return fobj