2015-08-14 22:13:11 +00:00
|
|
|
#!/usr/bin/env ruby
|
2018-03-20 11:33:34 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
2015-08-14 22:13:11 +00:00
|
|
|
#
|
|
|
|
# This tool asks Google for the location of a given set of BSSIDs
|
|
|
|
#
|
|
|
|
|
|
|
|
msfbase = __FILE__
|
|
|
|
while File.symlink?(msfbase)
|
|
|
|
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
|
|
|
end
|
|
|
|
|
2015-10-06 15:30:52 +00:00
|
|
|
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..','lib')))
|
2015-08-16 00:49:32 +00:00
|
|
|
require 'rex/google/geolocation'
|
2015-08-14 22:13:11 +00:00
|
|
|
require 'optparse'
|
|
|
|
|
2018-11-01 18:22:55 +00:00
|
|
|
if ARGV.length < 2
|
|
|
|
$stderr.puts("Usage: #{$PROGRAM_NAME} <api_key> <mac> [mac] ...")
|
2015-08-14 22:13:11 +00:00
|
|
|
$stderr.puts("Ask Google for the location of the given set of BSSIDs")
|
|
|
|
$stderr.puts
|
2018-11-01 18:22:55 +00:00
|
|
|
$stderr.puts("Example: iwlist sc 2>/dev/null|awk '/Address/{print $5}'|xargs #{$PROGRAM_NAME} <api_key>")
|
|
|
|
$stderr.puts("Example: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I|awk '/BSSID/{print $2}'|xargs #{$PROGRAM_NAME} <api_key>")
|
2015-08-14 22:13:11 +00:00
|
|
|
exit(1)
|
|
|
|
end
|
|
|
|
|
2015-08-16 00:49:32 +00:00
|
|
|
g = Rex::Google::Geolocation.new
|
2018-11-01 18:22:55 +00:00
|
|
|
g.set_api_key(ARGV[0])
|
|
|
|
ARGV.drop(1).each do |mac|
|
|
|
|
g.add_wlan(mac, -83)
|
2015-08-14 22:13:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
g.fetch!
|
|
|
|
|
|
|
|
puts g, g.google_maps_url
|