Пример #1
0
    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()
Пример #2
0
    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()
Пример #3
0
    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
Пример #4
0
    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
Пример #5
0
    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)
Пример #6
0
    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 )
Пример #7
0
    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
Пример #8
0
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
Пример #9
0
    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
Пример #10
0
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