Journal Entry-Rosa Lee & Ian Hodgson

To use Google Maps within an Android application, you must install the Google API (application programming interface), a set of tools for building software applications, in the Android SDK. By installing the Google Maps API, you can embed the Google Maps site directly into an Android application, and then overlay app-specific data on the maps. The Android Google Maps API is free for commercial use providing that the site using it is publicly accessible and does not charge for access. If the app is for public sale, you must use Google Maps API Premier, which can be accessed for a per-usage subscription fee. The classes of the Google Maps Android library offer built-in downloading, rendering, and caching of mapping tiles, as well as a variety of display options and controls. Multiple versions of the Google Maps API add-on are available, corresponding to the Android API level supported in each version. This text uses Android 4.0 Google APIs by Google Inc. You must download the add-on to your computer and install it in your SDK environment to create an Android Google Maps app. To install the Android 4.0 Google API, follow

these steps:

1. Open the Eclipse program. Click Window on the menu bar and then click Android SDK Manager to view the SDK files available. The Android SDK Manager dialog box opens with the current SDK packages listed

2.   In the Android 4.0 (API 14) category, check the Google APIs by Google Inc. check box, if it is not already installed (as indicated in the Status column). Click to remove the check mark from any other selected check boxes. Click the Install Packages button to install the Google API package. Close the Android SDK Manager after the installation.

The Android SDK Manager is updated to include the Google APIs for use with the Google Maps features.

 Adding the AVD to Target the Google API

After you install the Android Google API, you set the application’s properties to select the Google APIs add-on as the build target. Doing so sets the Android Virtual Device (AVD) Manager to use the new Google API package. Make sure to select the version (by API level) appropriate for the Google API target. To target the Google API within the AVD Manager, follow these steps:

1. Click Window on the menu bar and then click AVD Manager.

2. Click the New button. Type Google_API in the Name text box. Click the Target  button, and then click Google APIs (Google Inc.) – API Level 14.

3. Click the Create AVD button.

4. Click the Close button to close the Android Virtual Device Manager dialog box.

Obtaining a Maps API Key from Google

Before you can run an Android Google Maps application, you need to apply for a free Google Maps API key so you can integrate Google Maps into your Android application. An Android map application gives you access to Google Maps data, but Google requires that you register with the Google Maps service and agree to the Terms of Service before your mapping application can obtain data from Google Maps. This applies whether you are developing your application on the emulator or preparing your application for deployment to mobile devices.

Registering for a Google Maps API key is free. The process involves registering your computer’s MD5 fingerprint. An MD5 (Message-Digest Algorithm 5) digital fingerprint is a value included as part of a file to verify the integrity of the file. Signing up with Google to register for a Google Maps API key is a task that needs to be performed only once and the purpose is mainly for security. A unique Google Maps API key is a long string of seemingly random alphanumeric characters that may look like this:

87:B9:58:BC:6F:28:71:74:A9:32:B8:29:C2:4E:7B:02:A7:D3:7A:DD                            Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98          The first step in registering for a Google Maps API key is to locate an MD5 fingerprint of the certificate used to sign your Android application. You cannot run a Google mapping application in your Eclipse Android emulator if it is not signed with your local API key. The Android installed environment contains a file named debug.keystore, which contains a unique identification. To locate the MD5 fingerprint of the debug certificate on your computer, follow these steps:

1. To generate an MD5 fingerprint of the debug certificate, first use Windows Explorer or the Finder to locate the debug.keystore file in the active AVD directory. The location of the AVD directories varies by platform:

u Windows 7 or Windows Vista: C:\Users\<user>\.android\debug.keystore

u Windows XP: C:\Documents and Settings\<user>\.android\debug.keystore

u Mac OS X: ~/.android/debug.keystore

Note: The <user> portion of this path statement indicates your user account  name on your computer. For example, using a Windows 7 computer, the location of the AVD directory on a computer with a username of Corinne is:

C:\Users\Corinne\.android\debug.keystore.

2. On a Windows 7 or Vista computer, click the Start button. Type cmd in the Search box and press the Enter key. On a Windows XP computer, click the Start button. Click Run. Type cmd and press the Enter key. On a Mac computer, on the Desktop toolbar, click the Spotlight button (upper-right corner). In the Spotlight box, type terminal and then press the Return key. To find the MD5 fingerprint of your computer, in the Command Prompt window, type the following command, replacing <user> with the name of the account:

 In Windows 7 or Vista:

keytool.exe -list -alias androiddebugkey -keystore C:\Users\<user>\.android\debug.keystore -storepass android –keypass android

In Windows XP:

keytool.exe -list -alias androiddebugkey -keystore C:\Documents and Settings\<user>\.android\debug.keystore -storepass android –keypass android

In Mac OS X:

keytool -list -keystore ~/.android/debug.keystore

Press the Enter key.

3. To select the MD5 fingerprint in Windows, right-click the Command Prompt window and then click Mark on the shortcut menu. Select the MD5 fingerprint code, being careful not to include any extra spaces

4. To copy the MD5 highlighted code, press the Ctrl+C keys (Windows) or the Command+C keys (Mac) to copy the code to the system Clipboard. The MD5 fingerprint is copied. You paste this code into a Web page in the next step.

The MD5 certificate fingerprint with Google Maps service, follow these steps:

1. Start a browser and display the following Web site:

http://developers.google.com/android/maps-api-signup

2. Scroll down the page, if necessary, and check the I have read and agree with the terms and conditions check box. Click the My certificate’s MD5 fingerprint text box and then press the Ctrl+V keys (Windows) or the Command+V keys (Mac) to paste the MD5 fingerprint code from the Command Prompt window.

3. To display the Android Maps API key, click the Generate API Key button. If necessary, enter your Gmail e-mail address and password. (You need to create a Google account if you do not have one.)

vl

Tracking MAC address and Violaters that try to spoof:

First, you must ping the target. That will place the target — as long as it’s within your netmask, which it sounds like in this situation it will be — in your system’s ARP cache. Observe:

13:40 jsmith@undertow% ping 97.107.138.15 PING
97.107.138.15 (97.107.138.15) 56(84) bytes of data. 
64 bytes from 97.107.138.15: icmp_seq=1 ttl=64 time=1.25 ms ^C 
13:40 jsmith@undertow% arp -n 97.107.138.15 
Address HWtype HWaddress Flags Mask Iface 
97.107.138.15 ether fe:fd:61:6b:8a:0f C eth0

Knowing that, you do a little subprocess magic — otherwise you’re writing ARP cache

 

>>> from subprocess import Popen, PIPE

>>> IP = “1.2.3.4” >>> # do_ping(IP)

>>> # The time between ping and arp check must be small, as ARP may not cache long

>>> pid = Popen([“arp”, “-n”, IP], stdout=PIPE)

>>> s = pid.communicate()[0]

>>> mac = re.search(r”(([a-f\d]{1,2}\:){5}[a-f\d]{1,2})”, s).groups()[0]

>>> mac "fe:fd:61:6b:8a:0f"

This is a more complex example which does an ARP ping and reports what it found with LaTeX formating.

#! /usr/bin/env python
# arping2tex : arpings a network and outputs a LaTeX table as a result

import sys
if len(sys.argv) != 2:
    print "Usage: arping2tex <net>\n  eg: arping2tex 192.168.1.0/24"
    sys.exit(1)

from scapy.all import srp,Ether,ARP,conf
conf.verb=0
ans,unans=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=sys.argv[1]),
              timeout=2)

print r"\begin{tabular}{|l|l|}"
print r"\hline"
print r"MAC & IP\\"
print r"\hline"
for snd,rcv in ans:
    print rcv.sprintf(r"%Ether.src% & %ARP.psrc%\\")
print r"\hline"
print r"\end{tabular}"

 Here is another tool that will constantly monitor all interfaces on a machine and print all 
ARP request it sees, even on 802.11 frames from a Wi-Fi card in monitor mode. 
Note the store=0 parameter to sniff() to avoid storing all packets in memory for nothing.
from scapy.all import *

def arp_monitor_callback(pkt):
    if ARP in pkt and pkt[ARP].op in (1,2): #who-has or is-at
        return pkt.sprintf("%ARP.hwsrc% %ARP.psrc%")

sniff(prn=arp_monitor_callback, filter="arp", store=0)
This entry was posted in Assignments, Ian Hodgson, Journals, Rosa Lee. Bookmark the permalink.

Leave a Reply

Your email address will not be published.