blob: 00960d068b8146ceac5e147c5768e8f9d26efa61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import socket
import struct
def ip2int(addr):
return struct.unpack("!I", socket.inet_aton(addr))[0]
def int2ip(addr):
return socket.inet_ntoa(struct.pack("!I", addr))
a = ip2int('10.13.37.254')
b = a + 1
while (b & 0xFF) in (0x00, 0xFF):
b += 1
c = int2ip(b)
print(a, b, c)
|