Giter Site home page Giter Site logo

mac's Introduction

Network Hosts Audit and Lookup

Real world tool to audit all the IPv4 hosts in your network and find where they are connected (to which access switch) assuming that interface description is correct (the latter can easily be replaced with LLDP or CDP data, if available).

Used Frameworks

  • Nornir
  • Scrapli (Nornir tasks)

Why not NAPALM?

This tool was created for a particular real-world environment, where upgrade of the software version was not possible. We tried to use NAPALM, but it failed to pull ARP table from network switches running Arista EOS.

Usage

  1. Populate inventory following Nornir's SimpleInventory:
$ cat inventory/hosts.yaml
---
core1-row1:
  hostname: 192.168.255.11
  groups:
    - core
access1-row13
  hostname: 192.168.255.101
  groups:
    - access
...


$ cat inventory/groups.yaml
---
core:
  platform: eos
  data:
    role: core
access:
  platform: ios
  data:
    role: access
...

$ cat inventory/defaults.yaml
---
username: test
password: test
## Add scrapli details
connection_options:
  scrapli:
    port: 22
    extras:
      ssh_config_file: True
      auth_strict_key: False
...
  1. To see all IPs/MACs in the network, run it with -a argument:
$ python main.py -c environment -a
178 results found:
{
    "192.168.1.11": {
        "interface": "GigabitEthernet1/17",
        "mac": "ac1f.6b21.ed22",
        "server": "HYPERVISOR-1",
        "switch": "access1-row13",
        "vlan": 100
    }
    ,
    ...
}
  1. To find a specific IP in the network, run it with -q ip=x.x.x.x argument:
$ python main.py -c environment -q ip=192.168.1.11
3 results found:
{
    "192.168.1.11": {
        "interface": "GigabitEthernet1/17",
        "mac": "ac1f.6b21.ed22",
        "server": "HYPERVISOR-1",
        "switch": "access1-row13",
        "vlan": 100
    }
}
  1. To find a specific MAC in the network, run it with -q mac=aaaa.bbbb.cccc argument:
$ python main.py -c environment -q mac=ac1f.6b21.ed22
3 results found:
{
    "192.168.1.11": {
        "interface": "GigabitEthernet1/17",
        "mac": "ac1f.6b21.ed22",
        "server": "HYPERVISOR-1",
        "switch": "access1-row13",
        "vlan": 100
    },
    "192.168.1.12": {
        "interface": "GigabitEthernet1/17",
        "mac": "ac1f.6b21.ed22",
        "server": "HYPERVISOR-1",
        "switch": "access1-row13",
        "vlan": 100
    },
    "192.168.1.13": {
        "interface": "GigabitEthernet1/17",
        "mac": "ac1f.6b21.ed22",
        "server": "HYPERVISOR-1",
        "switch": "access1-row13",
        "vlan": 100
    }
}

mac's People

Contributors

akarneliuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.