Last active
January 1, 2016 14:34
-
-
Save 7c00/9216518c4e7c35b296b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def parse_ip(ip): | |
rans = map(lambda x: range(x[0], x[-1] + 1), | |
[map(int, part.split('-')) for part in ip.split('.')]) | |
return ['.'.join(map(str, i)) for i in itertools.product(*rans)] | |
if __name__ == '__main__': | |
print('\n'.join(parse_ip('192.168.1-2.1-10'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment