DEV Community

Saif Ali
Saif Ali

Posted on

Nmap XML Parser v1.1 with MariaDB | Python Security Project

Nmap XML Parser v1.1 with MariaDB | Python Security Project

Introduction

I built a Python-based Nmap XML Parser to automate the extraction and storage of network scan results.

The project reads an Nmap XML scan report, extracts important information such as IP addresses, open ports, services, and port states, and stores the results in a MariaDB database.

Project Overview

The main goal of this project was to practice network security automation, XML parsing, and database integration.

Instead of manually reviewing Nmap XML output, the parser automatically processes the scan results and organizes them into structured database records.

What the Tool Does

The parser:

  • Reads Nmap XML scan reports
  • Extracts IP addresses
  • Identifies open ports
  • Extracts service information
  • Extracts port states
  • Stores scan results in MariaDB
  • Organizes data into relational database tables

Technologies Used

  • Python
  • Nmap
  • XML
  • MariaDB
  • MySQL Connector
  • Kali Linux
  • Git
  • GitHub

How It Works

The workflow is:

Nmap Scan

XML Scan Report

Python XML Parser

Extract Network Information

MariaDB Database

Structured Security Data

For example, an Nmap XML report can contain information about a scanned host and its available ports.

The parser processes this XML data and extracts the relevant security information automatically.

MariaDB Integration

I integrated the Python parser with MariaDB using MySQL Connector.

The extracted information is stored in separate database tables, including:

  • Scanned_Devices
  • Open_Ports

This makes the scan results easier to query, analyze, and manage.

Example Result

A sample scan identified:

  • IP Address: 127.0.0.1
  • Port: 8000
  • State: open
  • Service: http-alt

The parser then stores this information in the database.

Why This Project Matters

Nmap is commonly used for network discovery and security assessment.

Automating the processing of Nmap results can help reduce manual work and provide a structured way to store network information for further analysis.

This project demonstrates how Python can be used to connect network security tools with database systems.

Learning Outcomes

Through this project, I gained practical experience in:

  • Nmap network scanning
  • XML parsing
  • Python automation
  • MariaDB database integration
  • SQL database management
  • Network security analysis
  • Linux/Kali Linux
  • Git and GitHub

Future Improvements

Possible future improvements include:

  • Automated scheduled scanning
  • More detailed service analysis
  • Vulnerability information integration
  • Web-based security dashboard
  • Historical scan comparison
  • Automated security reports
  • Risk-based findings

GitHub Repository

The complete project source code is available on my GitHub portfolio:

https://github.com/Saif2246/CyberSecurity-Portfolio

Conclusion

This project helped me strengthen my practical understanding of network reconnaissance, Python automation, XML processing, and database integration.

It is the first project in my practical Cloud Security and GRC learning portfolio, where I am focusing on building security tools and documenting my learning journey.

python #security #networksecurity #linux

Top comments (0)