ytti / netcrawl Goto Github PK
View Code? Open in Web Editor NEWLLDP/CDP crawler
LLDP/CDP crawler
undefined method banner' for #<NetCrawl::CLI:0x000000024b8050> /usr/local/rvm/gems/ruby-2.2.0/gems/netcrawl-0.0.8/lib/netcrawl/cli.rb:42:in
block in opt_parse': undefined method banner' for #<NetCrawl::CLI:0x000000024b8050> (NoMethodError) from /usr/local/rvm/gems/ruby-2.2.0/gems/slop-4.0.0/lib/slop/options.rb:33:in
initialize'
from /usr/local/rvm/gems/ruby-2.2.0/gems/slop-4.0.0/lib/slop.rb:24:in new' from /usr/local/rvm/gems/ruby-2.2.0/gems/slop-4.0.0/lib/slop.rb:24:in
parse'
from /usr/local/rvm/gems/ruby-2.2.0/gems/netcrawl-0.0.8/lib/netcrawl/cli.rb:41:in opt_parse' from /usr/local/rvm/gems/ruby-2.2.0/gems/netcrawl-0.0.8/lib/netcrawl/cli.rb:30:in
initialize'
from /usr/local/rvm/gems/ruby-2.2.0/gems/netcrawl-0.0.8/bin/netcrawl:5:in new' from /usr/local/rvm/gems/ruby-2.2.0/gems/netcrawl-0.0.8/bin/netcrawl:5:in
<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.0/bin/netcrawl:23:in load' from /usr/local/rvm/gems/ruby-2.2.0/bin/netcrawl:23:in
eval' from /usr/local/rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in
'
Here is the install info:
gem install netcrawl
Fetching: snmp-1.2.0.gem (100%)
Successfully installed snmp-1.2.0
Fetching: slop-4.0.0.gem (100%)
Successfully installed slop-4.0.0
Fetching: asetus-0.2.0.gem (100%)
Successfully installed asetus-0.2.0
Fetching: netcrawl-0.0.8.gem (100%)
Successfully installed netcrawl-0.0.8
Parsing documentation for snmp-1.2.0
Installing ri documentation for snmp-1.2.0
Parsing documentation for slop-4.0.0
Installing ri documentation for slop-4.0.0
Parsing documentation for asetus-0.2.0
Installing ri documentation for asetus-0.2.0
Parsing documentation for netcrawl-0.0.8
Installing ri documentation for netcrawl-0.0.8
Done installing documentation for snmp, slop, asetus, netcrawl after 1 seconds
4 gems installed
Are you using a different version of slop ?
Hey all, I am pretty much useless in Ruby, but got this issue when running this on a pretty large Cisco network:
Traceback (most recent call last):
24: from /usr/local/bin/netcrawl:23:in `<main>'
23: from /usr/local/bin/netcrawl:23:in `load'
22: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/bin/netcrawl:5:in `<top (required)>'
21: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/cli.rb:10:in `run'
20: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
19: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `recurse'
18: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `each'
17: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:33:in `block in recurse'
16: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
15: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `recurse'
14: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:30:in `each'
13: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:33:in `block in recurse'
12: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
11: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:28:in `recurse'
10: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `get'
9: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `each'
8: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl.rb:19:in `block in get'
7: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:10:in `peers'
6: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:15:in `poll'
5: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `make_peers'
4: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `each'
3: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:21:in `block in make_peers'
2: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `as_ip'
1: from /Library/Ruby/Gems/2.6.0/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `new'
/Library/Ruby/Gems/2.6.0/gems/snmp-1.3.2/lib/snmp/varbind.rb:293:in `initialize': Expected 4 octets or formatted string, got "" (SNMP::InvalidIpAddress)
Any ideas?
I installed netcrawl on an Ubuntu 14.04 machine via gem, and I seem to have a problem with source interfaces not populating across a wide range of devices. This seems to be causing issues for the json and yaml output as well. When I output everything as a hash, here's what I see:
{"ip"=>"10.25.0.18",
"name"=>"10.25.0.18",
"interface"=>{"source"=>"", "destination"=>"GigabitEthernet1/0/10"},
"raw"=>{"ip"=>"\n\x19\x00\x12", "name"=>"CoreA_H968_3750X"}},
Every interface source is blank on all of our devices, no matter what the model is.
Any help would be appreciated, because otherwise this seems to be a great program for some work I'm doing.
Thanks!
Hello it's me again.
I would like netcrawl to also put the mac address of the neighbour in the output.
I'm not very comfortable with ruby yet so I apologize for my lack of knowledge.
I made these changes to the peer.rb file :
:mac
to attr_accessor
@mac
to the initialize
method'mac address' => mac.to_s
, to the to_hash
methodThen for the lldp.rb, I don't really understand how the code works, and thus how to add the mac address.
I know the MIB for the mac address is 1.0.8802.1.1.2.1.4.1.1.5 but that's it.
Adding peer.mac = @mib[OID[:lldpRemChassisId], peer_id].value
gave me the "wrong number of arguments (1 for 0)" error.
Any help would be appreciated.
And thanks for the program, my internship tutor really likes it.
I dont know if the error is in netcrawl or ruby-snmp.
But if you get a CDP Neigbour with ipv6 adress you get an error.
# netcrawl -d -a 10.123.3.1
Expected four octets separated by dots, not "\xFE\x80\x00\x00\x00\x00\x00\x00\x06\xEB@\xFF\xFE\xD9\xDC\x05"
/usr/local/share/gems/gems/snmp-1.3.2/lib/snmp/varbind.rb:345:in `parse_string': Expected four octets separated by dots, not "\xFE\x80\x00\x00\x00\x00\x00\x00\x06\xEB@\xFF\xFE\xD9\xDC\x05" (SNMP::InvalidIpAddress)
from /usr/local/share/gems/gems/snmp-1.3.2/lib/snmp/varbind.rb:291:in `initialize'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `new'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/snmp.rb:132:in `as_ip'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:21:in `block in make_peers'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `each'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/cdp.rb:17:in `make_peers'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:15:in `poll'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/method/xdp.rb:10:in `peers'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:19:in `block in get'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `each'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:18:in `get'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:28:in `recurse'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl.rb:10:in `crawl'
from /usr/local/share/gems/gems/netcrawl-0.1.0/lib/netcrawl/cli.rb:10:in `run'
from /usr/local/share/gems/gems/netcrawl-0.1.0/bin/netcrawl:5:in `<top (required)>'
from /usr/local/bin/netcrawl:23:in `load'
from /usr/local/bin/netcrawl:23:in `<main>'
The SNMP output from snmpwalk of the relevant part is
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10101.2 = Hex-STRING: 0A 7B 03 02
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10102.3 = Hex-STRING: AC 1A 19 22
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10110.1 = Hex-STRING: FE 80 00 00 00 00 00 00 06 EB 40 FF FE D9 DC 05
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10117.4 = Hex-STRING: 0A 7B 03 06
SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.4.10121.5 = Hex-STRING: 0A 7B 03 04
The image produced was hard for me to read because the elements were so tightly grouped. I used the following to space them out.
"
graph NetCrawl {
nodesep=2;
splines=true;
sep="+25,25";
_10_21_143_203[label=....
"
awesome software.
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.