summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2021-02-26 22:07:50 -0500
committerGlenn Smith <glenn@vector35.com>2021-07-01 00:06:45 -0400
commit78f177679cfacfcfb4f9ff542cb20a04914aed1f (patch)
treefa90f64155adebba15bb7130e7583e51e73092cf
parenteb1b1db886babc038fb00985718f5869afb44c19 (diff)
Expose Tag::GetId
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--binaryview.cpp9
-rw-r--r--python/binaryview.py4
4 files changed, 15 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 65a79fcd..629f4ea8 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1327,6 +1327,7 @@ __attribute__ ((format (printf, 1, 2)))
Tag(BNTag* tag);
Tag(Ref<TagType> type, const std::string& data = "");
+ std::string GetId() const;
Ref<TagType> GetType() const;
std::string GetData() const;
void SetData(const std::string& data);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 0f0743fb..65f86aa9 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -3738,6 +3738,7 @@ __attribute__ ((format (printf, 1, 2)))
BINARYNINJACOREAPI BNTag* BNNewTagReference(BNTag* tag);
BINARYNINJACOREAPI void BNFreeTag(BNTag* tag);
BINARYNINJACOREAPI void BNFreeTagList(BNTag** tags, size_t count);
+ BINARYNINJACOREAPI char* BNTagGetId(BNTag* tag);
BINARYNINJACOREAPI BNTagType* BNTagGetType(BNTag* tag);
BINARYNINJACOREAPI char* BNTagGetData(BNTag* tag);
BINARYNINJACOREAPI void BNTagSetData(BNTag* tag, const char* data);
diff --git a/binaryview.cpp b/binaryview.cpp
index 63e73ad1..657a5cd7 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -468,6 +468,15 @@ Tag::Tag(Ref<TagType> type, const std::string& data)
}
+std::string Tag::GetId() const
+{
+ char* id = BNTagGetId(m_object);
+ std::string result = id;
+ BNFreeString(id);
+ return result;
+}
+
+
Ref<TagType> Tag::GetType() const
{
return new TagType(BNTagGetType(m_object));
diff --git a/python/binaryview.py b/python/binaryview.py
index 9dd321c1..29ecced8 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -1307,6 +1307,10 @@ class Tag(object):
return hash(ctypes.addressof(self.handle.contents))
@property
+ def id(self):
+ return core.BNTagGetId(self.handle)
+
+ @property
def type(self):
return TagType(core.BNTagGetType(self.handle))