My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 81: Code error in latest repo
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  anthony....@gmail.com
Closed:  Nov 2012


Sign in to add a comment
 
Reported by V.E.O.T...@gmail.com, Oct 19, 2012
In ./elsim/elsim/elsim_dalvik.py

class Method :
    def __init__(self, vm, vmx, m) :
        self.m = m
        self.vm = vm
        self.vmx = vmx
        self.mx = vmx.get_method( m )

        self.sort_h = []

        self.hash = {}
        self.sha256 = None

def add_attribute(self, func_meth, func_checksum_bb) :
        bb = {}
        bbhash = {}

        fm = func_meth( self.m, self.sim )

**self.sim has not been initialized.**

Fix?

def __init__(self, vm, vmx, m, sim) :
        self.m = m
        self.vm = vm
        self.vmx = vmx
        self.mx = vmx.get_method( m )
        self.sim = sim

        self.sort_h = []

        self.hash = {}
        self.sha256 = None

Oct 19, 2012
#1 V.E.O.T...@gmail.com
class CheckSumMeth :
    def __init__(self, m1, sim) :
        self.m1 = m1
        self.sim = sim
        self.buff = ""
        self.entropy = 0.0
        self.signature = None

        code = m1.m.get_code()

This is called in androguard/elsim/elsim/elsim_dalvik.py add_attribute:
  fm = func_meth( self.m, self.sim )
will raise exception.

is it code = m1.get_code() ?
Oct 19, 2012
#2 V.E.O.T...@gmail.com
class CheckSumBB :
    def __init__(self, basic_block, sim) :
        self.basic_block = basic_block
        self.buff = ""
        for i in self.basic_block.bb.get_instructions() :
            self.buff += dvm.clean_name_instruction( i )
            self.buff += dvm.static_operand_instruction( i )

        #self.hash = hashlib.sha256( self.buff + "%d%d" % (len(basic_block.childs), len(basic_block.fathers)) ).hexdigest()
        self.hash = hashlib.sha256( self.buff ).hexdigest()

    def get_buff(self) :
        return self.buff

    def get_hash(self) :
        return self.hash

def filter_checksum_bb_basic( basic_block, sim ) :
    return CheckSumBB( basic_block, sim )

filter_checksum_bb_basic is called in androguard/elsim/elsim/elsim_dalvik.py add_attribute:
  bb[ i.name ] = func_checksum_bb( i )

Arguments number seems incorrect?
and sim is never used in CheckSumBB, why not:

def filter_checksum_bb_basic( basic_block) :
    return CheckSumBB( basic_block)

class CheckSumBB :
    def __init__(self, basic_block) :
Nov 15, 2012
Project Member #3 anthony....@gmail.com
(No comment was entered for this change.)
Status: Fixed
Owner: anthony....@gmail.com
Sign in to add a comment

Powered by Google Project Hosting