Re:Show HN: Simple Subnet Network Tool
by ytjohn on Sunday March 13, 2016 @02:23PM
(#11278726)
I keep telling myself I'm going to make a command line tool to do just this kind of thing and upload it to pypi. One day.
[ Parent
| on HN ]
I've actually got a curl output if you prefer command line...
tom@iMac: curl subnet.im/192.168.0.1/23
{
"ip": "192.168.0.1",
"netmask": "255.255.254.0",
"cidr": 23,
"wildcard": "0.0.1.255",
"network": "192.168.0.0",
"broadcast": "192.168.1.255",
"firsthost": "192.168.0.1",
"lasthost": "192.168.1.254",
"totalhosts": 510
}%
--Python example :)
>>> r = requests.get('http://subnet.im/192.168.12.12/30')
>>> print(r.text)
{
"ip": "192.168.12.12",
"netmask": "255.255.255.252",
"cidr": 30,
"wildcard": "0.0.0.3",
"network": "192.168.12.12",
"broadcast": "192.168.12.15",
"firsthost": "192.168.12.13",
"lasthost": "192.168.12.14",
"totalhosts": 2
}