Hacker Public Radio

HPR4331: Re-inventing the light switch


Listen Later

This show has been flagged as Clean by the host.

Bulbs


Wiz Connected smart light bulbs


Exploit


Article about hacking the lights


Source Code


Source code of the hack


Cordova


Apache Cordova framework for mobile apps


Cordova Plugin


SSH Connect Cordova Plugin


KDE Widgets



Mobile Interface



Code


Python Script


wiz-hack.py
import socket
import time
import random
import sys
if len(sys.argv) < 3:
    print(help)
    exit()
IP = sys.argv[1]
on = """{"params":{"orig":"andr","state":true},"id":6,"method":"setPilot"}"""
off = """{"params":{"orig":"andr","state":false},"id":6,"method":"setPilot"}"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((IP, 38899))
if sys.argv[2] != "on" and sys.argv[2] != "off":
  print("Changing lights color")
  b = sys.argv[2]
  color_send = """{"method":"setPilot","params":{"r":""" + str(255) + ""","g":""" + str(255) + ""","b":""" + str(255) + ""","dimming":""" + str(b) + """}}"""
  print(color_send)
  s.sendall(bytes(color_send, "utf-8"))
  s.close()
elif sys.argv[2] == "on":
    print("Turning on the lights")
    s.sendall(bytes(on, "utf-8"))
    s.close()
elif sys.argv[2] == "off":
    print("Turning off the lights")
    s.sendall(bytes(off, "utf-8"))
    s.close()

Shell Scripts


on.sh
#!/bin/sh
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.94 on
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.177 on
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.207 on
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.254 on

off.sh
#!/bin/sh
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.94 off
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.177 off
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.207 off
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.254 off

light.sh
#!/bin/sh
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.94 "$1"
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.177 "$1"
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.207 "$1"
/usr/bin/python /usr/local/bin/wiz-hack.py 192.168.0.254 "$1"

Mobile App


index.html (excerpt)
...
Light Control
On
Off


Brightness:

index.js
const user = "user";
const password = "redacted_password";
const host = "192.168.0.218";
const port = "22";
var sshConnect;
function on() {
  sshConnect.connect(user, password, host, port, () => {
      sshConnect.executeCommand('on.sh', function() {
          sshConnect.disconnect();
      });
  });
}
function off() {
  sshConnect.connect(user, password, host, port, () => {
      sshConnect.executeCommand('off.sh', function() {
          sshConnect.disconnect();
      });
  });
}
function brightness(level) {
  sshConnect.connect(user, password, host, port, () => {
      sshConnect.executeCommand('light.sh '+level, function() {
          sshConnect.disconnect();
      });
  });
}    
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
  sshConnect = cordova.plugins.sshConnect;
  document.getElementById("onButton").addEventListener("click", () => {
    // Send "on" command to light
    console.log("Light turned on");
    on();
  });
  document.getElementById("offButton").addEventListener("click", () => {
    // Send "off" command to light
    console.log("Light turned off");
    off();
  });
  document.getElementById("brightnessSlider").addEventListener("input", () => {
    const level = document.getElementById("brightnessSlider").value;
    // Send brightness value to light
    console.log("Brightness set to:", level);
    brightness(level);
  });
}


Provide feedback on this episode.

...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

292 Listeners

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec by Jerry Bell and Andrew Kalat

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec

374 Listeners

LINUX Unplugged by Jupiter Broadcasting

LINUX Unplugged

266 Listeners

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast) by Johannes B. Ullrich

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast)

653 Listeners

Curious Cases by BBC Radio 4

Curious Cases

827 Listeners

The Strong Towns Podcast by Strong Towns

The Strong Towns Podcast

426 Listeners

Late Night Linux by The Late Night Linux Family

Late Night Linux

164 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,012 Listeners

Cybersecurity Today by Jim Love

Cybersecurity Today

177 Listeners

CISO Series Podcast by David Spark, Mike Johnson, and Andy Ellis

CISO Series Podcast

189 Listeners

TechCrunch Daily Crunch by TechCrunch

TechCrunch Daily Crunch

41 Listeners

Strict Scrutiny by Crooked Media

Strict Scrutiny

5,774 Listeners

2.5 Admins by The Late Night Linux Family

2.5 Admins

97 Listeners

Cyber Security Headlines by CISO Series

Cyber Security Headlines

136 Listeners

What the Hack? by DeleteMe

What the Hack?

222 Listeners