Closed geaclaesson closed 1 year ago
Notable is that I don't have netxms and prime, but I don't' think that's required?
They are not required.
What does your networks.txt
look like?
I only have one network statement in there, but that network is not in the prefix list in my Netbox. Does that matter?
When I am testing, I use a completely fresh Netbox. I only create the nmap tag
and token
. So it shouldn't matter.
I can "reproduce" your error: I see the same output, when running python3 netbox-scanner.py nmap
and there are no xml files from the nmap scan.
Let's try it step by step:
docker run -it --rm -v "$PWD"/netbox-scanner.conf:/root/.netbox-scanner.conf:ro -v "$PWD"/networks.txt:/netbox-scanner/networks.txt:ro casperklein/netbox-scanner bash
Then, inside the container:
cd /netbox-scanner/
./nmap-scan.sh
That should give you the same output. Now check if there was a new xml file created
ls *.xml
There should be a file like nmap-192.168.0.0-24.xml
or similar. I think for whatever reason, there is no xml file in your setup.
Running netbox-scanner.py
without xml files, shows this output:
python3 netbox-scanner.py nmap
started: 0 hosts
finished: .0 +0 ~0 -0 !0
I'm not able to try it until Monday, but what could cause the xml not to be written? Could it be a directory structure difference? Is there a command that needs to be done with sudo?
but what could cause the xml not to be written?
I don't know. That was just a guess from my tests. I'll do my tests in a Debian 11 VM. You could try the same, to see if that makes a difference.
So this was interesting;
Send networks to Netbox..
Traceback (most recent call last):
File "/netbox-scanner/netbox-scanner.py", line 34, in
I'm running Ubuntu, and since I'm not too used to linux/ubuntu I've been installing things with sudo / sudo su, I'm unsure if that's gotten me in trouble.
Alright, so coming back to this, I've had to change permissions and my nmap directory was set wrong. However, I now get an .xml file as a result of the code you gave me above. it's sitting in the netbox-scanner directory
I lost a bit track, what exactly you did. However, at the point, that you have a xml file, you should be able to run
python3 netbox-scanner.py nmap
in that directory. This will parse the xml and send the IPs to Netbox.
Maybe, the original docker-less netbox-scanner might better work for you.
Whichever version I use, no matter the edits, at the end, all I get is: OS detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 256 IP addresses (12 hosts up) scanned in 14.63 seconds
Send networks to Netbox.. started: 0 hosts finished: .0 +0 ~0 -0 !0
It has generated a xml file and it's in the directory. Is there a simple configuration issue I've made?
Is there a simple configuration issue I've made?
Probably. But without knowing the exact steps you do and the configuration used, it's hard to tell 🤷
Don't get me wrong, but all I can say is, that if I follow the few steps in the README, it works flawlessly for me.
Nmap done: 256 IP addresses (12 hosts up) scanned in 12.35 seconds
Send networks to Netbox.. started: 0 hosts finished: .0 +0 ~0 -0 !0
What could be causing this? There are no apparent issues when the script is run.
I am a new to this, but I've added in the address and the token to the config file (token has write permissions). Notable is that I don't have netxms and prime, but I don't' think that's required?