DEV Community

Saif Ali
Saif Ali

Posted on

Python Network Service Enumeration Tool | Security Project

Introduction

I built a Python-based Network Service Enumeration Tool to practice network reconnaissance, TCP port scanning, service identification, and basic security assessment.

The tool was developed and tested in a Kali Linux environment using Python socket programming and multithreading.

Project Overview

The main goal of this project was to understand how network services can be discovered by scanning TCP ports and identifying services running on open ports.

The tool performs a focused scan of commonly used ports and provides useful information about discovered services.

Key Features

• Scan TCP ports
• Identify open ports
• Map ports to common services
• Perform banner grabbing
• Use multithreading for faster scanning
• Display scan results
• Save results to a text report
• Accept a target through the command line

Technologies Used

• Python
• Socket Programming
• Threading
• Kali Linux
• Linux Networking
• Git
• GitHub

How It Works

The basic workflow is:

Target Host

TCP Port Scanner

Check Port Availability

Identify Service

Banner Grabbing

Display Results

Save Report

The tool uses Python's socket library to establish TCP connections and determine whether specific ports are accessible.

Port Scanning

The scanner checks a predefined list of commonly used TCP ports, including:

• 21 — FTP
• 22 — SSH
• 23 — Telnet
• 25 — SMTP
• 53 — DNS
• 80 — HTTP
• 110 — POP3
• 139 — NetBIOS
• 143 — IMAP
• 443 — HTTPS
• 445 — SMB
• 3389 — RDP
• 8000 — HTTP-Alt

The project focuses on controlled scanning of systems where authorization has been provided.

Multithreading

To improve scanning speed, the tool uses Python threading.

Instead of checking every port sequentially, multiple port checks can be performed concurrently.

This helped me understand how threading can be applied to network security tools.

Banner Grabbing

When an open service is discovered, the tool attempts to retrieve service information through banner grabbing.

For example, during testing the tool identified:

Port: 8000
Service: HTTP-Alt
Banner: HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.13.12

Banner information can help identify the type of service and, when available, the software or server version.

Example Scan

The tool can be executed with:

python3 scanner.py -t 127.0.0.1

Example result:

Target: 127.0.0.1

Scanned Ports: 14
Open Ports: 1

Port: 8000
Service: HTTP-Alt
Banner: HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.13.12

The results are also saved to:

results.txt

Security Use Case

Service enumeration is an important part of network security assessment.

Identifying open ports and exposed services can help security teams understand the attack surface of a system.

For example, unnecessary services or legacy protocols can be identified for further security review.

This tool is designed for educational purposes and authorized security testing only.

What I Learned

Through this project, I gained practical experience in:

• TCP port scanning
• Socket programming
• Network service enumeration
• Banner grabbing
• Python threading
• Command-line interfaces
• Linux networking
• Kali Linux
• Basic security assessment
• Security automation

Future Improvements

Possible future improvements include:

• UDP scanning
• More advanced service detection
• Operating system detection
• Configurable port ranges
• JSON report generation
• HTML reporting
• Risk-based service classification
• Better timeout handling
• Network scan history
• Integration with vulnerability assessment tools

GitHub Repository

The complete source code is available in my GitHub portfolio:

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

Conclusion

This project helped me strengthen my understanding of network reconnaissance and Python-based security automation.

It also gave me practical experience with sockets, TCP connections, threading, service enumeration, and banner grabbing.

This is the second project in my practical Cloud Security and GRC learning portfolio.

python #security #networksecurity #linux

Top comments (0)