blob: cba8654a81a79fe31c21623ed8f090ab295e266b [file] [log] [blame]
from socket import inet_ntoa
from struct import pack
def calcDottedNetmask(mask):
bits = 0
for i in range(32 - mask, 32):
bits |= 1 << i
packed_value = pack("!I", bits)
addr = inet_ntoa(packed_value)
return addr