
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
mock-geolocation
Advanced tools
Mock for navigator.geolocation
.
var point = [54.980206086231, 82.898068362003];
geolocate.use();
navigator.geolocation.getCurrentPosition(function(position) {
assert(position.coords.latitude).equal(point[0]);
assert(position.coords.longitude).equal(point[1]);
});
geolocate.send({lat: point[0], lng: point[1]});
geolocate.restore();
Manually:
<script src="geolocate.js"></script>
From npm
:
npm install mock-geolocation
As CommonJS
or AMD
module:
var geolocate = require('mock-geolocation');
Replace the native navigator.geolocation
object
Restore navigator.geolocation
in original state
This method emulates the finding position after calling getCurrentPosition and watchPosition method.
Updates position from options
which may include the following parameters from positions.coords and timestamp.
navigator.geolocation.getCurrentPosition(function(position) {
console.log(position);
});
geolocate.send({
latitude: 50,
longitude: 10,
accuracy: 5,
timestamp: 3000
});
/* {
coords: {
accuracy: 5,
altitude: null
altitudeAccuracy: null,
heading: null,
latitude: 50
longitude: 10,
speed: null
},
timestamp: 3000
} */
navigator.geolocation.getCurrentPosition(function(position) {
console.log(position);
});
geolocate.send();
/* Show same position {
coords: {
accuracy: 5,
altitude: null
altitudeAccuracy: null,
heading: null,
latitude: 50
longitude: 10,
speed: null
},
timestamp: 3000
} */
Change current position and call success callback
of watchPosition
method.
Updates position from options
which may include the following parameters from positions.coords and timestamp.
navigator.geolocation.watchPosition(function(position) {
console.log(position.coords.latitude + ', ' + position.coords.longitude);
});
geolocate.send();
// 54.9799, 82.89683699999999
geolocate.change({lat: 10, lng: 15});
// 10, 15
geolocate.change({lat: 25});
// 25, 15
Call error callback
of getCurrentPosition
method.
options
may include the parameters code and message.
Call error callback
of watchPosition
method.
options
may include the parameters code and message.
FAQs
Mock for navigator.geolocation API
The npm package mock-geolocation receives a total of 3,207 weekly downloads. As such, mock-geolocation popularity was classified as popular.
We found that mock-geolocation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.