Network Device Discovery Script

A Python-based network device discovery script that identifies and catalogs devices on a network using fingerprinting techniques, with results exported to an Excel spreadsheet.

Custom Software SolutionsWeb Scraping & Automation

Date: August 24, 2021

Tags:Custom Software SolutionsWeb Scraping & Automation

Client: Upwork Client - Confidential

Team: Louis Gauthier

Network Device Discovery Script

Overview

The Network Device Discovery Script is a Python-based tool we developed at Digiwave to streamline the identification and cataloging of devices within a local network. By leveraging fingerprinting techniques through Nmap, the script efficiently scans the specified subnet, identifies device types (such as Windows, Linux, etc.), and exports the results to an Excel spreadsheet for easy storage and analysis. This solution enhances network management capabilities, improves security by providing visibility into connected devices, and aids in maintaining an organized network inventory.

Project Details

Challenge

Managing and securing a network requires a comprehensive understanding of all connected devices. Traditional methods of manually cataloging devices are time-consuming and prone to errors, especially in dynamic environments where devices frequently join or leave the network. The primary challenges we addressed were:

  1. Automated Device Identification: Developing a reliable method to automatically discover and identify devices on a network.
  2. Efficient Data Storage: Organizing discovered device information in a structured and easily accessible format.
  3. Scalability and Performance: Ensuring the script performs efficiently on large networks without excessive time consumption.
  4. User-Friendly Output: Providing results in a format that is easy to interpret and utilize for network management purposes.

Solution

To address these challenges, we developed a Python script that leverages Nmap for network scanning and fingerprinting, combined with openpyxl for Excel file manipulation. The key components of the solution include:

  1. Automated Scanning: Utilizing Nmap’s capabilities to perform comprehensive scans of the specified subnet, identifying devices based on their fingerprint signatures.
  2. Data Processing and Storage: Capturing essential device information such as IP address, MAC address, operating system, vendor, status, and hostname, and storing this data systematically in an Excel spreadsheet.
  3. Timeout Management: Implementing timeout mechanisms to handle long-running scans and ensure the script remains responsive and efficient.
  4. User Customization: Allowing users to configure scanning parameters such as target subnet, output filename, and timeout durations to suit different network environments and requirements.

Sample Output

Below is a sample of the Excel output generated by the Network Device Discovery Script:

IP AddressMAC AddressEstimated OSVendorStatusHostname
192.168.1.1AA:BB:CC:DD:EE:FFLinux 4.15 - 4.19Cisco SystemsUprouter.home
192.168.1.1011:22:33:44:55:66Microsoft Windows 10Dell Inc.Upworkstation-01.local
192.168.1.1577:88:99:AA:BB:CCApple macOS 10.14Apple Inc.Downmacbook-pro.local
192.168.1.20NoneNoneNoneUpprinter-01.local

MAC Addresses are obfuscated for privacy.

Technologies Used

  • Programming Language: Python
  • Libraries:
    • python-nmap: Facilitates network scanning and device fingerprinting using Nmap.
    • openpyxl: Enables reading from and writing to Excel spreadsheets.
  • Tools:
    • Nmap: A powerful network scanning tool used for discovering devices and services on a network.

Development Process

The development of the Network Device Discovery Script was completed in just one day, as part of an urgent request with a very short deadline. The entire process, from understanding the client's needs and agreeing on the expected results, to reviewing the code and providing usage instructions, was accomplished in just a few days. This project highlights our flexibility in meeting tight deadlines while maintaining clear communication and delivering quality results. The process involved:

  • Requirement Gathering: Understanding the need for automated network device discovery and the desired output format.
  • Script Development: Writing the Python script to perform network scanning using Nmap, processing the results, and exporting the data to Excel.
  • Testing and Optimization: Running the script in various network environments to ensure reliability, accuracy of device identification, and performance optimization.
  • Documentation: Creating comprehensive instructions and a README file to guide users in installing dependencies, configuring the script, and executing it with the necessary privileges.

Team Roles

  • Louis Gauthier: Lead Developer responsible for scripting, testing, and documentation.

Results

The Network Device Discovery Script successfully automated the process of identifying and cataloging devices within a local network. Key outcomes include:

  • Time Efficiency: We significantly reduced the time required to discover and list network devices compared to manual methods.
  • Accuracy: We provided reliable identification of devices and their operating systems, aiding in network management and security.
  • Ease of Use: The script’s output in an Excel spreadsheet format made it accessible and easy to analyze for network administrators.
  • Scalability: The solution is capable of handling large networks by efficiently managing scan timeouts and resource usage.

Future Enhancements

To further improve the Network Device Discovery Script, the following enhancements are considered:

  • Security Features: We plan to implement features to detect unauthorized or rogue devices on the network and notify administrators.
  • Automatic Alerts: Implementing email notifications or alerts for specific device types or status changes detected during scans.
  • Integration with Other Tools: We could enable integration with network management systems or dashboards for streamlined network oversight.
  • User Interface: Developing a graphical user interface (GUI) to make the script more accessible to users without programming experience.

Conclusion

The Network Device Discovery Script exemplifies Digiwave’s expertise in developing practical and efficient solutions for network management. By automating the discovery and cataloging of network devices, the script enhances visibility into network infrastructure, aids in security management, and simplifies administrative tasks.


This project was developed by Louis Gauthier at Digiwave. For more information about our services, visit Digiwave's Portfolio.

Ready to Work with Us?

Let's collaborate to bring your ideas to life. Get in touch with us to discuss your project requirements.