Sign in to follow this  
Followers 0

Retrieve and display IP geolocation info

4 posts in this topic

Posted

A little contribution to the community in the hope that some parts might be useful for some people.

I find it pretty cool what's possible by combining several different web services.

The complete script is only useful with a Wowza Media Server (http://www.wowza.com/) - a great streaming server for video and audio in different formats, also available on Amazon EC2.

But there are several parts of the functionality that should be valuable for other applications, as they demonstrate how to retrieve ip geolocation information using the Quova web service and display the info in a listview and on Google Maps.

Script Description

The script does the following:

  • It expects the dns (web address) of the Wowza Media Server as the only parameter. If you start it without a parameter, it offers to use a test file (which you would have to upload to Amazon S3 first).
  • It retrieves IP addresses and additional information from the Wowza Media Server and parses them into an array.
  • It uses the API of the Quova web service (http://developer.quova.com/) to retrieve geolocation information for each IP address and adds the data to the array. The script uses location down to state and city, latitude/longitude for map placement, internet provider info, and user time zone. See Quova documentation for the details of all the info that’s returned by the service. The Quova API is free for up to 1000 queries per day and not more than 2 queries per second. The script tracks and enforces these limits.
  • It displays the results in a list, sorted by location.
  • Optionally it displays the data on a Google map. For this purpose it creates a KML file, uploads it to Amazon S3 (the file needs to accessible to Google), and opens a Google Maps page with the file as input.

Files:

The attached zip file contains the most important files relevant for this application. You might have to download an additional file.

Put all local files into the script directory and upload the others to Amazon S3 or the Wowza Media Server as necessary.

  • wmsUserInfo.au3: Script file source code
  • wmsDisplayUserInfo.kxf: Koda Form Designer source for form used by script
  • quova.ini: ini file for Quova service. Enter the key and shared secret that you get from Quova after signing up. The ini file is also used to track the number of queries per day.
  • s3.ini: ini file for Amazon S3 service. Enter your keys and the bucket name. Only needed if you want to use S3 for the KML file or a test file.
  • serverinfo.xml: a sample file with user information from the Wowza Media Server. If you put it into the S3 bucket configured in the s3.ini file you can test the complete script without using a Wowza Media Server.
  • xwmshttpserverinfoxml.jar and XwmsHTTPServerInfoXML.java: This are the Java source and jar files of a customized version of the Wowza Media Server module that provides the user information. The only change from the standard module is that it also outputs a query string passed to the streaming application at start time. This allows to distinguish between different streams on the same application. The script checks whether the customized version is used and parses accordingly. The jar file needs to be loaded on the Wowza Media Server at startup. See Wowza documentation for details.
The script also uses s3.exe to upload the KML file to Amazon S3. It is a standalone utility for using Amazon web services. Download it from http://s3.codeplex.com/ and put it into the script directory.

Notes/Caveats:

  • As said above, the free Quova service allows a maximum of 1000 queries per day. Quova queries include a timestamp in GMT time. I assume that they count per GMT day, and that is what the script does.
  • You can change the color of the placemarks on the Google map according to any criteria that you have available in the script if you change the code accordingly. I don't have any official documentation about the available colors, so it is just trial and error. The default color is blue.
  • The KML file needs to be in a location that's accessible to Google, so it cannot be on your local computer. If you have a website, you could also use ftp to upload it to your website and use that url with Google maps. It's just something you would have to automate yourself.
  • If the ip address of the computer that runs the script is in the list of ip addresses, the script uses the time zone information from this computer to calculate local times for the other ip addresses. You could just add it to the list if it wasn't included and you want the information.
  • The script is working for me, but I have only used it with relatively small numbers of ip addresses. So I am not sure about performance and behavior if it reaches the limits. In particular I don't know how Google maps behaves if the KML file contains a large number of placemarks. Be sure to test!

wmsUserInfo.zip

Share this post


Link to post
Share on other sites



Posted

Thanks for uploading this, I am personally interested in your automation of the s3.exe tool.

Have you used the S3 put function recently? because I consistently receive a 403 error using S3 put. 

Just want to check if I'm not the only one seeing this problen

Share this post


Link to post
Share on other sites

Posted

Thanks for uploading this, I am personally interested in your automation of the s3.exe tool.

Have you used the S3 put function recently? because I consistently receive a 403 error using S3 put. 

Just want to check if I'm not the only one seeing this problen

 

Do not be in a hurry to get an answer !

wmsautoit is offline since August 2011... ;)

Share this post


Link to post
Share on other sites

Posted

This is a nightmare. I've tried 4 different methods for exchanging files with the Amazon S3 service, and am yet to find one that I can get to work!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0