From e36c2f364fd059e3fe5225b2d475369dd266d973 Mon Sep 17 00:00:00 2001 From: Ivan Gotovchits Date: Thu, 22 Sep 2016 18:51:39 -0400 Subject: [PATCH 1/3] bumped version. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4bffee5..d8c868d 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup ( name = 'bap', - version = '1.0.0', + version = '1.1.0', description = 'Python bindings to Binary Analysis Platform (BAP)', author = 'BAP Team', url = 'https://github.com/BinaryAnalysisPlatform/bap-python', From aadd38802cf0716dadd88565716eeb0c23c1e199 Mon Sep 17 00:00:00 2001 From: Ivan Gotovchits Date: Thu, 24 Aug 2017 14:42:58 -0400 Subject: [PATCH 2/3] fixes the Tid search not tested yet. --- src/bap/adt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bap/adt.py b/src/bap/adt.py index ffb83fa..022d3da 100755 --- a/src/bap/adt.py +++ b/src/bap/adt.py @@ -490,7 +490,8 @@ def by_addr(t,key) : test = by_addr if isinstance(key,str): test = by_name - elif isinstance(key,Tid): + elif hasattr(key,id): + key = key.id test = by_id elif isinstance(key,Int): key = key.value From 09175500151d424f0c42e4000e3aeb41cf33fb9d Mon Sep 17 00:00:00 2001 From: Ivan Gotovchits Date: Fri, 15 Sep 2017 15:39:34 -0400 Subject: [PATCH 3/3] fixes the sequence search operation the operation was overloaded by the type of the key, however once the sequence class has been moved from the BIR module to the ADT module everything went wrong, since the type names were no longer available. The new implementation relies on the `constr` attribute to determine the constructor name. fixes [BinaryAnalysisPlatform/bap#699]. --- src/bap/adt.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/bap/adt.py b/src/bap/adt.py index 022d3da..bb9311f 100755 --- a/src/bap/adt.py +++ b/src/bap/adt.py @@ -462,8 +462,8 @@ def find(self,key, d=None) : If a key is an instance of Tid class, then a term with corresponding tid is returned. - If a key is a number, or an instance of `bil.Int' class, then - a term with a matching address is returned. + If a key is a number, or an instance of `bil.Int' class or is + an integer, then a term with a matching address is returned. Example ------- @@ -475,14 +475,15 @@ def find(self,key, d=None) : >>> main = proj.program.subs.find('main') >>> main = proj.program.subs.find(main.id) >>> main = proj.program.subs.find(main.id.name) + """ - def by_id(t,key) : return t.id == key - def by_name(t,key) : - if key.startswith(('@','%')): - return t.id.name == key + def by_id(t, k) : return t.id.number == k + def by_name(t,k) : + if k.startswith(('@','%')): + return t.id.name == k else: - return hasattr(t,'name') and t.name == key - def by_addr(t,key) : + return hasattr(t, 'name') and t.name == k + def by_addr(t,k) : value = t.attrs.get('address', None) if value is not None: return parse_addr(value) == key @@ -490,10 +491,10 @@ def by_addr(t,key) : test = by_addr if isinstance(key,str): test = by_name - elif hasattr(key,id): - key = key.id + elif hasattr(key,'constr') and key.constr == 'Tid': + key = key.number test = by_id - elif isinstance(key,Int): + elif hasattr(key,'constr') and key.constr == 'Int': key = key.value test = by_addr