CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/tools/recon/google_geolocate_bssid.rb
Views: 1904
1
#!/usr/bin/env ruby
2
3
##
4
# This module requires Metasploit: https://metasploit.com/download
5
# Current source: https://github.com/rapid7/metasploit-framework
6
##
7
8
#
9
# This tool asks Google for the location of a given set of BSSIDs
10
#
11
12
msfbase = __FILE__
13
while File.symlink?(msfbase)
14
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
15
end
16
17
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..','lib')))
18
require 'optparse'
19
20
if ARGV.length < 2
21
$stderr.puts("Usage: #{$PROGRAM_NAME} <api_key> <mac> [mac] ...")
22
$stderr.puts("Ask Google for the location of the given set of BSSIDs")
23
$stderr.puts
24
$stderr.puts("Example: iwlist sc 2>/dev/null|awk '/Address/{print $5}'|xargs #{$PROGRAM_NAME} <api_key>")
25
$stderr.puts("Example: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I|awk '/BSSID/{print $2}'|xargs #{$PROGRAM_NAME} <api_key>")
26
exit(1)
27
end
28
29
g = Rex::Google::Geolocation.new
30
g.set_api_key(ARGV[0])
31
ARGV.drop(1).each do |mac|
32
g.add_wlan(mac, -83)
33
end
34
35
g.fetch!
36
37
puts g, g.google_maps_url
38
39