JavaScript Restrictor
Browser extension that improves privacy and security
Loading...
Searching...
No Matches
wrappingS-SENSOR-GYRO.js File Reference

Wrappers for the Gyroscope Sensor. More...

Classes

class  DataGenerator
 

Functions

function shake (axis)
 
function updateReadings (sensorObject)
 

Variables

var previousReading
 
var emulateStationaryDevice = (typeof args === 'undefined') ? true : args[0]
 
var debugMode = false
 
const TWOPI = 2 * Math.PI
 
var orig_getters
 
var origGetY = Object.getOwnPropertyDescriptor(Gyroscope.prototype, "y").get
 
var origGetZ = Object.getOwnPropertyDescriptor(Gyroscope.prototype, "z").get
 
var origGetTimestamp = Object.getOwnPropertyDescriptor(Sensor.prototype, "timestamp").get
 
var generators
 
var helping_functions
 
var hc = init_data + orig_getters + helping_functions + generators
 
var wrappers
 

Detailed Description

Wrappers for the Gyroscope Sensor.

See also
https://www.w3.org/TR/Gyroscope/
Author
Copyright (C) 2021 Radek Hranicky
License:
SPDX-License-Identifier: GPL-3.0-or-later

MOTIVATION Gyroscope readings can be used for speech recognition: https://crypto.stanford.edu/gyrophone/ and various fingerprinting operations. For stationary devices, the resonance of the unique internal or external sounds affects angular velocities affect the Gyroscope and allow to create a fingerprint: https://www.researchgate.net/publication/356678825_Mobile_Device_Fingerprint_Identification_Using_Gyroscope_Resonance For moving devices, one of the options is using the Gyroscope analyze human walking patterns: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7071017/

WRAPPING The Gyroscope sensor provides readings of the angular velocity of the device alongthe x/y/z axes. For a stationary device, all velocities should be zero in an ideal state. As we observed on the examined devices, device sensor imperfections andlittle vibrations cause the x, y and z to oscillate between -0.002 and 0.002 on the examined devices. The wrapper simulates the same behavior.

POSSIBLE IMPROVEMENTS Support for simulation of a non-stationary device. This would require modifications to other movement-related sensors (Accelerometer, etc.)

Function Documentation

◆ shake()

function shake (   axis)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateReadings()

function updateReadings (   sensorObject)

Variable Documentation

◆ debugMode

var debugMode = false

◆ emulateStationaryDevice

var emulateStationaryDevice = (typeof args === 'undefined') ? true : args[0]

◆ generators

var generators
Initial value:
= `
var dataGenerator = dataGenerator || new DataGenerator()
Definition wrappingS-SENSOR-ACCEL.js:135

◆ hc

var hc = init_data + orig_getters + helping_functions + generators

◆ helping_functions

var helping_functions
Initial value:
var sensorapi_prng_functions
Definition wrappingL-SENSOR.js:35
function shake(axis)
Definition wrappingS-SENSOR-GYRO.js:82
function updateReadings(sensorObject)
Definition wrappingS-SENSOR-GYRO.js:255

◆ orig_getters

var orig_getters
Initial value:
= `
var origGetX = Object.getOwnPropertyDescriptor(Gyroscope.prototype, "x").get

◆ origGetTimestamp

var origGetTimestamp = Object.getOwnPropertyDescriptor(Sensor.prototype, "timestamp").get

◆ origGetY

var origGetY = Object.getOwnPropertyDescriptor(Gyroscope.prototype, "y").get

◆ origGetZ

var origGetZ = Object.getOwnPropertyDescriptor(Gyroscope.prototype, "z").get

◆ previousReading

var previousReading
Initial value:
= previousReading || {orig_x: null, orig_y: null, orig_z: null, timestamp: null,
fake_x: null, fake_y: null, fake_z: null}
var previousReading
Definition wrappingS-SENSOR-GYRO.js:59

◆ TWOPI

const TWOPI = 2 * Math.PI

◆ wrappers

var wrappers