How to create a Python 3.6 traceroute without SOCK RAW?

Irmen de Jong irmen.NOSPAM at xs4all.nl
Thu Feb 23 18:35:28 EST 2017


On 24-2-2017 0:20, Juan C. wrote:
> On Thu, Feb 23, 2017 at 7:42 PM, Irmen de Jong <irmen.NOSPAM at xs4all.nl> wrote:
>>
>> import os
>> os.system("traceroute www.google.com")
> 
> Indeed, that would work, but it isn't a great approach in my opinion
> because I would rely on a system command, in this case Windows uses
> tracert while UNIX uses traceroute, one could fix that with a if-else
> to check the os and then use the correct command, but it just make it
> feel even more like a workaround and not a definitive solution.
> 

I don't consider this a workaround at all. Why reinvent the wheel?
Also: once you're going to deal with low level socket API you're going to run into
platform differences anyway.

Irmen




More information about the Python-list mailing list