A python library that contains various tools that I have found useful over the years.
Project description
Unitools
unitools is a cohesive collection of utility tools designed for Python 3, encapsulating various utility functions developed over the years. Given the absence of such tools in earlier times, unitools serves as a treasure trove for developers seeking a unified solution for various tasks.
Installation
You can install unitools via pip:
pip install unitools
Modules
unitools offers multiple modules, each tailored for a specific purpose. Below is a description of a few key modules:
ICMPv4 Module
The ICMPv4 module offers a way to generate and handle ICMP (Internet Control Message Protocol) echo requests, commonly known as "pings". It has been built to be cross-platform compatible, seamlessly operating on both Windows and Linux.
Features
- Ping Utility: Send ICMP echo requests and retrieve the response.
- Dynamic Packet Creation: Build ICMP packets on the fly based on the operating system.
- Response Handling: Decode ICMP responses and provide a structured representation.
Usage
from unitools.ICMPv4 import Request
icmp_request = Request(address="8.8.8.8")
response = icmp_request.ping()
print(response)
Methods
- ping: Initiates an ICMP request and awaits its response.
- create_socket: Establishes the required socket for ICMP communication.
- create_icmp_packet: Constructs the ICMP packet ready for transmission.
- send_on_socket: Sends the constructed ICMP packet.
ICMPv4.Response
An inner class, Response, embodies the ICMP reply, furnishing details like the responder's IP address, byte size of the packet, round-trip time, and TTL (Time-to-Live).
TCPv4 Module
The TCPv4 module provides tools to check the reachability of TCP ports. It offers a "ping" on a TCP port and an extended ping functionality with multiple packets, delivering insights about the responsiveness and reliability of a TCP service.
Features
- TCP Ping: Test if a specific port on a host is reachable.
- Extended TCP Ping: Transmit multiple packets to ascertain the consistency and average response time.
- Response Parsing: Parse and present the ping responses in a structured manner.
Usage
from unitools.TCPv4 import Request
# Initialize with target host and port
request = Request(host='example.com', port=80)
# Single TCP Ping
response = request.tcp_ping()
print(response)
# Extended TCP Ping with 5 packets
responses = request.tcp_ping_extended(ping_count=5)
print(responses)
Methods
- tcp_ping: Send a TCP request to the provided host and port and await its response.
- tcp_ping_extended: Transmits multiple TCP pings and collates the responses.
TCPv4.Response & TCPv4.Responses
Response captures the outcome of a single TCP ping, detailing if the port was reachable and the latency. Responses, on the other hand, aggregates results from the extended ping, offering insights like average latency and packet loss percentage.
Contribute
Contributions to unitools are always welcome. Feel free to submit pull requests or raise issues.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unitools-0.1.2.tar.gz.
File metadata
- Download URL: unitools-0.1.2.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0858868113ccb4287e6e5851746a6b0bd2d3146f2bc91d6de85b7dfc44c6b83e
|
|
| MD5 |
a06ac301f65e1c03211dc68e03276138
|
|
| BLAKE2b-256 |
7f7356fc64a02250df587c56e0ad97ce64c3731ef41e7c4959d76eb86b27e5d3
|
File details
Details for the file unitools-0.1.2-py3-none-any.whl.
File metadata
- Download URL: unitools-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
651b48daeabaf02032aae9867514694b135bbed0380aca085461573ce90f87e1
|
|
| MD5 |
00fdcc87bd074bb97af5d8b44564b870
|
|
| BLAKE2b-256 |
b3469ad3aef7baa58557884a24e26c89b46d34029092634d05ff21e360d880d8
|