#NEWLINE# def expand_cidr( self , cidr ) : #NEWLINE# #INDENT# ( network , bits ) = cidr . split ( '/' ) #NEWLINE# network = network . strip ( ) #NEWLINE# bits = int ( bits . strip ( ) ) #NEWLINE# dest = [ ] #NEWLINE# netmask = ( ( ~ ( pow ( 2 , ( 32 - bits ) ) - 1 ) ) & 4294967295 ) #NEWLINE# count = pow ( 2 , ( 32 - bits ) ) #NEWLINE# for i in range ( 2 , ( count - 1 ) ) : #NEWLINE# #INDENT# ip = struct . unpack ( '!L' , socket . inet_aton ( network ) ) [ 0 ] #NEWLINE# ip = ( ( ip & netmask ) | i ) #NEWLINE# dest . append ( socket . inet_ntoa ( struct . pack ( '!L' , ip ) ) ) #NEWLINE# #UNINDENT# return ( dest , netmask )