2016-03-13 01:05:47 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
"""A very simple script to convert an integer into an IPv4 address.
|
|
|
|
Expects an integer as the only argument."""
|
|
|
|
from sys import argv
|
|
|
|
|
|
|
|
addr = list()
|
|
|
|
num = int(argv[1])
|
|
|
|
for e in range(3, -1, -1):
|
|
|
|
multiplier = 256 ** e
|
|
|
|
octet = num // multiplier
|
|
|
|
addr.append(str(octet))
|
2016-03-13 01:36:20 +02:00
|
|
|
num = num % multiplier
|
2016-03-13 01:05:47 +02:00
|
|
|
|
|
|
|
print('.'.join(addr))
|