Skip to content

Instantly share code, notes, and snippets.

@maluta
Created August 9, 2010 03:53
Show Gist options
  • Save maluta/514917 to your computer and use it in GitHub Desktop.
Save maluta/514917 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
ip=192<<24|168<<16|10<<8|33
def octet(ip):
for i in range(-24,8,8):
yield ip >> -i & 0xff
print "Hex ", hex(ip)
print "Int ", ip
r = octet(ip)
print r.next()
print r.next()
print r.next()
print r.next()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment