israel-lugo / netcalc Goto Github PK
View Code? Open in Web Editor NEWAdvanced network calculator and address planning helper
License: GNU General Public License v3.0
Advanced network calculator and address planning helper
License: GNU General Public License v3.0
It would be nice to have the ability to split prefixes hierarchically, i.e.:
$ ./netcalc.py split 10.64.0.0/10 13 15
This would print a tree, splitting first with /13, then /14, then /15, with nested indentation, similarly to the tree
command.
Create a new command to provide static information on a subnet, e.g. netmask, bitmask, start and end IP, and so on.
The kind of thing that e.g. ipcalc or sipcalc provide, but we might as well provide it as well so people can use a single tool.
Create a new command to provide WHOIS data on a network or IP.
Might as well provide RDAP data, while we're at it.
The add-file
command reads network addresses from files. Right now, it only supports clean lists of addresses, e.g.:
10.0.0.0/24
192.0.2.0/27
10.5.7.128/25
It would be nice, however, to be able to feed add-file
directly with the output of a "show route" command from some router, e.g.:
B 10.20.0.0/15 [20/40000] via 198.51.100.134, 3d14h
O 10.34.1.0/24 [110/200] via 198.51.100.142, 7w0d, Vlan0021
O E2 10.35.0.0/16 [110/20] via 198.51.100.142, 7w0d, Vlan0021
B 10.98.0.0/14 [20/40000] via 198.51.100.134, 3d14h
O E2 10.76.0.0/14 [110/20] via 198.51.100.70, 1w0d, Vlan0017
O E2 10.84.0.0/16 [110/20] via 198.51.100.38, 7w0d, Vlan0017
O E2 10.85.0.0/16 [110/20] via 198.51.100.49, 00:44:15, Vlan0013
Of course, we'd need to support any kind of format:
10.0.0.0/8 unreachable [sink_private 18:49:35] * (1)
10.16.64.0/24 via 198.51.100.129 on eth0 [igp_backbone 2016-11-16] * E1 (150/20) [198.51.100.5]
10.68.16.0/24 via 198.51.100.139 on eth0 [igp_backbone 2016-11-14] * IA (150/20) [198.51.100.139]
10.64.1.0/24 via 198.51.100.129 on eth1 [isp1 10:26:59] * (100) [AS65302?]
10.1.0.0/16 via 198.51.100.136 on eth0 [igp_backbone 2016-11-14] * IA (150/20) [198.51.100.136]
These can be dealt with simply by looking for the first thing in the line that looks like an address. Implementation can be either with a regexp (nightmare for IPv6) or by splitting the line into tokens and checking with netaddr.valid_ipv4
and netaddr.valid_ipv6
.
The problem comes when we have output like this:
10.5.110.0/23 *[OSPF/10] 2d 01:03:59, metric 20
> to 198.51.100.130 via irb.2
10.0.0.0/23 *[OSPF/10] 2d 01:03:59, metric 20
> to 198.51.100.141 via irb.2
10.8.123.0/24 *[OSPF/10] 17:01:09, metric 20
> to 198.51.100.130 via irb.2
to 198.51.100.143 via irb.2
10.8.32.0/24 *[OSPF/10] 2d 01:03:59, metric 20
> to 198.51.100.139 via irb.2
10.20.0.0/15 *[OSPF/150] 00:53:42, metric 40000, tag 6666
> to 198.51.100.158 via irb.2
10.20.8.0/24 *[OSPF/150] 2d 01:03:59, metric 20, tag 0
> to 198.51.100.151 via irb.2
Some of these lines are interesting, some aren't. The problem is some lines have IP addresses that we don't care about (e.g. nexthops). For this kind of output, we'd need to be configurable somehow. Have some kind of way for the user to tell us "ignore stuff that looks like an IP address if it's on a line like this".
For now we'll just let the user worry about filtering invalid lines. They can use grep
or similar and only give us what they want.
New option to specify networks from file. Ideally, this should work with a consistent syntax for all commands. One idea would be to have to have a global option that tells netcalc to read args from the file. Something like:
$ netcalc --arg-file networks.txt add
Where networks.txt is a list of networks, one per line:
198.18.0.0/24
198.18.1.0/24
10.1/16
10/16
Or, for the expr
command, which has a more complex syntax:
$ netcalc --arg-file expr.txt expr
Where expr.txt contains:
2001:db8::/34
-
2001:db8::/38
+
2001:db8:100::/41
We've had user requests to be able to read networks from various formats. Popular IPAM tools, CSV, SQL, and so on.
Not quite sure how we'd do on the interface side... Especially with regards to SQL, we need to have some way for the user to define the schema for us to retrieve it. But this needs addressing. CSV is probably the easiest to start with.
It should be possible for the user to not use whitespace around the operators in the expr
command. Right now, this is a syntax error:
$ ./netcalc.py expr 192.0.2.0/24 -192.0.2.0/25
usage: netcalc.py [-h] COMMAND ...
netcalc.py: error: unrecognized arguments: -192.0.2.0/25
This relates to the simple way in which we're parsing the command line. We'll need to be smarter than this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.