예제 #1
0
    def getForward(self):
        ip = dns.aton(self.address)
        mask = dns.aton(self.mask)
        ipmask = dns.ntoa(mask)
        broadcast = dns.ntoa(ip | ~mask)

        return (("; %s\n" % self.dn) +
                formatIPAddress(self.name, self.address) +
                formatIPAddress("netmask." + self.name, ipmask) +
                formatIPAddress("broadcast." + self.name, broadcast))
예제 #2
0
 def printZone(self):
     print("#" + self.dn)
     printIPAddress(self.name, self.address)
     printPTR(self.name, self.address)
     ip = dns.aton(self.address)
     mask = dns.aton(self.mask)
     ipmask = dns.ntoa(mask)
     broadcast = dns.ntoa(ip | ~mask)
     printIPAddress("netmask." + self.name, ipmask)
     printIPAddress("broadcast." + self.name, broadcast)
     printPTR("broadcast." + self.name, broadcast)
예제 #3
0
    def getReverse(self, domain):
        ip = dns.aton(self.address)
        mask = dns.aton(self.mask)
        broadcast = dns.ntoa(ip | ~mask)

        return (("; %s\n" % self.dn) +
                formatPTR(self.name + "." + domain, self.address) +
                formatPTR("broadcast." + self.name + "." + domain, broadcast))
예제 #4
0
 def test_CIDR(self):
     for i in range(0, 33):
         mask = dns.ntoa(dns.aton(i))
         self.assertEquals(dns.netmaskToNumbits(mask), i)
예제 #5
0
 def test_CIDR(self):
     for i in range(0, 33):
         mask = dns.ntoa(dns.aton(i))
         self.assertEqual(dns.netmaskToNumbits(mask), i)