lopes / netbox-scanner

A scanner util for NetBox
MIT License
164 stars 39 forks source link

Add prefix to discovered IP address #7

Closed mikeb93 closed 4 years ago

mikeb93 commented 5 years ago

This will add the prefix when adding a IP to netbox which will put the IP addresses into the correct prefix. Before, IP addresses would not get added into the correct prefix due to the /32 subnet mask.

mikeb93 commented 5 years ago

Hi @forkd I just added an argument for the prefix addition. It's working in my environment but please check if the implementation is ok like this.

Let me know if you still want some changes. Thanks! :)

ohobby commented 4 years ago

Hi, must i then use -p 24 for the right prefix or only -p and then the prefix is used by the network above?

Thanks

mikeb93 commented 4 years ago

Hi, -p will be enough as it will search for the parent prefix and add the correct length

houbidoo commented 4 years ago

as mentioned in #8

netbox@ipam:/opt/netbox-scanner/netbox-scanner/netbox-scanner-master/netbox-scanner$ sudo python3 nbscanner Traceback (most recent call last): File "nbscanner", line 75, in netbox_conf.getboolean('tls_verify'), general_conf['vrf'], general_conf['nmap_args'], File "/usr/lib/python3.6/configparser.py", line 1233, in getitem raise KeyError(key) KeyError: 'vrf'

houbidoo commented 4 years ago

Hi,

Question: How can I get the DNS_Name field be filled? Made all the changes, IP Prefix worked, but not the DNS_Name Resolution

mikeb93 commented 4 years ago

Hi sorry for the late reply. I think that’s being handled by nmap. It’s been some time since I’ve fiddled around with this script but as far as I can remember nmap should actually do a reverse lookup and this data should be used as dns_name.

I could be totally wrong though. I don’t remember that my PR has anything to do with dns_name though? Again, long time, am on mobile so I can’t check the code now.

lopes commented 4 years ago

Just updated the whole repository for v2. This pull-request is not compatible anymore.