Skip to content

Commit

Permalink
Debugged absolute offset in ndb signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Zaddach committed Jul 20, 2017
1 parent 0993acd commit 305d953
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugin/casc_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
from casc.sigalyzer.clamav import AbsoluteOffset, EPRelativeOffset, \
AnyOffset, InSectionOffset, SectionRelativeOffset, \
EOFRelativeOffset
from ida_loader import get_fileregion_ea

sigalyzer_required_modules_loaded = True
except ImportError as err:
Expand Down Expand Up @@ -1422,7 +1423,7 @@ def _ea_to_yara_offset(self, ea):

def _file_offset_to_yara_offset(self, file_offset):
ea = get_fileregion_ea(file_offset)
if start_ea == BADADDR:
if ea == BADADDR:
raise RuntimeError("Cannot find ea for absolute file offset %d" % file_offset)
return self._ea_to_yara_offset(ea)

Expand All @@ -1433,7 +1434,7 @@ def _clamav_offset_to_yara(self, offset, rulename):
if offset.start == 0 and offset.end is None:
return "$%s" % rulename
elif offset.end is None:
return "$%s at %d" % (rulename, self._file_offset_to_yara_offset(offset.offset))
return "$%s at %d" % (rulename, self._file_offset_to_yara_offset(offset.start))
else:
start = self._file_offset_to_yara_offset(offset.offset)
end = self._file_offset_to_yara_offset(offset.offset + offset.shift)
Expand Down

0 comments on commit 305d953

Please sign in to comment.