How to use the bytecode.SV function in bytecode

To help you get started, we’ve selected a few bytecode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github androguard / androguard / core / bytecodes / jvm.py View on Github external
def __init__(self, cm, buff) :
        # u2 type_index;
        # u2 num_element_value_pairs;
        # {     u2 element_name_index;
        #        element_value value;
        # }     element_value_pairs[num_element_value_pairs]
        self.type_index = SV( '>H', buff.read(2) )
        self.num_element_value_pairs = SV( '>H', buff.read(2) )

        self.element_value_pairs = []

        for i in range(0, self.num_element_value_pairs.get_value()) :
            self.element_value_pairs.append( ElementValuePair(cm, buff) )
github androguard / androguard / core / bytecodes / jvm.py View on Github external
def __init__(self, class_manager, buff) :
        self.__CM = class_manager

        super(InnerClassesAttribute, self).__init__()
        # u2 attribute_name_index;
        # u4 attribute_length

        # u2 number_of_classes;
        self.number_of_classes = SV( '>H', buff.read(2) )

        # {  u2 inner_class_info_index;
        #     u2 outer_class_info_index;
        #     u2 inner_name_index;
        #     u2 inner_class_access_flags;
        # } classes[number_of_classes];
        self.__classes = []

        for i in range(0, self.number_of_classes.get_value()) :
            self.__classes.append( InnerClassesDesc( self.__CM, buff ) )
github androguard / androguard / core / bytecodes / jvm.py View on Github external
def __init__(self, cm, buff) :
        super(SignatureAttribute, self).__init__()
        # u2 attribute_name_index;
        # u4 attribute_length;

        # u2 signature_index;
        self.signature_index = SV( '>H', buff.read(2) )
github linkedin / qark / qark / lib / axmlparserpy / stringblock.py View on Github external
for i in range(0, self.stringCount.get_value()):
            self.m_stringOffsets.append(SV('
github androguard / androguard / core / bytecodes / dvm.py View on Github external
def __init__(self, buff, cm) :
        self.__CM = cm

        off = buff.get_idx()
        while off % 4 != 0 :
            off += 1

        buff.set_idx( off )

        self.__offset = self.__CM.add_offset( buff.get_idx(), self )

        self.__off = buff.get_idx()

        self.registers_size = SV( '=H', buff.read( 2 ) )
        self.ins_size = SV( '=H', buff.read( 2 ) )
        self.outs_size = SV( '=H', buff.read( 2 ) )
        self.tries_size = SV( '=H', buff.read( 2 ) )
        self.debug_info_off = SV( '=L', buff.read( 4 ) )
        self.insns_size = SV( '=L', buff.read( 4 ) )

        ushort = calcsize( '=H' )

        if self.__CM.get_engine() == "native" :
            self._code = DCodeNative( self.__CM, self.insns_size.get_value(), buff.read( self.insns_size.get_value() * ushort ) )
        else :
            self._code = DCode( self.__CM, self.insns_size.get_value(), buff.read( self.insns_size.get_value() * ushort ) )

        if (self.insns_size.get_value() % 2 == 1) :
            self.__padding = SV( '=H', buff.read( 2 ) )
github linkedin / qark / qark / lib / axmlparserpy / axmlparser.py View on Github external
self.m_attributes.append(SV('>24)

                self.m_event = tc.START_TAG
                break

            if chunkType == tc.CHUNK_XML_END_TAG:
                self.m_namespaceUri = SV('
github linkedin / qark / qark / lib / axmlparserpy / stringblock.py View on Github external
def __init__(self, buff):
        buff.read(4)

        self.chunkSize = SV('
github androguard / androguard / core / bytecodes / jvm.py View on Github external
self.super_class          = SV( '>H', self.read( 2 ) )

        self.__CM.set_this_class( self.this_class )

        # u2 interfaces_count;
        self.interfaces_count    = SV( '>H', self.read( 2 ) )

        # u2 interfaces[interfaces_count];
        self.interfaces = []
        for i in range(0, self.interfaces_count.get_value()) :
            tag = SV( '>H', self.read( 2 ) )
            self.interfaces.append( tag )


        # u2 fields_count;
        self.fields_count = SV( '>H', self.read( 2 ) )

        # field_info fields[fields_count];
        self.fields = []
        for i in range(0, self.fields_count.get_value()) :
            fi = FieldInfo( self.__CM, self )
            self.fields.append( fi )

        # u2 methods_count;
        self.methods_count = SV( '>H', self.read( 2 ) )

        # method_info methods[methods_count];
        self.methods = []
        for i in range(0, self.methods_count.get_value()) :
            mi = MethodInfo( self.__CM, self )
            self.methods.append( mi )
github androguard / androguard / core / bytecodes / jvm.py View on Github external
def __init__(self, class_manager, buff) :
        self.__CM = class_manager

        super(ConstantValueAttribute, self).__init__()
        # u2 attribute_name_index;
        # u4 attribute_length;

        # u2 constantvalue_index;
        self.constantvalue_index = SV( '>H', buff.read(2) )
github androguard / androguard / core / bytecodes / jvm.py View on Github external
def __init__(self, cm, buff) :
        # u2     num_values;
        # element_value values[num_values];
        self.num_values = SV( '>H', buff.read(2) )

        self.values = []
        for i in range(0, self.num_values.get_value()) :
            self.values.append( ElementValue(cm, buff) )