Comments (5)
It looks like a mismatch between pynetbox v3.4.6 and NetBox v2.5.8 --I built this script using NetBox v2.4.4 and current version of pynetbox is 4.0.6.
I can't reproduce this environment right now (NetBox v2.5.8), but just made a new commit updating all versions of dependencies. Please, try this new version and send me a reply (it worked for me pynetbox v4.0.6 and NetBox v2.4.4).
from netbox-scanner.
Ok,
downloaded new zip from master:
pip install --upgrade -r requirements.txt
root@b456e5f91474:~/netbox-scanner# pip freeze
asn1crypto==0.24.0
bcrypt==3.1.6
certifi==2019.3.9
cffi==1.12.2
chardet==3.0.4
cpe==1.2.1
cryptography==2.6.1
idna==2.8
netaddr==0.7.19
paramiko==2.4.2
pyasn1==0.4.5
pycparser==2.19
PyNaCl==1.3.0
pynetbox==4.0.6
python-nmap==0.6.1
requests==2.21.0
six==1.12.0
urllib3==1.24.1
i see pynetbox changing to 4.0.6 ...
Running the scanner, i get the same error:
root@b456e5f91474:~/netbox-scanner# python netbox-scanner-master/netbox-scanner/nbscanner
Traceback (most recent call last):
File "netbox-scanner-master/netbox-scanner/nbscanner", line 75, in <module>
nbs.sync(networks)
File "/root/netbox-scanner/netbox-scanner-master/netbox-scanner/nbscanner.py", line 223, in sync
self.sync_network(network)
File "/root/netbox-scanner/netbox-scanner-master/netbox-scanner/nbscanner.py", line 157, in sync_network
self.sync_host(host)
File "/root/netbox-scanner/netbox-scanner-master/netbox-scanner/nbscanner.py", line 131, in sync_host
nbhost = self.netbox.ipam.ip_addresses.get(address=host[0])
File "/usr/local/lib/python3.7/site-packages/pynetbox/core/endpoint.py", line 135, in get
filter_lookup = self.filter(**kwargs)
File "/usr/local/lib/python3.7/site-packages/pynetbox/core/endpoint.py", line 220, in filter
ret = [self._response_loader(i) for i in req.get()]
File "/usr/local/lib/python3.7/site-packages/pynetbox/core/query.py", line 239, in get
return req_all(self.url)
File "/usr/local/lib/python3.7/site-packages/pynetbox/core/query.py", line 217, in req_all
req = make_request(url)
File "/usr/local/lib/python3.7/site-packages/pynetbox/core/query.py", line 214, in make_request
raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 400 Bad Request but more specific details were not returned in json. Check the NetBox Logs or investigate this exception's error attribute.
In the server side running in development mode with DEbug=True I see:
----------------------------------------
Exception happened during processing of request from ('10.0.4.6', 56748)
Traceback (most recent call last):
File "/usr/local/lib/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.7/socketserver.py", line 720, in __init__
self.handle()
File "/usr/local/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 171, in handle
self.handle_one_request()
File "/usr/local/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 179, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('10.0.4.6', 56752)
Traceback (most recent call last):
File "/usr/local/lib/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python3.7/socketserver.py", line 720, in __init__
self.handle()
File "/usr/local/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 171, in handle
self.handle_one_request()
File "/usr/local/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 179, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer
----------------------------------------
from netbox-scanner.
pynetbox.core.query.RequestError: The request failed with code 400 Bad Request but more specific details were not returned in json. Check the NetBox Logs or investigate this exception's error attribute.
Connection reset errors could be related to network or web server issues. Using the same environment you're running the script, you could open Python shell and simulate that interaction:
>>> from pynetbox import api
>>> nb = api('netbox_addr', token='token_goes_here', ssl_verify=False)
>>> nb.ipam.ip_addresses.get(address='ip_addr')
Try with IP addresses that are registered and not registered in NetBox. You could even try with some invalid values, like address=None
or address=84
. How will NetBox behave?
from netbox-scanner.
Another clue:
https://stackoverflow.com/questions/1434451/what-does-connection-reset-by-peer-mean
from netbox-scanner.
Thanks, this actually was helpful debugging.
The issue seems to have been caused by using the short name for the netbox server in the scanner config instead of the fqdn that Netbox has in the ALLOW_HOSTS setting.
With this and pynetbox==4.0.6 now the scanner is aadding new IPs to netbox!!!
from netbox-scanner.
Related Issues (20)
- different configs for cron run HOT 1
- [Feat] Adding reverse DNS info to DNS name in NetBox HOT 2
- Version 2.0 HOT 1
- nmap: duplicated entries detected that I cannot explain HOT 3
- Compatibility to netbox 2.9 HOT 16
- KeyError HOT 2
- Netbox-scanner fails to run with error "TypeError: __init__() got an unexpected keyword argument 'ssl_verify'"
- Misleading error message HOT 1
- Traceback error on netbox 2.10.1 HOT 1
- Is there a way to have dns_name field populated instead of description? HOT 1
- Mistake in NetBoxScanner class
- netbox-scanner.py creates IP Addresses, does not show up in Netbox HOT 1
- nmap scan not iterating through subnets HOT 1
- pip install not working HOT 1
- error when executing nmap-scan.sh HOT 1
- Could not open requirements file HOT 2
- No hosts.. wrong path? HOT 3
- No hosts being imported into Netbox while running nmap-scan HOT 2
- requirements mismatch: urllib3==1.26.5 vs requests==2.23.0 HOT 1
- nothing is imported into netbox HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netbox-scanner.