def getConfig(self):
        configrecords = {}
        configrecords_short = {}
        f = open(self.configfile, "rb")
        contents = f.readlines()
        f.close
        for thisline in contents:
            if not thisline.replace(" ", "") == "" and not thisline.startswith("#"):
                thislineparts = thisline.split("=")
                if len(thislineparts) == 2:
                    sitename = thislineparts[0].replace(" ", "")
                    siteiplist = thislineparts[1].replace("\r", "").replace("\n", "").replace(" ", "")
                    if len(sitename) > 0 and len(siteiplist) > 0:
                        siteips = siteiplist.split(',')
                        # explode if necessary
                        iplist = []
                        # first add IPs
                        for thisip in siteips:
                            if not thisip.startswith("-"):
                                tip = thisip.replace("\\", "/")
                                if "/" in tip:
                                    cidrlist = cidr_to_ipv4(tip)
                                    for ip in cidrlist:
                                        if not ip in iplist:
                                            iplist.append(ip)
                                else:
                                    if not tip in iplist:
                                        iplist.append(thisip)
                            if not sitename in configrecords_short:
                                configrecords_short[sitename] = [thisip]
                            else:
                                configrecords_short[sitename].append(thisip)
                        # then remove the ones that start with -
                        for thisip in siteips:
                            if thisip.startswith("-"):
                                tip = thisip.replace("\\", "/").replace("-", "")
                                if "/" in tip:
                                    cidrlist = cidr_to_ipv4(tip)
                                    for ip in cidrlist:
                                        if ip in iplist:
                                            iplist.remove(ip)
                                else:
                                    if tip in iplist:
                                        iplist.remove(tip)

                        # finally store in dictionary
                        for thisip in iplist:
                            if not sitename in configrecords:
                                configrecords[sitename] = [thisip]
                            else:
                                configrecords[sitename].append(thisip)
        return configrecords, configrecords_short
dataset/ETHPy150Open corelan/dnshjmon/dnshjmon.py/DNSConfig.getConfig/original