A colleague of mine wrote a python script on a similar topic, the argument it expects is an output of "ifconfig -a" on a firewall. You will get all the locally attached subnets on the firewall, this might be useful to give to your vulnerability scanner to be able to scan all the DMZ's off the firewall
/////////////
#!/usr/bin/python
import sys
input_name = sys.argv[1]
with open(input_name, "r") as f:
contents = f.readlines()
for i, item in enumerate(contents):
if "inet addr:" in item and "Mask:" in item:
interface = contents[i - 1].split()[0]
cidr = 0
ip_octets = ((item.split("inet addr:")[1]).split()[0]).split(".")
subnet_mask_octets = ((item.split("Mask:")[1]).split()[0]).split(".")
for j, item in enumerate(subnet_mask_octets):
if item == "255":
cidr += 8
continue
elif item == "254":
cidr += 7
elif item == "252":
cidr += 6
elif item == "248":
cidr += 5
elif item == "240":
cidr += 4
elif item == "224":
cidr += 3
elif item == "192":
cidr += 2
elif item == "128":
cidr += 1
octet_number = j
octet_value = 256 - int(item)
break
ip_octets[octet_number] = str(int(ip_octets[octet_number]) // octet_value * octet_value)
for j in range(octet_number + 1, 4):
ip_octets[j] = "0"
print "%s/%s %s" %(".".join(ip_octets), cidr, interface)
////