def dridex_loader_final()

in dridex/loader/dridex_loader.py [0:0]


    def dridex_loader_final(self, p: ProcessMemory) -> dict | None:
        if p.memory:
            config = {
                "family": self.family,
            }
            if not self.ip_count or self.ip_count > 10:
                return None
            log.debug("ip_count: %d", self.ip_count)

            config[self.family] = {"hosts": []}
            if self.c2_rva:
                for i in range(0, self.ip_count):
                    ip = None
                    port = None

                    ip = ipv4(p.readv(self.c2_rva, 4))
                    port = p.uint16v(self.c2_rva + 4)
                    log.debug("found c2 ip: " + str(ip) + ":" + str(port))
                    if ip is not None and port is not None:
                        config[self.family]["hosts"].append(str(ip) + ":" + str(port))
                    self.c2_rva += 6 + self.delta

            if len(config[self.family]["hosts"]) <= 0:
                return None

            if self.rc4_key:
                config["rc4_key"] = enhex(self.rc4_key)
            if self.botnet_id is not None:
                log.debug("found botnet_id: " + str(self.botnet_id))
                config[self.family]["botnet_id"] = self.botnet_id
            return config
        return None