Created
July 2, 2018 23:24
-
-
Save D3f0/5955d435637ff31a6cbcaaf7635e73f2 to your computer and use it in GitHub Desktop.
Binary IP check
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
# Checks that binary representation is the same as int.from_bytes(..., 'big') | |
bin(int.from_bytes(ip_address('200.1.17.25').packed, 'big'))[2:] == ''.join(format(i, '08b') for i in map(int, '200.1.17.25'.split('.'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment