Path: blob/master/tools/recon/google_geolocate_bssid.rb
19515 views
#!/usr/bin/env ruby12##3# This module requires Metasploit: https://metasploit.com/download4# Current source: https://github.com/rapid7/metasploit-framework5##67#8# This tool asks Google for the location of a given set of BSSIDs9#1011msfbase = __FILE__12while File.symlink?(msfbase)13msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))14end1516$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..','lib')))17require 'optparse'1819if ARGV.length < 220$stderr.puts("Usage: #{$PROGRAM_NAME} <api_key> <mac> [mac] ...")21$stderr.puts("Ask Google for the location of the given set of BSSIDs")22$stderr.puts23$stderr.puts("Example: iwlist sc 2>/dev/null|awk '/Address/{print $5}'|xargs #{$PROGRAM_NAME} <api_key>")24$stderr.puts("Example: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I|awk '/BSSID/{print $2}'|xargs #{$PROGRAM_NAME} <api_key>")25exit(1)26end2728g = Rex::Google::Geolocation.new29g.set_api_key(ARGV[0])30ARGV.drop(1).each do |mac|31g.add_wlan(mac, -83)32end3334g.fetch!3536puts g, g.google_maps_url373839