bitcanon / mactool Goto Github PK
View Code? Open in Web Editor NEWSimplify MAC Address tasks using this command-line application written in Go.
License: MIT License
Simplify MAC Address tasks using this command-line application written in Go.
License: MIT License
Allow the user to read a file with MAC address content to be processed by the extract, lookup and format commands.
-i macdump.txt
--infile macdump.txt
Add a flag --include
or -I
that will print only lookup results that match the string provided.
Add a flag --exclude
or -E
that will remove lookup results that match the string provided.
When running mactool info
and the file ~/.mactool.yaml
is missing the output is:
$ mactool info
Configuration file path:
Configuration file variables loaded:
No variables defined.
It should be:
$ mactool info
Configuration file path:
No configuration file exists.
Configuration file variables loaded:
No variables defined.
It could be useful to save the lookup output into a CSV formatted file.
If the user run:
mactool lookup --outfile output.csv --csv Test to parse MACs inside.
--csv
prints the output in CSV format (comma separated). Maybe add a --delimiter
flag as well to allow the user to choose delimiter character in the CSV file.
--outfile output.csv
saves the output to a file instead of writing it to the terminal. Maybe print a small "xxx bytes written to output.csv"
when export is done.
Create an mactool info
command that will print useful information about the application.
Things like:
There should be a flag to lookup the vendors in the OUI database.
Like:
mactool lookup --vendor cisco
The help text for the CSV flag should show a default value:
Windows:
Flags:
-f, --csv-file string path to CSV file (default %LOCALAPPDATA%\Mactool\oui.csv)
Unix:
Flags:
-f, --csv-file string path to CSV file (default $HOME\.local\share\mactool\oui.csv)
When running a command in interactive mode, for example:
mactool extract
or
mactool lookup
It would be helpful to print some kind of help text to the user, like (on Unix systems):
Paste your text and press CTRL + D when done:
When running on Windows:
Paste your text and press CTRL + Z when done:
Print to stdout so the help text won't propagate to stdin of piped commands.
Implement a module focused on data redaction. This could include functions to replace partial or full MAC addresses with placeholders.
One could choose to replace the OUI part of the MAC address, the UID part of the MAC or the entire MAC.
This function might be useful when posting output from networking equipment in forums and such.
mactool redact ...
Try to improve the matching of MAC addresses. The current version finds a MAC in this string:
mactool extract AA:18:FD:74:E1:A6:0B
AA:18:FD:74:E1:A6
It should not find a MAC in this string since there is a :0B
in the end:
AA:18:FD:74:E1:A6:0B
AA:18:FD:74:E1:A6
In the help texts of the commands extract
, lookup
and format
, only print help relevant to the operating system that the command is run on:
While operating in interactive mode, enter or paste the input string and then press
Enter to proceed. To exit, use Ctrl+D (Unix) or Ctrl+Z (Windows), followed by Enter.
On Windows:
While operating in interactive mode, enter or paste the input string and then press
Enter to proceed. To exit, use Ctrl+Z (Windows), followed by Enter.
And so on, maybe different on macOS?
When using the command mactool format
you can use the flags -l
or --lower-case
to reformat MAC addresses in lower case.
Add an alias for the flag called --lower
as well as --upper
for the upper case flag.
Allow the user to write the output from the commands to file.
Running show mac-address
on a HP 2530 switch prints MAC addresses in this format:
005d73-123456
This format is not supported by mactool.
When running a mactool format
without any flags the output get reformatted as xx:xx:xx:xx:xx:xx
by default.
This makes it harder to use the command if you simply want to convert the MAC's to --lower
or --upper
.
Running mactool format
without any flags should leave the input untouched.
When running the mactool format
command without a --delimiter
flag, the :
is used as a default and not "OriginalDelim
" as should.
Line 221 in format.go:
formatCmd.Flags().StringP("delimiter", "d", ":", "delimiter character to use between hex groups")
In the format
command, add a flag that allow the user to perform an extract command as well prior to formatting.
A flag like --extract
might be good here.
This can be handy when running on an OS that doesn't support pipes.
When the mactool lookup
command downloads the oui.csv
file, it is stored to the current directory.
Set a default directory for the oui.csv file, compatible with all operating systems, where the file will be stored.
This should be user customizable in the config file.
If the mactool lookup
command is unable to lookup the organization name there should be a flag that omits this MAC address from the output.
Example:
mactool lookup ...
50:87:89:14:15:16 (Cisco Systems, Inc)
C4:AD:34:14:15:16 (Routerboard.com)
E2:B4:15:14:15:16 <- omit/hide this
E2:90:7B:14:15:16 <- omit/hide this
E2:B4:15:17:18:19 <- omit/hide this
60:6B:FF:11:12:13 (Nintendo Co.,Ltd)
With flag:
mactool lookup --ignore-notfound ...
50:87:89:14:15:16 (Cisco Systems, Inc)
C4:AD:34:14:15:16 (Routerboard.com)
60:6B:FF:11:12:13 (Nintendo Co.,Ltd)
Name the flag something descriptive, not --ignore-notfound :)
Add a bit of information about the application in the help message.
Like where to report bugs, issues and improvements:
https://github.com/bitcanon/mactool/issues
Implement a --debug
flag for detailed output of configuration variables, environment variables and OUI database information.
It should also display information about any flags passed to the application and their corresponding values as parsed by the application.
Develop a module specifically for generating random MAC addresses. This module could include functions to generate addresses with different formatting options and ensure uniqueness.
mactool generate ...
Flags:
--vendor string select a vendor that the generated mac will belong to
Allow the user to sort the output of the extract
and lookup
commands with a simple --sort
flag.
Maybe --sort-asc
, --sort-desc
Or --sort
, --sort asc
, --sort desc
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.