https://github.com/ironcore864/my-traceroute-python
https://github.com/ironcore864/my-traceroute-python
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ironcore864/my-traceroute-python
- Owner: IronCore864
- Created: 2019-04-22T08:59:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T09:03:57.000Z (over 7 years ago)
- Last Synced: 2024-12-31T12:46:26.304Z (over 1 year ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Description
Doing a "traceroute" to a destination host, output the path, and find the slowest host.
Since traceroute is not heavily depending on performance (networking time is the most cost), I choose Python for quicker implementation than golang.
I did not fully implement the checksum part myself but referred to some articles and algorithms. I think there might be a better library to do checksum in python but I didn't find a good one in a short time.
# Dependency
- python (2 and 3 both works)
- root (SUID won't work for scripts; without root permission there will be an error message "You need to be root to run this program!")
- pytest
Run:
```
pip3 install -r requirements.txt
```
# Run
Example:
```
sudo python3 mytraceroute.py www.google.com
```
# Test
```
sudo python3 -m pytest --capture=sys
```
# References
- [ICMP](https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol)
- [Internet Control Message Protocol (ICMP) Parameters](https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml#icmp-parameters-codes-0)
- [Internet Checksum specified in RFC 1071](https://osqa-ask.wireshark.org/questions/11061/icmp-checksum)
- [in_cksum in iputils](https://github.com/iputils/iputils/blob/master/ping.c#L1103)
- [An Article on Internet Checksum](https://www.jianshu.com/p/1e4805c62415)
- [An Implementation of Checksum](https://github.com/pferate/python_ping/blob/master/ping.py#L265)