ipcalc.coffee 442 B

1234567891011121314151617
  1. Netmask = require('netmask').Netmask
  2. ip = process.argv[2]
  3. netmask = new Netmask(ip)
  4. out = console.log
  5. out "Address: #{ip.split('/', 1)[0]}"
  6. out "Netmask: #{netmask.mask} = #{netmask.bitmask}"
  7. out "Wildcard: #{netmask.hostmask}"
  8. out "=>"
  9. out "Network: #{netmask.base}/#{netmask.bitmask}"
  10. out "HostMin: #{netmask.first}"
  11. out "HostMax: #{netmask.last}"
  12. out "Broadcast: #{netmask.broadcast}"
  13. out "Hosts/Net: #{netmask.size}"
  14. out netmask.next()