Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. >>> import binaryninja
  2. >>> bv = binaryninja.BinaryViewType["Mach-O"].open("/bin/ls")
  3. >>> bv.update_analysis_and_wait()
  4. >>> t = bv.parse_type_string("int (*lol)(int one, void* two, size_t three)")
  5. >>> t
  6. (<type: int32_t (*)(int32_t one, void* two, uint64_t three)>, 'lol')
  7. >>> ti = t[0]
  8. >>> dir(ti)
  9. ['__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'alignment', 'array', 'bool', 'calling_convention', 'can_return', 'const', 'count', 'element_type', 'enumeration', 'enumeration_type', 'float', 'function', 'get_string_after_name', 'get_string_before_name', 'handle', 'has_variable_arguments', 'int', 'modified', 'parameters', 'pointer', 'return_value', 'signed', 'structure', 'structure_type', 'target', 'type_class', 'unknown_type', 'void', 'width']
  10. >>> ti.return_value
  11. <type: int32_t ( )(int32_t one, void* two, uint64_t three)>
  12. >>> ti.element_type
  13. <type: int32_t ( )(int32_t one, void* two, uint64_t three)>
  14. >>> ti.type_class
  15. 'PointerTypeClass'
  16. >>> ti.return_value
  17. <type: int32_t ( )(int32_t one, void* two, uint64_t three)>
  18. >>> tip = ti.return_value
  19. >>> tip.type_class
  20. 'FunctionTypeClass'
  21. >>> tip.parameters
  22. [(<type: int32_t>, 'one'), (<type: void*>, 'two'), (<type: uint64_t>, 'three')]
  23. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement