netfunc.bash

felix via gull <gull-04vmY7CpswVinyhjFObuvR+/[email protected]>
Newsgroups gmane.org.user-groups.gull.general
Message-ID <[email protected]>
Bonjour,

J'ai (enfin) publié ma release de ma batterie de function IPv4, pour laquelle
j'ai supprimé tous les forks et optimisé l'éxecution:

  https://f-hauri.ch/vrac/netfunc.bash.txt

Ce fichier est un fichier bash, à ``sourcer'':

  . netfunc.bash
  Bash source file for IPV4 computing - netfunc v0.13
   - int2ip       integer to IPv4
   - int2rev      3 most significant bytes, for reverse DNS X.X.X.in-addr.arpa
   - checkIsIp    throw an error if not valid IPv4
   - ip2int       IPv4 to integer 32 bits value.
   - mask2int     from mask len to integer value of IPv4 mask
   - int2mlen     compute mask len from integer value of IPv4 mask
   - be2int       Big Endian to INTeger, ( for reading proc/net/route )
   - int2uu       1st run generate int2uu() to render bash's 64# from integer
   - int2bin      1st run generate int2bin to render 32bits, mark mask with a dot.
   - rangeIp      Generate array of integer representation of IPv4 from argument
   - multiping    One ping on many target. Use integer representation of IPv4
   - ip2hnam      Fork to `host` and store in _ipResInv, if not already stored.
   - hname2ip     Fork to `host` and store in _ipResolv, if not already stored.
   - isup         Monitor ping many targets simultaneously (hit any key to quit)
   - mping        quick ping scan IPv4 ranges and resolv host name of waked hosts
   - ipcalc       compute and render network submited as [ip mask] or [ip/masklen]
   - getLocalNet  Get local config from /proc/net/ pseudo files
   - commonNet    compute smallest common network for many IP/net
   - reCIDR       Compute shortened list of CIDR for argument or STDIN
   - netfuncFList List functions (this.) [-v]

Quelques applications:

 $ ipcalc 192.168.1.33/24
 +-------------+---------------+-----------+--------------------------+---------+
 | Network base|192.168.1.0    |         #0|11000000 10101000 00000001| 00000000|
 | Mask        |255.255.255.0  |/24        |11111111 11111111 11111111| 00000000|
 | Broadcast   |192.168.1.255  |       #255|11000000 10101000 00000001| 11111111|
 | Host/net    |254            |Class C    |                          |         |
 +-------------+---------------+-----------+--------------------------+---------+
 | First host  |192.168.1.1    |         #1|11000000 10101000 00000001| 00000001|
 |>Host        |192.168.1.33   |        #33|11000000 10101000 00000001| 00100001|
 | Last host   |192.168.1.254  |       #254|11000000 10101000 00000001| 11111110|
 +-------------+---------------+-----------+--------------------------+---------+

 $ isup 192.168.1.1 192.168.1.33 google.com
      Elaps Cnt  zrh..14  fir..ll  19...33
    10.0964   3     11.3    0.413    0.252
 la boucle est interruptible en appuyant sur [return].

 $ commonNet 10.11.12.13 10.11.15.2
 +-------------+---------------+-----------+------------------------+-----------+
 | Network base|10.11.12.0     |         #0|00001010 00001011 000011|00 00000000|
 | Mask        |255.255.252.0  |/22        |11111111 11111111 111111|00 00000000|
 | Broadcast   |10.11.15.255   |      #1023|00001010 00001011 000011|11 11111111|
 | Host/net    |1022           |Class A    |                        |           |
 +-------------+---------------+-----------+------------------------+-----------+
 | First host  |10.11.12.1     |         #1|00001010 00001011 000011|00 00000001|
 |>IP min      |10.11.12.13    |        #13|00001010 00001011 000011|00 00001101|
 | IP max      |10.11.15.2     |       #770|00001010 00001011 000011|11 00000010|
 | Last host   |10.11.15.254   |      #1022|00001010 00001011 000011|11 11111110|
 +-------------+---------------+-----------+------------------------+-----------+

 $ reCIDR 10.11.12.13/23 10.11.15.2/23
 10.11.12.0/22

-- 
 Félix Hauri  -  <[email protected]>  -  http://www.f-hauri.ch
_______________________________________________
gull mailing list
[email protected]
https://forum.linux-gull.ch/mailman/listinfo/gull
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.