Though not as popular as functions and lines, IDA segments include both. In Sark,
objects allow access to underlying
>>> # >>> # Reference Lister >>> # >>> # List all functions and all references to them in the current section. >>> # >>> # Implemented with Sark >>> # >>> # See reference implementation here: https://code.google.com/p/idapython/wiki/ExampleScripts >>> # >>> for function in sark.Segment().functions: >>> print("Function %s at 0x%x" % (function.name, function.ea)) >>> for ref in function.crefs_to: >>> print(" called from %s(0x%x)" % (sark.Function(ref).name, ref))
sark.Line objects, they encapsulate relevant API into a
single object. Some useful members are:
All similarly named members between
work similarly as well to avoid confusion.
There are 2 ways to get segments:
- Using the
sark.Segmentobject, using an address in a segment, a segment name, or the index of a segment.
sark.segmentsto iterate over segments.