Skip to content
forked from Akhavi/pyping

Fork of Pyping with TTL reporting and Source IP support

License

Notifications You must be signed in to change notification settings

daemonLXH/pyping

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyping

A pure python ping implementation using raw sockets.

Note that ICMP messages can only be sent from processes running as root (in Windows, you must run this script as 'Administrator').

Original Version from Matthew Dixon Cowles.

  • Copyleft 1989-2011 by the python-ping team, see AUTHORS for more details.
  • License: GNU GPL v2, see LICENCE for more details.

Usage

Use as a cli tool:

socketubs@socket-laptop [Pyping]: sudo pyping socketubs.net

PYTHON-PING socketubs.net (92.243.5.143): 55 data bytes
241 bytes from socketubs.net (92.243.5.143): icmp_seq=0 ttl=55 time=64.5 ms
241 bytes from socketubs.net (92.243.5.143): icmp_seq=1 ttl=55 time=67.7 ms
241 bytes from socketubs.net (92.243.5.143): icmp_seq=2 ttl=55 time=66.6 ms

----socketubs.net PYTHON PING Statistics----
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip (ms)  min/avg/max = 64.457/66.244/67.677

socketubs@socket-laptop [Pyping]: pyping --help

Use as a Python lib:

>>> import pyping
>>> r = pyping.ping('socketubs.net')                # Need to be root or
>>> r = pyping.ping('socketubs.net', udp = True)    # But it's udp, not real icmp
>>> r.ret_code
0
>>> r.destination
'socketubs.net'
>>> r.max_rtt
'69.374'
>>> r.avg_rtt
'68.572'
>>> r.min_rtt
'67.681'
>>> r.destination_ip
'92.243.5.143'

Todo

  • Docs
  • Refactor core.py
  • Tests

Contribute

Fork this repo on GitHub and send pull requests. Thank you.

Links

About

Fork of Pyping with TTL reporting and Source IP support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%