MJL85 / natlas

natlas - Network Discovery and Auto-Diagramming
GNU General Public License v2.0
511 stars 110 forks source link

How do you get this to work? #28

Closed orgitnized closed 5 years ago

orgitnized commented 6 years ago

I'm happy to be the guy in the room asking the dumb question: how do you get this software to work? I can't get mnet to work, nor can I get this to work. Do you have anything that might help people get started with installing it? Here's exactly what I did on my computer, which is running macOS High Sierra 10.13.5

brew install python3
cd /usr/local/bin
git clone https://github.com/MJL85/natlas.git
cd natlas
chmod +x natlas-cli.py

It all installs as expected - but when I run it with something like just a standard check to see that things are where they should be, I get the following output:

sudo python3 natlas-cli.py list
natlas v0.11-dev6
Michael Laforest <mjlaforest@gmail.com>
Python 3.6.5

Traceback (most recent call last):
  File "natlas-cli.py", line 306, in <module>
    main(sys.argv[1:])
  File "natlas-cli.py", line 76, in main
    modules = load_modules()
  File "natlas-cli.py", line 119, in load_modules
    for f in os.listdir(working_dir + '/modules'):
FileNotFoundError: [Errno 2] No such file or directory: '/modules'

Running other commands produce similar output, even when using full paths:

sudo python3 natlas-cli.py diagram -c /usr/local/bin/natlas/natlas.conf -r 172.20.24.1 -o /usr/local/bin/natlas/network.pdf
natlas v0.11-dev6
Michael Laforest <mjlaforest@gmail.com>
Python 3.6.5

Traceback (most recent call last):
  File "natlas-cli.py", line 306, in <module>
    main(sys.argv[1:])
  File "natlas-cli.py", line 76, in main
    modules = load_modules()
  File "natlas-cli.py", line 119, in load_modules
    for f in os.listdir(working_dir + '/modules'):
FileNotFoundError: [Errno 2] No such file or directory: '/modules'

I'm hoping that there's just a tweak or two I need to administer to get this working. Can you please offer any insight? I'd love to try this out - thank you in advance!

fatman00 commented 6 years ago

Hi

I change "for f in os.listdir(working_dir + '/modules'):" to "for f in os.listdir('/modules'):" and that made it work for me on Windows and Ubuntu

orgitnized commented 6 years ago

Thanks for the comment, fatman00 I made that change and saved it and tried again but the exact same error messages exist. There wasn't a change at all in the errors displayed.

orgitnized commented 6 years ago

So, does anyone have a howto guide for this? Tried with Ubuntu 18.04 as well with the same results, even after changing stuff. Figured I'd try it on a clean VM but still throws the same errors for me. I see similar stuff on reddit, though it references mnet, which looks to be the old version.

fatman00 commented 6 years ago

Hi orgitnized

I gave you some wrong information. I change the line to: for f in os.listdir('./modules'):

And it is working on Ubuntu 18.04. But i think you have to install some dependencies. But the error messages are pretty useful.

orgitnized commented 6 years ago

Thanks - still can't get it to work. Get all sorts of errors, even with that.

Back filling node details...
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pydot.py", line 1861, in create
    stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "natlas-cli.py", line 306, in <module>
    main(sys.argv[1:])
  File "natlas-cli.py", line 96, in main
    exec_mod(mod, argv[1:])
  File "natlas-cli.py", line 168, in exec_mod
    modret = module.entryfunc(natlas_obj, argv)
  File "./modules/diagram.py", line 88, in mod_entry
    if (opt_output != None):    natlas_obj.write_diagram(opt_output, opt_title)
  File "/usr/local/bin/natlas/natlas/natlas.py", line 125, in write_diagram
    self.diagram.generate(output_file, diagram_title)
  File "/usr/local/bin/natlas/natlas/output_diagram.py", line 108, in generate
    output_func(f)
  File "/usr/local/lib/python3.6/site-packages/pydot.py", line 1673, in new_method
    encoding=encoding)
  File "/usr/local/lib/python3.6/site-packages/pydot.py", line 1756, in write
    s = self.create(prog, format, encoding=encoding)
  File "/usr/local/lib/python3.6/site-packages/pydot.py", line 1867, in create
    raise OSError(*args)
FileNotFoundError: [Errno 2] "dot" not found in path.

I thought I'd be able to use the setup.py file as well, but it looks like it references the old project, as it called for mnetsuite, and not natlas.

fatman00 commented 6 years ago

Hi Its some time since i installed it so I cant rememeber exactly what I did, but you need to install pydot/graphviz with pip install/apt install/.exe(on windows) one of them, I cant remember. Would be awesome with a requirements file.

Let me know if you still cant get it to work and I will take a look at my bash history.

orgitnized commented 6 years ago

It's not a big deal - was hoping there would be better documentation on this but if it's this problematic to get it working I'll just skip it. I have pydot and graphviz installed already so who knows. I've tried this on Ubuntu 18 and Mac High Sierra.

fatman00 commented 6 years ago

Maybe this will help: 430 git clone https://github.com/MJL85/natlas.git 431 cd natlas/ 432 ls 433 python setup.py install 434 pip install requirements 435 sudo apt install python-pip 436 pip install requirements 437 python natlas-cli.py 438 pip install pysnmp 439 python setup.py install 440 python natlas-cli.py 441 pip install pydot 442 python natlas-cli.py 443 apt install python3 444 python3 natlas-cli.py 445 python natlas-cli.py 446 python 447 python3 448 python3 natlas-cli.py 449 python natlas-cli.py 450 python3 natlas-cli.py 451 python 452 man pip 453 pip3 454 sudo apt install python3-pip 455 pip3 install pysnmp 456 python3 natlas-cli.py 457 pip3 install netaddr 458 python3 natlas-cli.py 459 python3 setup.py install 460 python3 setup.py 461 python3 natlas-cli.py 462 pip3 install pydot 463 python3 natlas-cli.py 464 python3 natlas-cli.py list

orgitnized commented 6 years ago

Thanks! I'll give it a whirl ;) Appreciate the help!

MJL85 commented 6 years ago

Sorry, I have not yet produced an install guide. This is from my own notes, give it a try.

pip install pysnmp pip install netaddr pip install pydot

Then you need GraphViz (https://www.graphviz.org/) If you're on Windows add the graphviz Bin directory (ex C:\Program Files (x86)\Graphviz2.38\bin) to your environment Path variable.

You should then be able to run it without those errors.

I'll look at if "for f in os.listdir(working_dir + '/modules'):" is a bug - probably is.

orgitnized commented 6 years ago

Tried on Mac High Sierra and on Ubuntu 18 from scratch. Both try to discover and then dump this output:

Back filling node details...
Traceback (most recent call last):
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1861, in create
    stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "natlas-cli.py", line 306, in <module>
    main(sys.argv[1:])
  File "natlas-cli.py", line 96, in main
    exec_mod(mod, argv[1:])
  File "natlas-cli.py", line 168, in exec_mod
    modret = module.entryfunc(natlas_obj, argv)
  File "./modules/diagram.py", line 88, in mod_entry
    if (opt_output != None):    natlas_obj.write_diagram(opt_output, opt_title)
  File "/home/orgitnized/natlas/natlas/natlas.py", line 125, in write_diagram
    self.diagram.generate(output_file, diagram_title)
  File "/home/orgitnized/natlas/natlas/output_diagram.py", line 108, in generate
    output_func(f)
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1673, in new_method
    encoding=encoding)
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1756, in write
    s = self.create(prog, format, encoding=encoding)
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1867, in create
    raise OSError(*args)
FileNotFoundError: [Errno 2] "dot" not found in path.

All my stuff looks fine otherwise:

orgitnized@tools:~/natlas$ python3 natlas-cli.py list
natlas v0.11-dev6
Michael Laforest <mjlaforest@gmail.com>
Python 3.6.5

Module                  Version   Status    Author                    About
------                  -------   ------    ------                    -----
checkconfig             0.1       OK        Michael Laforest          Validate the config
showconfig              0.1       OK        Michael Laforest          Display the config
get-hosts               0.1       OK        Michael Laforest          Display details about connected hosts
newconfig               0.1       OK        Michael Laforest          Generate a new config
tracemac                0.1       OK        Michael Laforest          Trace a MAC address through a layer 2 network.
diagram                 0.11      OK*       Michael Laforest          Discover and diagram the network
get-arp-table           0.1       OK        Michael Laforest          Display the ARP table
get-mac-table           0.1       OK        Michael Laforest          Get MAC table from device

* Development version 0.11-dev6 overrides disabled modules.
orgitnized commented 6 years ago

Tried on Mac High Sierra and on Ubuntu 18 from scratch. Both try to discover and then dump this output:

Back filling node details...
Traceback (most recent call last):
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1861, in create
    stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "natlas-cli.py", line 306, in <module>
    main(sys.argv[1:])
  File "natlas-cli.py", line 96, in main
    exec_mod(mod, argv[1:])
  File "natlas-cli.py", line 168, in exec_mod
    modret = module.entryfunc(natlas_obj, argv)
  File "./modules/diagram.py", line 88, in mod_entry
    if (opt_output != None):    natlas_obj.write_diagram(opt_output, opt_title)
  File "/home/orgitnized/natlas/natlas/natlas.py", line 125, in write_diagram
    self.diagram.generate(output_file, diagram_title)
  File "/home/orgitnized/natlas/natlas/output_diagram.py", line 108, in generate
    output_func(f)
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1673, in new_method
    encoding=encoding)
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1756, in write
    s = self.create(prog, format, encoding=encoding)
  File "/home/orgitnized/.local/lib/python3.6/site-packages/pydot.py", line 1867, in create
    raise OSError(*args)
FileNotFoundError: [Errno 2] "dot" not found in path.

All my stuff looks fine otherwise:

orgitnized@tools:~/natlas$ python3 natlas-cli.py list
natlas v0.11-dev6
Michael Laforest <mjlaforest@gmail.com>
Python 3.6.5

Module                  Version   Status    Author                    About
------                  -------   ------    ------                    -----
checkconfig             0.1       OK        Michael Laforest          Validate the config
showconfig              0.1       OK        Michael Laforest          Display the config
get-hosts               0.1       OK        Michael Laforest          Display details about connected hosts
newconfig               0.1       OK        Michael Laforest          Generate a new config
tracemac                0.1       OK        Michael Laforest          Trace a MAC address through a layer 2 network.
diagram                 0.11      OK*       Michael Laforest          Discover and diagram the network
get-arp-table           0.1       OK        Michael Laforest          Display the ARP table
get-mac-table           0.1       OK        Michael Laforest          Get MAC table from device

* Development version 0.11-dev6 overrides disabled modules.
orgitnized commented 6 years ago

Ok, I performed an apt-get install graphviz and now it looks like it's working on Ubuntu. That's some progress ;)

orgitnized commented 6 years ago

Also did a brew install graphviz on high sierra and that looks like it's working now as well.

KbYll commented 6 years ago

Hello, i have a problem during installation : 430 git clone https://github.com/MJL85/natlas.git 431 cd natlas/ 432 ls 433 python setup.py install

python setup.py install Traceback (most recent call last): File "setup.py", line 21, in _version = imp.load_source('', 'mnetsuite/_version.py') IOError: [Errno 2] No such file or directory

Can you help me ?

KbYll commented 6 years ago

Ok now, for debian(9.5) :

sudo echo "deb http://ftp.fr.debian.org/debian testing main" >> /etc/apt/sources.list sudo apt-get update sudo apt-get install -y python3.6 sudo apt-get install python3-pip

pip3 install pysnmp pip3 install pydot pip3 install netaddr

cd natlas chmod +x natlas-cli.py chmod +x setup.py

python3 natlas-cli.py list natlas v0.12 Michael Laforest mjlaforest@gmail.com Python 3.6.6

Module Version Status Author About


checkconfig 0.1 OK Michael Laforest Validate the config showconfig 0.1 OK Michael Laforest Display the config get-mac-table 0.1 OK Michael Laforest Get MAC table from device tracemac 0.1 OK Michael Laforest Trace a MAC address through a layer 2 network. newconfig 0.1 OK Michael Laforest Generate a new config get-arp-table 0.1 OK Michael Laforest Display the ARP table get-hosts 0.1 OK Michael Laforest Display details about connected hosts diagram 0.11 OK Michael Laforest Discover and diagram the network

hktalent commented 5 years ago

@fatman00 @MJL85

natlas# python3 setup.py install
Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    _version = imp.load_source('', 'mnetsuite/_version.py')
  File "/usr/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 780, in get_code
  File "/usr/lib/python3.6/imp.py", line 158, in get_data
    return super().get_data(path)
  File "<frozen importlib._bootstrap_external>", line 832, in get_data
FileNotFoundError: [Errno 2] No such file or directory: 'mnetsuite/_version.py'

natlas# python3 natlas-cli.py list
natlas v0.12
Michael Laforest <mjlaforest@gmail.com>
Python 3.6.6

Traceback (most recent call last):
  File "natlas-cli.py", line 306, in <module>
    main(sys.argv[1:])
  File "natlas-cli.py", line 76, in main
    modules = load_modules()
  File "natlas-cli.py", line 119, in load_modules
    for f in os.listdir(working_dir + '/modules'):
FileNotFoundError: [Errno 2] No such file or directory: '/modules'
hktalent commented 5 years ago

I change "for f in os.listdir(working_dir + '/modules'):" to "for f in os.listdir('./modules'):" and that made it work for me on Windows and Ubuntu

so is ok @fatman00 @orgitnized @MJL85 @KbYll @jasonbarbee

MJL85 commented 5 years ago

committed path fix to 0.12.1