Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Plot them on a map

  • Loading branch information...
commit cd0f6dbc4fec5d3a7ec37210195be93bd5e18309 1 parent a1aaa7e
Ole André Vadla Ravnås oleavr authored
Showing with 74 additions and 3 deletions.
  1. +21 3 geoshark.qml
  2. +53 0 map.html
24 geoshark.qml
View
@@ -3,6 +3,7 @@ import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.0
import QtQuick.Layouts 1.1
+import QtWebKit.experimental 1.0
import Frida 1.0
@@ -44,11 +45,27 @@ ApplicationWindow {
processModel.get(currentRow).pid);
}
}
- TextArea {
- id: messages
+ ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
- readOnly: true
+ WebView {
+ id: map
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ url: Qt.resolvedUrl("./map.html")
+ function addMarker(ip, lat, lng) {
+ map.experimental.evaluateJavaScript(
+ "addMarker(\"" + ip + "\", " +
+ lat + ", " + lng + ");"
+ );
+ }
+ }
+ TextArea {
+ id: messages
+ Layout.fillWidth: true
+ height: 200
+ readOnly: true
+ }
}
Button {
Layout.alignment: Qt.AlignBottom
@@ -89,6 +106,7 @@ ApplicationWindow {
var location = JSON.parse(xhr.responseText);
messages.append("Resolved " + ip +
" to " + JSON.stringify(location) + "\n");
+ map.addMarker(ip, location.latitude, location.longitude);
}
};
xhr.open("GET", "http://freegeoip.net/json/" + ip);
53 map.html
View
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport"
+ content="initial-scale=1.0, user-scalable=no" />
+ <style type="text/css">
+ html { height: 100% }
+ body { height: 100%; margin: 0; padding: 0 }
+ #map-canvas { height: 100% }
+ </style>
+ <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY">
+ </script>
+ <script type="text/javascript">
+ var map = null;
+ var pending = [];
+ function initialize() {
+ var mapOptions = {
+ center: new google.maps.LatLng(
+ 59.9155441,
+ 10.7154132),
+ zoom: 3
+ };
+ map = new google.maps.Map(
+ document.getElementById("map-canvas"),
+ mapOptions);
+ pending.splice(0, pending.length).forEach(
+ function (f) { f(); }
+ );
+ }
+ function addMarker(ip, lat, lng) {
+ if (map === null) {
+ pending.push(function () {
+ addMarker(ip, lat, lng);
+ });
+ return;
+ }
+ var position = new google.maps.LatLng(lat, lng);
+ map.panTo(position);
+ var marker = new google.maps.Marker({
+ position: position,
+ title: ip,
+ animation: google.maps.Animation.DROP
+ });
+ marker.setMap(map);
+ }
+ google.maps.event.addDomListener(window, "load",
+ initialize);
+ </script>
+ </head>
+ <body>
+ <div id="map-canvas" />
+ </body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.