Code Monkey home page Code Monkey logo

networkaudit's Introduction

Network Automation Scripts

This repository contains a collection of Python scripts for network automation tasks. These scripts utilize the scrapli library for SSH connections, networkx for network topology visualization, and various other libraries for parsing and processing data from network devices.

Input hosts file template is added to the repository.

Prerequisites

Make sure you have Python 3 installed. You can install the required libraries using the provided requirements.txt file:

pip install -r requirements.txt

Script Descriptions

1. GetDevices.py

This script fetches CDP/LLDP neighbor information from network devices specified in a CSV file and builds a network topology. It then visualizes the topology using networkx and matplotlib.

Usage:

  1. Modify the CSV file hosts.csv to include the details of network devices.
  2. Run the script:
    python GetDevices.py
    

2. GetHostnames.py

This script connects to network devices, retrieves the hostname, and updates the hostname in the input CSV file.

Usage:

  1. Modify the CSV file hosts.csv to include the details of network devices.
  2. Run the script:
    python GetHostnames.py
    

3. MacLookup.py

This script parses MAC address table information from network devices' show commands and saves the results in a CSV file.

Usage:

  1. Place show command output files in the output directory.
  2. Run the script:
    python MacLookup.py
    

4. RemoveFiles.py

This script iterates over directories and deletes files with "_diff.txt" in their names.

Usage:

  1. Modify the directory_path variable in the script if needed.
  2. Run the script:
    python RemoveFiles.py
    

5. RunDiff.py

This script compares two directories containing files and generates diff files for differences.

Usage:

  1. Modify the main_directory1 and main_directory2 variables in the script.
  2. Run the script:
    python RunnDiff.py
    

6. SaveInfo.py

This script connects to network devices, executes commands, and saves the command output in files.

Usage:

  1. Modify the CSV file hosts.csv to include the details of network devices.
  2. Place the commands to be executed in the commands.csv file.
  3. Run the script:
    python SaveInfo.py
    

7. SaveVersion.py

This script parses version information from network devices' show version commands and saves the results in a CSV file.

Usage:

  1. Modify the directory_path variable in the script
  2. Place show command output files in the directory_path directory
  3. Run the script:
    python SaveVersion.py
    

Author

Alexander Deca - Deca Consulting Date: 06/07/2023 For remarks/questions [email protected]

Note

These scripts are provided as-is and may require adjustments based on your network environment and device configurations. Please review and modify the scripts before using them in production environments.

networkaudit's People

Contributors

alexanderdeca avatar

Stargazers

 avatar Humberto Galiza avatar

Watchers

 avatar

Forkers

uozsan

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.