lopes / netbox-scanner

A scanner util for NetBox
MIT License
158 stars 40 forks source link

nothing is imported into netbox #40

Open MROSSFTEK opened 2 months ago

MROSSFTEK commented 2 months ago

im running python3 netbox-scanner.py nmap

its saying started 0 hosts.. the samples i ran and it went out and did nmap discovery , created the xml file and everything. am i literally doing it wrong?

andreigollo commented 2 months ago

We tried the same. Apparently this does not work anymore even for a year the users had the same issues. Basically inmap identifes the hosts but cannot connect to netbox in any way. The project's last change was 2 years ago, I imagine all libraries have changed , even netbox probably

MROSSFTEK commented 2 months ago

shame.. had promise

andreigollo commented 2 months ago

yes , the proble seems at the connection to netbox, there we get a bad request so i guess the api has changed or something.

MROSSFTEK commented 2 months ago

i can run the sudo ./nmap-scan.sh script.. runs.. finds what it should.. comes back with a file.. but of course it doesnt do anything if i run python3 netbox-scanner.py i get this Traceback (most recent call last): File "/opt/netbox/netbox/netbox-scanner/netbox-scanner-master/netbox-scanner.py", line 15, in argument = str(sys.argv[1]) IndexError: list index out of range

andreigollo commented 2 months ago

you should use python3 netbox-scanner.py nmap , but that command is already inside nmap-scan.sh script. copy nmap-scan.sh to the same folder as netbox-scanner. We use as address = '217.0.0.1:8001'

MROSSFTEK commented 2 months ago

so run python3 netbox-scanner.py nmap 127.0.0.1:8001 (assuming the IP here) all in one command? i have the address of the netbox in the conf file already

MROSSFTEK commented 2 months ago

if i run python3 netbox-scanner.py nmap what it comes back with is just started: 0 hosts finished: .0 +0 ~0 !0 thats all it says LOL

andreigollo commented 2 months ago

ok, when you run the nmap-scan.sh it creates the xml files, it calls the netbox-scanner.py and it archives the files at the end. When you run only the netbox-scanner , there are no xml files as input for it. so you must comment out the last 2 lines in nmap-scanner so the xml remain in place. After you can call netbox-scanner as oftne as you want as it gets the files

MROSSFTEK commented 2 months ago

got it.. but.. what do i do with the XML files and how do i get it to import them into the netbox system?

MROSSFTEK commented 2 months ago

got it! had to put a scans folder in the root of /opt/netbox then i changed the .sh script to move . xml files from the netbox scanner dir to that scans dir, it then runs the .py to import, then deletes the .xml files.. voila