abusing phones to make the internet of things - wix ua meetup

80
abusing phones Wix UA R&D 23 April 2015 to make the internet of things @janjongboom

Upload: jan-jongboom

Post on 15-Jul-2015

262 views

Category:

Internet


1 download

TRANSCRIPT

Page 1: Abusing phones to make the internet of things - Wix UA Meetup

abusing phones

Wix UA R&D 23 April 2015

to make the internet of things

@janjongboom

Page 2: Abusing phones to make the internet of things - Wix UA Meetup

Telenor R&D

@janjongboomMozilla things

Page 3: Abusing phones to make the internet of things - Wix UA Meetup
Page 4: Abusing phones to make the internet of things - Wix UA Meetup

I hate JavaScript!

Page 5: Abusing phones to make the internet of things - Wix UA Meetup

VBScript <3 <3 <3

Page 6: Abusing phones to make the internet of things - Wix UA Meetup
Page 7: Abusing phones to make the internet of things - Wix UA Meetup
Page 8: Abusing phones to make the internet of things - Wix UA Meetup
Page 9: Abusing phones to make the internet of things - Wix UA Meetup

PrerequisitesRaspberry Pi B+ (v1)

Breadboard Some LEDs

Jan's awesome Firefox OS Build

Page 10: Abusing phones to make the internet of things - Wix UA Meetup
Page 11: Abusing phones to make the internet of things - Wix UA Meetup

1 navigator.gpio.setPinMode(2, 'output') 2 .then(pin => { 3 pin.writeDigital(true); 4 5 setTimeout(() => pin.writeDigital(false), 500); 6 });

Page 12: Abusing phones to make the internet of things - Wix UA Meetup
Page 13: Abusing phones to make the internet of things - Wix UA Meetup

1 navigator.gpio.setPinMode(26, 'input') 2 .then(pin26 => { 3 4 setInterval(() => { 5 pin26.readDigital().then(v => { 6 // do something 7 }); 8 }, 50); 9 10 });

Page 14: Abusing phones to make the internet of things - Wix UA Meetup
Page 15: Abusing phones to make the internet of things - Wix UA Meetup
Page 16: Abusing phones to make the internet of things - Wix UA Meetup

DownsideConnectivity? Camera? Accelerometer?

Page 17: Abusing phones to make the internet of things - Wix UA Meetup

JanOSTurn your smartphone into an IoT board

Page 18: Abusing phones to make the internet of things - Wix UA Meetup

JanOSAlternative OS for smartphones

Based on Firefox OS Runs on mobile phones

Page 19: Abusing phones to make the internet of things - Wix UA Meetup

Runs without a screen

Page 20: Abusing phones to make the internet of things - Wix UA Meetup
Page 21: Abusing phones to make the internet of things - Wix UA Meetup
Page 22: Abusing phones to make the internet of things - Wix UA Meetup

UAH 484

Page 23: Abusing phones to make the internet of things - Wix UA Meetup

UAH 727

Page 24: Abusing phones to make the internet of things - Wix UA Meetup
Page 25: Abusing phones to make the internet of things - Wix UA Meetup

GSM ShieldOnly 2G

Antenna not included

UAH 1700

Page 26: Abusing phones to make the internet of things - Wix UA Meetup

Firefox OS without UI, with extra low level APIs

So what is JanOS?

(and some kernel changes)

Page 27: Abusing phones to make the internet of things - Wix UA Meetup

Extra APIsFilesystem access

Running native code IoT functionality like GPIO

Page 28: Abusing phones to make the internet of things - Wix UA Meetup

Linux Kernel

Gecko HTML5 UI

Has all phone APIs in JS

Page 29: Abusing phones to make the internet of things - Wix UA Meetup

Similar to node.jsBut...

Page 30: Abusing phones to make the internet of things - Wix UA Meetup

Made for embeddedLaunched in 30 countries, on tens of handsets, tablets, TVs, etc.

Page 31: Abusing phones to make the internet of things - Wix UA Meetup

First class comm with RILHardest part of the phone

Page 32: Abusing phones to make the internet of things - Wix UA Meetup

Power efficientRPi battery shield 45 S$ Firefox OS phone

22 mAh idle 6 mAh idle

Page 33: Abusing phones to make the internet of things - Wix UA Meetup

Still has the webWebRTC / WebAudio / DOM etc.

Page 34: Abusing phones to make the internet of things - Wix UA Meetup

Getting startedFlashing JanOS on a phone

Page 35: Abusing phones to make the internet of things - Wix UA Meetup

www.janos.io

Page 36: Abusing phones to make the internet of things - Wix UA Meetup
Page 37: Abusing phones to make the internet of things - Wix UA Meetup

First screwdriver ever!

Page 38: Abusing phones to make the internet of things - Wix UA Meetup
Page 39: Abusing phones to make the internet of things - Wix UA Meetup
Page 40: Abusing phones to make the internet of things - Wix UA Meetup
Page 41: Abusing phones to make the internet of things - Wix UA Meetup
Page 42: Abusing phones to make the internet of things - Wix UA Meetup
Page 43: Abusing phones to make the internet of things - Wix UA Meetup
Page 44: Abusing phones to make the internet of things - Wix UA Meetup
Page 45: Abusing phones to make the internet of things - Wix UA Meetup
Page 46: Abusing phones to make the internet of things - Wix UA Meetup
Page 47: Abusing phones to make the internet of things - Wix UA Meetup
Page 48: Abusing phones to make the internet of things - Wix UA Meetup
Page 49: Abusing phones to make the internet of things - Wix UA Meetup
Page 50: Abusing phones to make the internet of things - Wix UA Meetup
Page 51: Abusing phones to make the internet of things - Wix UA Meetup
Page 52: Abusing phones to make the internet of things - Wix UA Meetup

Booting / flashing

Page 53: Abusing phones to make the internet of things - Wix UA Meetup
Page 54: Abusing phones to make the internet of things - Wix UA Meetup
Page 55: Abusing phones to make the internet of things - Wix UA Meetup
Page 56: Abusing phones to make the internet of things - Wix UA Meetup

Hello world

1. Clone repo

2. Create JS file with some code

3. Add the JS file to index.html

https://github.com/jan-os/janos

Page 57: Abusing phones to make the internet of things - Wix UA Meetup

1 var conn = navigator.mozMobileConnections[0]; 2 conn.addEventListener('voicechange', function vc() { 3 if (conn.voice.connected) { 4 conn.removeEventListener('voicechange', vc); 5 6 var req = navigator.mozMobileMessage 7 .send('+31612345678', 'Hello from JanOS!'); 8 req.onsuccess = function() { 9 console.log('Message sent successfully'); 10 }; 11 req.onerror = function() { 12 console.error('Could not send SMS', req.error); 13 }; 14 } 15 });

Page 58: Abusing phones to make the internet of things - Wix UA Meetup

DoorbellProximity sensor

Ring over bluetooth

Live video stream

Page 59: Abusing phones to make the internet of things - Wix UA Meetup

Bluetooth doorbell 1 enableBluetoothAudio('00:0C:8A:75:EF:30').then(function() { 2 window.onuserproximity = function(e) { 3 if (e.near) { 4 var audio = new Audio('/sounds/doorbell.ogg'); 5 audio.play(); 6 } 7 }; 8 });

Page 60: Abusing phones to make the internet of things - Wix UA Meetup

Brian

Page 61: Abusing phones to make the internet of things - Wix UA Meetup

BrianTracker™2G connection

Connected to push server

Geolocation on request

Page 62: Abusing phones to make the internet of things - Wix UA Meetup
Page 63: Abusing phones to make the internet of things - Wix UA Meetup
Page 64: Abusing phones to make the internet of things - Wix UA Meetup

Rethink applicationsConnectivity & sensors on hand

Page 65: Abusing phones to make the internet of things - Wix UA Meetup

Accelerometer?

Page 66: Abusing phones to make the internet of things - Wix UA Meetup

Proximity Accelerometer Ambient Light Magnetometer Gyroscope Humidity Ambient Temperature Pressure Battery Cameras

Page 67: Abusing phones to make the internet of things - Wix UA Meetup

Bend sensor

Page 68: Abusing phones to make the internet of things - Wix UA Meetup

Weight scale

Page 69: Abusing phones to make the internet of things - Wix UA Meetup

Device LightReal purpose: adjust brightness

Page 70: Abusing phones to make the internet of things - Wix UA Meetup

MusicTheremin is instrument

Use device light as tone frequency

Wave your hands and magic!

Page 71: Abusing phones to make the internet of things - Wix UA Meetup

1 var context = new AudioContext(); 2 var oscillator = context.createOscillator(); 3 oscillator.connect(context.destination); 4 oscillator.start(0); 5 6 window.addEventListener('devicelight', function(e) { 7 oscillator.frequency.value = e.value * 10; 8 });

Music

Page 72: Abusing phones to make the internet of things - Wix UA Meetup

AccelerometerReal purpose: Turn to mute

Page 73: Abusing phones to make the internet of things - Wix UA Meetup

Juggling visualizerMeasure z-forces on device

Plot it in graph over time

Juggle with multiple devices

Page 74: Abusing phones to make the internet of things - Wix UA Meetup

Juggling visualizer

1 window.addEventListener('devicemotion', function(e) { 2 var serie = getGraphSerieForDevice(e.data.deviceId); 3 serie.addPoint([ e.data.timestamp, Math.abs(e.data.z) ]); 4 });

Page 75: Abusing phones to make the internet of things - Wix UA Meetup

BeaconsReal purpose: ads

Page 76: Abusing phones to make the internet of things - Wix UA Meetup

BeaconsTag everyone with a beacon

Cross-reference facebook Phone alerts you who to talk to

Page 77: Abusing phones to make the internet of things - Wix UA Meetup

Beacons 1 var Bleacon = require('bleacon'); 2 3 Bleacon.startScanning(); 4 5 Bleacon.on('discover', function(b) { 6 console.log('found', b.major, b.minor, b.distance); 7 });

Work in progress in Firefox OS & Firefox for Android (https://bugzilla.mozilla.org/show_bug.cgi?id=1063444)

Page 78: Abusing phones to make the internet of things - Wix UA Meetup
Page 79: Abusing phones to make the internet of things - Wix UA Meetup

Get hacking!

Grab a phone that has latest Chrome / Firefox

Use that sensor data

Think outside the box

Page 80: Abusing phones to make the internet of things - Wix UA Meetup

Thank you!www.janos.io

@janjongboom