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.
This tool allows you to easily find which protocol or service runs on a specific port, leveraging the official IANA port assignments.
- 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)
git clone https://github.com/iamx-ariful-islam/port-info-lookup.git
cd port-info-lookup
pip install .
# or
python setup.py installport-info-lookup/
│
├── data_files/
│ │
│ └── ports_details.csv
│
├── port_info.py
├── README.md
├── requirements.txt
├── setup.py
└── test.pyfrom 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
"""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.txtFetches 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"- Add search by service name or protocol
- Command-line interface (CLI)
- Offline mode with cached dataset validation
Contributions, suggestions, and feedback are always welcome! ❤️ To contribute:
- Fork the repository
- Create a new branch (
feature/new-feature) - Commit your changes
- Push and submit a Pull Request
💬 You can also open an issue if you’d like to discuss a feature or report a bug.
The MIT License (MIT)