Skip to content

iamx-ariful-islam/Port-Info-Lookup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔌 Port Info Lookup

A lightweight and reliable Python utility that fetches and displays port information (service name, protocol, and description) using the official IANA service-names-port-numbers dataset.


📖 Overview

This tool allows you to easily find which protocol or service runs on a specific port, leveraging the official IANA port assignments.


✨ Features

  • Fetch port details directly from the IANA official dataset
  • Automatically downloads and caches the CSV file
  • Lookup service name, port number, transport protocol, and description
  • Lightweight and dependency-minimal (only requests)

📦 Installation

git clone https://github.com/iamx-ariful-islam/port-info-lookup.git
cd port-info-lookup
pip install .
# or
python setup.py install

📂 Folder / File Structure

port-info-lookup/
│
├── data_files/
│   │
│   └── ports_details.csv
│
├── port_info.py
├── README.md
├── requirements.txt
├── setup.py
└── test.py

🚀 Usage

from port_info import port_info

info = port_info(22)

if info:
    print(f"Port number        : {info['port_number']}")
    print(f"Transport protocol : {info['transport_protocol']}")
    print(f"Service name       : {info['service_name']}")
    print(f"Description        : {info['description']}")
else:
    print("No information found for this port.")


"""output:
Port number        : 22
Transport protocol : tcp
Service name       : ssh
Description        : The Secure Shell (SSH) Protocol
"""

⚙️ Dependencies

The requirements.txt file, lists of all the Python libraries that my "port info lookup" depends on and installs those packages from the file:

pip install -r requirements.txt
# or
sudo pip install -r requirements.txt

📜 Note

Fetches url for port information using the IANA service-names-port-numbers dataset:

IANA_URL = "https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv"

💡 Future Enhancements

  • Add search by service name or protocol
  • Command-line interface (CLI)
  • Offline mode with cached dataset validation

Contributing

Contributions, suggestions, and feedback are always welcome! ❤️ To contribute:

  1. Fork the repository
  2. Create a new branch (feature/new-feature)
  3. Commit your changes
  4. Push and submit a Pull Request

💬 You can also open an issue if you’d like to discuss a feature or report a bug.

For more or connect with me

                   

License

The MIT License (MIT)

About

A Python utility to fetch and look up network port details using IANA's port assignments

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages