Georoute (PyQt4 powered!)

Pablo García-Nieto
2 min readAug 10, 2015

While I was studying Networks for my course at the university, I found really interesting some of the resources the book provided regarding traceroute tools to actually see how different routings happened while connecting to a host.

With that in mind, I decided to create a portable application using Qt Framework and Python, with the correspondent bind: PyQt4.

I wanted the app to look really simple, and the system-tool traceroute returned everything I needed to show the details for every hop.

The interface: Qt creator

Qt Creator is the app which Qt provides to design interfaces that can be rendered through the framework.

You can find almost any widget you might need, although the overall app needs to improve a bit in terms of usability and UI reordering. Sometimes it’s just so confusing to understand layout positions…

Once the design is done, everything is saved as .ui files, so you can directly use them in Python.

Async traceroute

Another interesting point was the fact that async subprocessing was required in order to get data from stdout as soon as it was streamed by traceroute.

This is one of the most interesting approaches I found to avoid blocking UI without infinite loops waiting for data to end.

https://gist.github.com/pabgn/2cc65e23925fd9f55708

IP Location

For every hop returned by traceroute, another thread to look for the IP location was necessary. The API I chose was: http://ip-api.com. With a GET request with the IP to look for, the API returns a JSON response with geo data ready to be implemented.

https://gist.github.com/pabgn/e067897cc70ff7269eeb

QWebView and mapping

As I wanted to show hops in a map, the best solution I found was to use a WebView using Google Maps API V3 for JavaScript. Communication between Python and QWebView is handled using signals and Javascript evaluations right in the main frame.

I programmed a simple queue to retrieve locations and show them with a zoom animation and Polylines as traceroute is working in the background.

The app!

[UPDATE]

Mac OS X binary: http://netkups.com/?d=bc9543437c4a8

Linux KDE binary: http://netkups.com/?d=4ce3ee0e5d4c3

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Pablo García-Nieto
Pablo García-Nieto

Written by Pablo García-Nieto

Software engineer, Digital Product + Project Management. València, Spain

No responses yet

Write a response