alessandromaggio / pythonping

A simple way to ping in Python
MIT License
198 stars 75 forks source link

Adding command line support to use pythonping as `python3 -m ping [ip]` #110

Open Agent-Hellboy opened 11 months ago

Agent-Hellboy commented 11 months ago

Is your feature request related to a problem? Please describe.

I want to add support for using pythonping as a command-line tool. This would be beneficial for Windows, which doesn't have the ping command by default, as well as embedded devices that may not have ping support. Having pythonping as a command-line tool would provide a convenient alternative for network troubleshooting.

Describe the solution you'd like

I would like to create a command-line tool that utilizes pythonping. Users should be able to execute the tool from the command line by running python3 -m ping [ip], where [ip] is the target IP address. The tool should use pythonping to send ICMP echo requests to the specified IP address and display the ping results in a user-friendly format

Describe alternatives you've considered

Currently, users can install pythonping as a Python library and use it programmatically to perform ping operations. However, having pythonping as a standalone command-line tool would simplify the process and make it more accessible, especially for Windows users or those working with embedded systems.

Additional context

Adding pythonping as a command-line tool would provide a consistent ping functionality across different platforms, making it easier for users to perform network diagnostics and troubleshoot connectivity. It would be particularly useful for Windows users or those working with embedded systems that do not have native ping support.

the current response from my fork

python3 -m pythonping 'google.com'
Reply from 142.250.192.142, 29 bytes in 24.45ms
Reply from 142.250.192.142, 29 bytes in 25.78ms
Reply from 142.250.192.142, 29 bytes in 24.59ms
Reply from 142.250.192.142, 29 bytes in 23.95ms

Round Trip Times min/avg/max is 23.95/24.69/25.78 ms

if you approve of this feature I will raise the PR

Theory903 commented 11 months ago

Subject: Contribution: PythonPing Command-Line Tool for Network Troubleshooting


Is your feature request related to a problem? Please describe.

I've observed the absence of a native ping command on Windows, and there's a lack of ping support on certain embedded devices. I believe integrating PythonPing as a command-line tool could address this issue. It would offer an alternative for network troubleshooting on these platforms.

Describe the solution you'd like

I propose creating a user-friendly command-line tool that utilizes PythonPing. Users should be able to initiate the tool by executing python3 -m ping [ip], where [ip] signifies the target IP address. This tool will leverage PythonPing to send ICMP echo requests to the specified IP address and present the ping results in an easily understandable format.

Describe alternatives you've considered

Currently, users can use PythonPing as a Python library to perform ping operations programmatically. However, introducing PythonPing as a standalone command-line tool would simplify this process and make it more accessible, particularly for Windows users and those dealing with embedded systems.

Additional context

The inclusion of PythonPing as a command-line tool would standardize ping functionality across different platforms, providing users with a consistent method to perform network diagnostics and address connectivity issues. This enhancement holds significant value for Windows users and individuals working with embedded systems where native ping support is absent.


Regarding the current response from my fork:

python3 -m pythonping 'google.com'
Reply from 142.250.192.142, 29 bytes in 24.45ms
Reply from 142.250.192.142, 29 bytes in 25.78ms
Reply from 142.250.192.142, 29 bytes in 24.59ms
Reply from 142.250.192.142, 29 bytes in 23.95ms

Round Trip Times min/avg/max is 23.95/24.69/25.78 ms

This output demonstrates the successful execution of PythonPing as a command-line tool. If this feature aligns with the project's goals, I'm willing to proceed by raising a pull request (PR) to integrate this functionality.

Looking forward to your feedback on this proposed feature!

Theory903 commented 11 months ago

Hey Agent-Hellboy,

I wanted to share with you the progress I've made towards integrating PythonPing as a command-line tool for network troubleshooting. I've been working on a Python script that's designed to enhance PythonPing's functionality in the command-line environment.

This script allows users to specify a target IP address or hostname along with the number of pings to send via command-line arguments. It utilizes PythonPing to send ICMP echo requests and presents the ping results in a structured format, including response details and round-trip time statistics.

I believe this aligns with our previous discussions about incorporating PythonPing as a command-line tool, providing a more accessible and user-friendly way for network troubleshooting. I'm excited about this implementation and would greatly appreciate your thoughts and suggestions for further refinement before proceeding with the integration.

To view the detailed progress and the ongoing discussion, you can find the pull request here.

Looking forward to your feedback and input on this endeavor!

Best regards, Abhishek Jha