Ejemplo n.º 1
0
 def unpack(self, u: xdrlib.Unpacker):
     last = u.unpack_uint() + u.get_position()
     if u.get_position() < last:
         self.time_A = struct.unpack('>Q', u.unpack_fopaque(8))[0]
     if u.get_position() < last:
         self.time_B = struct.unpack('>Q', u.unpack_fopaque(8))[0]
     u.set_position(last)
Ejemplo n.º 2
0
    def unpack(self, u: xdrlib.Unpacker):
        last = u.unpack_uint() + u.get_position()
        ret = ReturnCode.unpack(u)

        if ret == ReturnCode.OK:
            last2 = u.unpack_uint() + u.get_position()
            if u.get_position() < last2:
                self.digest = u.unpack_fopaque(20)
            if u.get_position() < last2:
                self.salt = u.unpack_fopaque(8)
            u.set_position(last2)
        u.set_position(last)
Ejemplo n.º 3
0
    def unpack(self, u: xdrlib.Unpacker):
        self.response_from_agent = u.unpack_bool()
        self.agent_id = u.unpack_opaque()

        n = u.unpack_uint()
        self.controllers = []
        for i in range(n):
            c = AccessibleController()
            c.trayId = u.unpack_uint()
            c.slot = u.unpack_uint()
            c.wwn = u.unpack_opaque()
            c.token = u.unpack_fopaque(12)
            c.controller_refs = []

            m = u.unpack_uint()
            for j in range(m):
                c.controller_refs.append(u.unpack_fopaque(12))

            self.controllers.append(c)
Ejemplo n.º 4
0
    def unpack(self, u: xdrlib.Unpacker):
        self.needs_attention = u.unpack_bool()
        self.fixing = u.unpack_bool()
        self.wwn = u.unpack_opaque()
        self.management_class_name = u.unpack_string()
        self.storage_array_label = u.unpack_string().decode('utf-16be')
        self.boot_time = struct.unpack('>Q', u.unpack_fopaque(8))[0]
        self.fw_version = u.unpack_fopaque(4)
        self.app_version = u.unpack_fopaque(4)
        self.boot_version = u.unpack_fopaque(4)
        self.nvsram_version = u.unpack_string()
        self.fw_prefix = u.unpack_string()
        self.chassis_serial_number = u.unpack_string()
        self.event_configuration_data_version = u.unpack_string()

        self.array_attributes = []
        nb = u.unpack_uint()
        for i in range(nb):
            self.array_attributes.append(u.unpack_uint())
        self.res4 = []
        nb = u.unpack_uint()
        for i in range(nb):
            self.res4.append(u.unpack_uint())
        self.res5 = []
        nb = u.unpack_uint()
        for i in range(nb):
            self.res5.append(u.unpack_uint())
        self.res6 = []
        nb = u.unpack_uint()
        for i in range(nb):
            self.res6.append(u.unpack_uint())
        self.res7 = u.unpack_opaque()

        last = u.unpack_int()
        if last > 0:
            this.reserved1 = u.get_opaque()
            u.set_position(u.get_position() + last)
Ejemplo n.º 5
0
    def unpack(self, u: xdrlib.Unpacker):
        last = u.unpack_uint() + u.get_position()
        if u.get_position() < last:
            last2 = u.unpack_uint()
            self.canditate_selection_type = CandidateSelectionType(
                u.unpack_uint())
            if self.canditate_selection_type == CandidateSelectionType.CANDIDATE_SEL_MANUAL:
                last3 = u.unpack_uint() + u.get_position()
                if u.get_position() < last3:
                    nb = u.unpack_uint()
                    self.drive_refs = []
                    for i in range(nb):
                        self.drive_refs.append(u.unpack_fopaque(20))
                u.set_position(last3)
            u.set_position(last2)

        if u.get_position() < last:
            self.raid_level = RaidLevel(u.unpack_int())
        if u.get_position() < last:
            self.phyiscal_drive_type = PhysicalDriveType(u.unpack_int())
Ejemplo n.º 6
0
 def unpack(unpacker: Unpacker, size: int, fixed: bool) -> "bytes":
     if not fixed:
         size = unpacker.unpack_uint()
     return unpacker.unpack_fopaque(size)
Ejemplo n.º 7
0
 def unpack(unpacker: Unpacker) -> bytes:
     size = unpacker.unpack_uint()
     return unpacker.unpack_fopaque(size)
Ejemplo n.º 8
0
        for sample_num in range(0, datagram_info["Sample Count"]
                                ):  # For each sample in the datagram

            ### Sample Header Start ###
            enterprise_format_num = enterprise_format_numbers(
                unpacked_data.unpack_uint())  # Enterprise number and format
            sample_length = int(unpacked_data.unpack_uint())  # Sample Length

            logging.info("Sample " + str(sample_num + 1) + " of " +
                         str(datagram_info["Sample Count"]) + ", type " +
                         str(enterprise_format_num) + " length " +
                         str(sample_length))

            try:
                unpacked_sample_data = Unpacker(
                    unpacked_data.unpack_fopaque(
                        sample_length))  # Unpack the sample data block
                logging.info("Unpacked opaque sample data chunk - OK")
            except Exception as unpack_error:
                logging.warning("Failed to unpack opaque sample data - FAIL")
                continue
            ### Sample Header Finish ###

            ### Sample Parsing Start ###
            flow_sample_cache = sample_picker(
                enterprise_format_num,
                unpacked_sample_data)  # Get the opaque flow sample cache

            if flow_sample_cache is False:
                logging.warning(
                    "Unable to parse the sample cache, type " +
                    str([enterprise_format_num, unpacked_sample_data]) +