def test_ipv4_lstrip_zeros(self): if sys.version_info >= (3, 3): from ipaddress import ip_address else: from ipaddr import IPAddress as ip_address self.assertIsInstance(ipv4_lstrip_zeros('074.125.000.000'), str) tmp = ip_address(ipv4_lstrip_zeros('074.125.000.000')).__str__()
'IPv4/IPv6 addresses/networks.') # Output options group = parser.add_argument_group('Output options') group.add_argument( '--colorize', action='store_true', help='If set, colorizes the output using ANSI. Should work in most ' 'platform consoles.') # Get the args script_args = parser.parse_args() if script_args.ipv4_lstrip_zeros: print((ipv4_lstrip_zeros(address=script_args.ipv4_lstrip_zeros[0]))) elif script_args.calculate_cidr: try: result = calculate_cidr(start_address=script_args.calculate_cidr[0], end_address=script_args.calculate_cidr[1]) print(('{0}Found {1} CIDR blocks for ({2}, {3}){4}:\n{5}'.format( ANSI['green'] if script_args.colorize else '', len(result), script_args.calculate_cidr[0], script_args.calculate_cidr[1], ANSI['end'] if script_args.colorize else '', '\n'.join(result)))) except Exception as e:
# Output options group = parser.add_argument_group('Output options') group.add_argument( '--colorize', action='store_true', help='If set, colorizes the output using ANSI. Should work in most ' 'platform consoles.' ) # Get the args script_args = parser.parse_args() if script_args.ipv4_lstrip_zeros: print(ipv4_lstrip_zeros(address=script_args.ipv4_lstrip_zeros[0])) elif script_args.calculate_cidr: try: result = calculate_cidr( start_address=script_args.calculate_cidr[0], end_address=script_args.calculate_cidr[1] ) print('{0}Found {1} CIDR blocks for ({2}, {3}){4}:\n{5}'.format( ANSI['green'] if script_args.colorize else '', len(result), script_args.calculate_cidr[0], script_args.calculate_cidr[1],