No description
Find a file
jiro f22461575d
fix: windows color #2 (#3)
* fix: windows color

* fix
2021-11-22 15:54:45 +09:00
.github remove release draft 2020-07-18 18:31:38 +00:00
src fix: windows color #2 (#3) 2021-11-22 15:54:45 +09:00
tests copy code from jiro4989/yourutils 2020-07-05 00:59:18 +00:00
tool Initial commit 2020-07-05 09:53:55 +09:00
.gitignore Initial commit 2020-07-05 09:53:55 +09:00
LICENSE update 2020-07-05 00:54:49 +00:00
README.rst update description 2020-07-05 01:24:51 +00:00
subnet.nimble fix: windows color #2 (#3) 2021-11-22 15:54:45 +09:00

====
subnet
====

|nimble-version| |nimble-install| |gh-actions|

``subnet`` prints subnet mask in human readable.

.. contents:: Table of contents

Usage
=====

.. code-block:: shell

   $ subnet 100.100.200.1/24
   100.100.200.1        24      01100100011001001100100000000001        11111111111111111111111100000000

   # Change delimiter
   $ subnet -H 192.168.1.1/28 192.168.1.17/28 -C -d ,
   192.168.1.1,28,11000000101010000000000100000001,11111111111111111111111111110000
   192.168.1.17,28,11000000101010000000000100010001,11111111111111111111111111110000


Coloring ( ``with -C option`` ).

|image-color|

Expanded notations
------------------

Range ( ``BEGIN-END`` )
^^^^^^^^^^^^^^^^^^^

.. code-block:: shell

  $ subnet 192.168.1.1-15/28 -C
  ip_address      cidr    bin     mask
  192.168.1.1     28      11000000101010000000000100000001        11111111111111111111111111110000
  192.168.1.2     28      11000000101010000000000100000010        11111111111111111111111111110000
  192.168.1.3     28      11000000101010000000000100000011        11111111111111111111111111110000
  192.168.1.4     28      11000000101010000000000100000100        11111111111111111111111111110000
  192.168.1.5     28      11000000101010000000000100000101        11111111111111111111111111110000
  192.168.1.6     28      11000000101010000000000100000110        11111111111111111111111111110000
  192.168.1.7     28      11000000101010000000000100000111        11111111111111111111111111110000
  192.168.1.8     28      11000000101010000000000100001000        11111111111111111111111111110000
  192.168.1.9     28      11000000101010000000000100001001        11111111111111111111111111110000
  192.168.1.10    28      11000000101010000000000100001010        11111111111111111111111111110000
  192.168.1.11    28      11000000101010000000000100001011        11111111111111111111111111110000
  192.168.1.12    28      11000000101010000000000100001100        11111111111111111111111111110000
  192.168.1.13    28      11000000101010000000000100001101        11111111111111111111111111110000
  192.168.1.14    28      11000000101010000000000100001110        11111111111111111111111111110000
  192.168.1.15    28      11000000101010000000000100001111        11111111111111111111111111110000

``BEGIN`` is set `0` if no ``BEGIN``.
``END`` is set `255` if no ``END``.

Multi IP ( ``ip1,ip2,ip3`` )
^^^^^^^^^^^^^^^^^^^

.. code-block:: shell

  ⟩ subnet 192.168.1.1,2,4,8/28 -C
  ip_address      cidr    bin     mask
  192.168.1.1     28      11000000101010000000000100000001        11111111111111111111111111110000
  192.168.1.2     28      11000000101010000000000100000010        11111111111111111111111111110000
  192.168.1.4     28      11000000101010000000000100000100        11111111111111111111111111110000
  192.168.1.8     28      11000000101010000000000100001000        11111111111111111111111111110000

Installation
============

.. code-block:: shell

   $ nimble install -Y subnet

LICENSE
=======

MIT

.. |gh-actions| image:: https://github.com/jiro4989/subnet/workflows/build/badge.svg
   :target: https://github.com/jiro4989/subnet/actions
.. |nimble-version| image:: https://nimble.directory/ci/badges/subnet/version.svg
   :target: https://nimble.directory/ci/badges/subnet/nimdevel/output.html
.. |nimble-install| image:: https://nimble.directory/ci/badges/subnet/nimdevel/status.svg
   :target: https://nimble.directory/ci/badges/subnet/nimdevel/output.html

.. |image-color| image:: https://user-images.githubusercontent.com/13825004/86523414-fa375400-bea6-11ea-926f-8efa76cb307c.png