Using the Google Maps API for Flow Visualization Where on Earth is my Data?



Similar documents
Implementation of a system of the mobile terminal position tracking using Google Maps

USING GOOGLE MAP API FUNCTIONS TO CREATE APPLICATIONS USING GEOGRAPHIC SPATIAL DATA.

Vehicle Tracking System Using GPS and SMS. Table of Contents

Data Visualization. Richard T. Watson. apple ibooks Author

OpenStreetMap for Web Developers. Serge Wroclawski State of the Map US August 2010

Integration of a city GIS data with Google Map API and Google Earth API for a web based 3D Geospatial Application

Quick and Easy Web Maps with Google Fusion Tables. SCO Technical Paper

HTML Form Widgets. Review: HTML Forms. Review: CGI Programs

XML Processing and Web Services. Chapter 17

About the Salesforce1 Mobile App Workbook...1. Tutorial 1: Initial Set Up...2. Tutorial 2: Use the Mobile App...4

How To Analyze Logs On Aloha On A Pcode On A Linux Server On A Microsoft Powerbook (For Acedo) On A Macbook Or Ipad (For An Ubuntu) On An Ubode (For Macrocess

Getting Started with Android Smartphones and ThingWorx

Developer Tutorial Version 1. 0 February 2015

Operational Decision Manager Worklight Integration

Census Data with Tableau Public

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

Sisense. Product Highlights.

Create interactive web graphics out of your SAS or R datasets

TIBCO Spotfire Business Author Essentials Quick Reference Guide. Table of contents:

NICAR Hands-On: Census Data with Tableau Public

The Smart Forms Web Part allows you to quickly add new forms to SharePoint pages, here s how:

Lab Conducting a Network Capture with Wireshark

1 Log visualization at CNES (Part II)

Visualization with Excel Tools and Microsoft Azure

Table Of Contents: I. MapifyPro: Installation. II. General Overview & License Activation. III. Map Settings. IV. Map Location Settings. V.

Community Health Maps Lab Series:

How To Use Titanium Studio

Overview. How It Works

ISL Online Integration Manual

IBM FileNet eforms Designer

Visualizing MongoDB Objects in Concept and Practice

Implementing a Web-based Transportation Data Management System

Microsoft SharePoint 2010 End User Quick Reference Card

Portals and Hosted Files

Mobile Application Development Google Maps Android API v2

Storytelling with Maps: Workflows and Best Practices

Designing and Implementing Forms 34

Data Visualization Using Google Maps: the Hard Way and the Easy Way

INTEGRATING MICROSOFT DYNAMICS CRM WITH SIMEGO DS3

Mobile Data Collection with Avenza PDF Maps

Google AdWords TM Conversion Tracking Guide

ArcGIS online Introduction Module 1: How to create a basic map on ArcGIS online Creating a public account with ArcGIS online...

ANALYSING SERVER LOG FILE USING WEB LOG EXPERT IN WEB DATA MINING

Wildix Web API. Quick Guide

Test Case 3 Active Directory Integration

Leveraging APIs in SAS to Create Interactive Visualizations

NEXT Analytics Business Intelligence User Guide

Getting Started Guide with WIZ550web

Taxi Service Design Description

Chapter 22: Integrating Flex applications with portal servers

1.5.3 Project 3: Traffic Monitoring

Web Browser. Fetches/displays documents from web servers. Mosaic 1993

GEO 425, Spring 2012 LAB 3: Introduction to Web Map Services

Providing the Public with Data Visualization using Google Maps

NaviCell Data Visualization Python API

There are various ways to find data using the Hennepin County GIS Open Data site:

RESCO MOBILE CRM QUICK GUIDE. for MS Dynamics CRM. ios (ipad & iphone) Android phones & tablets

Wildix WebRTC Kite & MCU Videoconference. Quick Start Guide

Website Development Komodo Editor and HTML Intro

Starting User Guide 11/29/2011

Filtered Views for Microsoft Dynamics CRM

ios App Development Using Cordova

The SkySQL Administration Console

Traffic visualization with Arista sflow and Splunk

Salesforce Integration

RSW. Responsive Fullscreen WordPress Theme

How to georectify an image in ArcMap 10

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

Getting Started with Clearlogin A Guide for Administrators V1.01

Firefox for Android. Reviewer s Guide. Contact us: press@mozilla.com

WEB SITE DEVELOPMENT WORKSHEET

DATA VISUALIZATION WITH TABLEAU PUBLIC. (Data for this tutorial at

W3Perl A free logfile analyzer

Ease of Use No programming, no system administration. Make maps fast with this productivity tool.

Chapter 14: Links. Types of Links. 1 Chapter 14: Links

Credit Card Encryption 9.0

Online Help Manual. MashZone. Version 9.7

Network Probe User Guide

CRM Developer Form

Pinterest has to be one of my favourite Social Media platforms and I m not alone!

Localizing dynamic websites created from open source content management systems

Paperless Meeting Software Installation Instructions

With a wide variety of drag and drop widgets, adding and updating information on your website will be a snap!

A Geographic Interactive Supply Chain Management System for Construction Projects

Offensive & Defensive & Forensic Techniques for Determining Web User Iden<ty

COSC 6397 Big Data Analytics. 2 nd homework assignment Pig and Hive. Edgar Gabriel Spring 2015

Applied Detection and Analysis Using Network Flow Data

KaleidaGraph Quick Start Guide

Data Visualization Principles: Interaction, Filtering, Aggregation

Sizmek Formats. IAB Mobile Pull. Build Guide

HOW DOES GOOGLE ANALYTICS HELP ME?

Contents. The OWRB Floodplain Viewer. Creating Maps Helpful Tips... 10

Volume SYSLOG JUNCTION. User s Guide. User s Guide

Transcription:

Using the Google Maps API for Flow Visualization Where on Earth is my Data? Sid Faber Network Situational Awareness Group sfaber@cert.org 1

Agenda Step 1: Extracting Flow Data Step 2: Geolocation Step 3: Convert to XML Aside: The Google Maps API Step 4: The HTML Page 2 2

Data Used for Demo SC06 Data Set November 14, 2006 Goal is to look at who talked to whom 3 3

Step 1: Extracting Flow Data 4 4

Extracting Flow Data What story do you want to tell with geolocation? Traffic source or destination Data record = one value per address Relations between addresses Data record = one value per source, destination address pair 5 5

Extracting Flow Data: SiLK Example Traffic destination $ rwfilter --start=2006/11/14 --proto=0-255 --class=all --pass=stdout rwuniq --fields=dip --bytes > dst.txt 140.221.159.103 12568504471655 172.30.5.11 11381325217792 172.30.6.11 7397483692032 6 6

Step 1: Summary Extract Flow Data Start with raw flow data End with summarized flow data (2 columns) Destination IP, value Space delimited For Example: 140.221.159.103 12568504471655 172.30.5.11 11381325217792 172.30.6.11 7397483692032 7 7

Step 2: Geolocating IP Addresses 8 8

Geolocating by Country Map IP to Country: IPligence, http://www.ipligence.com "0000000000","0033554431","US","UNITED STATES","NA"... "0033554432","0050331647","DE","GERMANY","EU","EUROPE" Map Country to Lat/Long: MaxMind, http://www.maxmind.com/app/country_latlon US,38.0000,-97.0000 DE,51.0000,9.0000 Combine IP-to-Lat/Long Mapping 0000000000 0033554431 US 38.0000-97.0000 0033554432 0050331647 DE 51.0000 9.0000 0050331648 0067108863 HK 22.2500 114.1667 Numeric IP 9 9

Geolocating by Addresses DNS LOC $ host -t LOC cmu.edu cmu.edu LOC 40 26 39.000 N 79 56 36.200 W 283.00m... Caida Netgeo $ wget http://netgeo.caida.org/perl/netgeo.cgi \?target=128.2.10.162... TARGET: 128.2.10.162<br> NAME: CMU-NET<br> NUMBER: 128.2.0.0-128.2.255.255<br> LAT: 40.44<br> LONG: -79.95<br>... Hostip.info, http://www.hostip.info/dl/index.html 10 10

Sample Commercial Data: Quova 1 start_ip_int 2 end_ip_int 3 cidr 4 continent 5 country 6 country_iso2 7 country_cf 8 region 9 state 10 state_cf 11 city 12 city_cf 13 postal_code 14 phone_number_prefix 15 timezone 16 latitude 17 longitude... 50331648 50378239 24 north america united states us 80 northeast connecticut 10 fairfield 10 06825 203-5 41.1753-73.2812... 67272896 67272959 26 north america united states us 97 northeast massachusetts 87 woburn 77 01888 781-5 42.4867-71.1543... Numeric IP 11 11

Add location to data and regroup Perl-fu pseudocode: Read location data into a lookup table For each line of data { Extract IP and [value] Find lat,long coordinates for IP Create a bin for the coordinates and add [value] } Print out the bins 12.4.8.120 33.7.150.8 92.155.168.0 4.0.55.2 12.178.6.55 24.168.15.130 2 17 5 26 22 12 Perl-fu 28 39 22 5 12 12

Geolocating with SiLK pmaps Prefix maps associate a value with an IP address prefix Text based pmap: #Start-IP End-IP CC Lat Long pmap value 0033554432 0050331647 DE 51.0000 9.0000 0050331648 0067108863 HK 22.2500 114.1667 13 13

Building the Geolocation pmap Some perl-fu: read countrylatlng.txt into a hash foreach line in the ipligence data set { look up the countrylatlng.txt line for the code print out the ip range, country code and coordinates } See make-geo-cc-pmap.pl in the sample code 14 14

Using the Geolocation pmap Use the pmap with rwuniq: $ rwfilter \ --start=2006/11/14 \ --proto=0-255 \ --class=all --pass=stdout \ rwuniq \ --pmap-file=geo-cc.pmap \ --fields=dval --bytes --delimited=" " --no-titles \ > geo-dst.txt US 38.0000-97.0000 102372319236580 JP 36.0000 138.0000 9965004709495 CA 60.0000-95.0000 569989239278 15 15

Step 2: Summary Geolocate Flow Data Start with summarized flow data End with location data (4 columns) Destination label, latitude, longitude, value Space delimited SiLK pmaps combine steps 1 and 2 For example: US 38.0000-97.0000 102372319236580 JP 36.0000 138.0000 9965004709495 CA 60.0000-95.0000 569989239278 16 16

Step 3: Convert to XML 17 17

XML Data Convert to XML The GoogleMaps routine we ll be using takes XML input We define the schema We ll process Step 2 data with a simple awk command $ cat geo-dst.txt \ awk ' BEGIN {print "<markers>"} \ { printf "<marker lbl=\"%s\" lat=\"%s\" lng=\"%s\" \ val=\"%s\"/> \n", $1, $2, $3, $4} \ END { print "</markers>"} ' \ > geo-dst.xml 18 18

Step 3: Summary Convert to XML Start with labels, coordinates and values End with XML document with the same data For example: <markers> <marker lbl="cn" lat="35.0000" lng="105.0000 val="704206"/> <marker lbl="mr" lat="20.0000" lng="-12.0000" val="200"/> <marker lbl="kn" lat="17.3333" lng="-62.7500" val="646"/> </markers> 19 19

Aside: The Google Maps API 20 20

Google Maps Widgets Map Control Info Window Type Control Zoom Control Marker Overview Map Control 21 21

Google Maps API Fundamentals http://code.google.com/apis/maps/documentation/ Very well documented, lots of examples Start simple (like this demo) Requires very basic javascript and HTML knowledge General flow: Include the source code Create the map Drop markers onto the map 22 22

About keys and data In order to include the library source, you need a key The key uniquely identifies your URL Not necessary when serving via a file:// URL Doesn t the data get posted up to Google? No, Google only sees you requests for the underlying map images All marker placement and labeling is done local to the client with overlays 23 23

Step 4: The HTML Page 24 24

geo-dst.html (part 1) <html><head><title>ip Geolocation Example</title> <script src="http://maps.google.com/maps?file=api&v=2&key=" type="text/javascript"></script> <script type="text/javascript"> // This is the file that contains the point data var map; var xmlfile = "geo-dst.xml"; // Called when the map is loaded. This function // creates the map, adds controls to it, and then // the points are laid on top of the map function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.addcontrol(new GLargeMapControl()); map.addcontrol(new GOverviewMapControl()); map.addcontrol(new GMapTypeControl()); map.setcenter(new GLatLng(38, -97), 1); loadpoints(); } } 25 25

geo-dst.html (part 2) // http://code.google.com/apis/maps/documentation/services.html#xml_requests function loadpoints() { GDownloadUrl(xmlFile, function(data, responsecode) { var xml = GXml.parse(data); var markers = xml.documentelement.getelementsbytagname("marker"); for (var i = 0; i < markers.length; i++) { var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parsefloat(markers[i].getattribute("lng"))); descr = markers[i].getattribute("lbl")+"; "+markers[i].getattribute("val"); map.addoverlay(new GMarker(point, {title:descr, clickable:false })); } }); } </script></head> <body onload="load()" onunload="gunload()"><h2>ip Geolocation Example</h2> <div id="map" style="width: 640px; height: 480px"></div> </body> </html> 26 26

The Results... 27 27

Customizing Marker Icons Two modifications needed Define the different icons upon initialization Choose the icon when points are added 28 28

geo-dst-v2.html (part 1)... function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.addcontrol(new GLargeMapControl()); map.addcontrol(new GOverviewMapControl()); map.addcontrol(new GMapTypeControl()); map.setcenter(new GLatLng(38, -97), 1); //create different pins sredicon.image = "green-s.png"; sredicon.shadow = "shadow-s.png"; sredicon.iconsize = new GSize(8, 13); sredicon.shadowsize = new GSize(14, 13); sredicon.iconanchor = new GPoint(4, 12); sredicon.infowindowanchor = new GPoint(5, 1); mredicon.image = "red-m.png"; mredicon.shadow = "shadow-m.png"; mredicon.iconsize = new GSize(12, 20);... loadpoints(); } } 29 29

geo-dst-v2.html (part 2) // http://code.google.com/apis/maps/documentation/services.html#xml_requests function loadpoints() { GDownloadUrl(xmlFile, function(data, responsecode) { var xml = GXml.parse(data); var markers = xml.documentelement.getelementsbytagname("marker"); for (var i = 0; i < markers.length; i++) { var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parsefloat(markers[i].getattribute("lng")));... var ratio = Math.log ( parsefloat(markers[i].getattribute("val")) / minval) / Math.log (maxval / minval) ; // // Plot the pin corresponding to the logarithmic ratio // if (ratio < 0.2) { map.addoverlay(new GMarker(pointlist[i], {icon:sredicon, title:de... } else if (ratio < 0.9) { map.addoverlay(new GMarker(pointlist[i], {icon:mredicon, title:de... } else { map.addoverlay(new GMarker(pointlist[i], {icon:lredicon, title:de... } }... 30 30

The Results... 31 31

Adding Links Need a new data set Create an XML file with source location, destination location and value Add a new function to read and plot the data file 32 32

geo-dst-v3.html function loadlinks() { GDownloadUrl(xmlFile, function(data, responsecode) {... var slink = new GLatLng(parseFloat(links[i].getAttribute("slat")), parsefloat(links[i].getattribute("slng"))); var elink = new GLatLng(parseFloat(links[i].getAttribute("elat")), parsefloat(links[i].getattribute("elng"))); map.addoverlay (new GPolyline ([slink, elink], "#000000", ratio * 5, ratio / 2, {geodesic:true}));... Color Opacity Thickness 33 33

The Results... 34 34

Where to go from here Make it your own Generate info window popups Drag markers Add driving directions See http://code.google.com/apis/maps/ Download sample code from the training server (128.2.243.104) in /home/sfaber/presentation 35 35

Using the GoogleMaps API for Flow Visualization Where on earth is my data? Sid Faber Network Situational Awareness Group sfaber@cert.org Download sample code from the training server (128.2.243.104) in directory /home/sfaber/presentation 36