def __init__(self, basic_block): self.basic_block = basic_block self.buff = "" for i in self.basic_block.ins: 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 __init__(self, basic_block) : self.basic_block = basic_block self.buff = "" for i in self.basic_block.ins : 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_hex(self, analysis_method) : code = analysis_method.get_method().get_code() if code == None : return "" buff = "" for i in code.get_bc().get_instructions() : buff += dvm.clean_name_instruction( i ) buff += dvm.static_operand_instruction( i ) return buff
def _get_hex(self, analysis_method): code = analysis_method.get_method().get_code() if code == None: return "" buff = "" for i in code.get_bc().get_instructions(): buff += dvm.clean_name_instruction(i) buff += dvm.static_operand_instruction(i) return buff
def __init__(self, m1, sim): self.buff = "" self.entropy = 0.0 code = m1.get_code() if code != None: bc = code.get_bc() for i in bc.get(): self.buff += dvm.clean_name_instruction(i) self.buff += dvm.static_operand_instruction(i) self.entropy = sim.entropy(self.buff)
def __init__(self, m1, sim) : self.buff = "" self.entropy = 0.0 code = m1.get_code() if code != None : bc = code.get_bc() for i in bc.get() : self.buff += dvm.clean_name_instruction( i ) self.buff += dvm.static_operand_instruction( i ) self.entropy = sim.entropy( self.buff )
def _get_hex(self, analysis_method): code = analysis_method.get_method().get_code() if code == None: return "" buff = "" for i in code.get_bc().get(): buff += dvm.clean_name_instruction(i) buff += dvm.static_operand_instruction(i) #raw = code.get_bc().get_raw() #buff = "" #for i in raw : # buff += "%02x" % ord(i) return buff
def toString(bb, hS, rS): S = "" for i in bb.ins: ident = dvm.clean_name_instruction(i) ident += dvm.static_operand_instruction(i) # print i.get_name(), i.get_operands() if ident not in hS: hS[ident] = len(hS) rS[chr(hS[ident])] = ident S += chr(hS[ident]) return S
def _get_hex(self, analysis_method) : code = analysis_method.get_method().get_code() if code == None : return "" buff = "" for i in code.get_bc().get() : buff += dvm.clean_name_instruction( i ) buff += dvm.static_operand_instruction( i ) #raw = code.get_bc().get_raw() #buff = "" #for i in raw : # buff += "%02x" % ord(i) return buff
def toString( bb, hS, rS ) : S = "" for i in bb.ins : ident = dvm.clean_name_instruction( i ) ident += dvm.static_operand_instruction( i ) # print i.get_name(), i.get_operands() if ident not in hS : hS[ ident ] = len(hS) rS[ chr( hS[ ident ] ) ] = ident S += chr( hS[ ident ] ) return S