Hacking Amazon Dash with Node.js

hearddash

The idea of hacking Amazon Dash has been around for awhile now. And not too long after it came out, a Medium article on using it to track baby data was published. As inspiration, it lead to the Node.js library node-dash-button. (There’s also dash-button, which works the same way.)

As with most Node.js modules, its installation is as simple as the standard “npm install node-dash-button.” However, before you do, there are three main dependencies to worry about:

  • libpcap must be installed
  • An Android or iOS device
  • A Wifi network (the Android or iOS device must be connected to the Wifi network)

If you are running MacOS X, libpcap is already installed. The same with most distributions of Linux as well. With Windows, however, things are much more complicated, and it’s generally not recommended.

Setting up Dash

With a new Dash button in hand, open up the Amazon app in iOS or Android. Be sure you are logged in your Amazon account in the app.

From the menu, tap on “Your Account.”

2016-10-13-22-44-00

Scroll down under the Dash Devices section and tap on “Set up a new device.”

When prompted, configure the device and enter the WiFi password.

STOP and close the app when it asks you to choose a product.

Finding the Dash

In a new or existing project folder, type in:


npm install node-dash-button
cd node_modules/node-dash-button
node bin/findbutton

Note: findbutton might need to be run via sudo depending on your configuration.

screenshot-2016-10-13-22-54-05

When running, findbutton will log all arp and UDP messages. Pressing the dash button should add an entry with “Amazon Technologies.” Copy the hardware address found associated with this entry.

Working with Dash

To work with Dash from Node.js, use the following test code.


var dash_button = require('node-dash-button');
var dash = dash_button("HARDWARE ADDRESS HERE", null, null, 'all');
dash.on("detected", function (){
console.log("Heard dash!");
});

view raw

hearDash.js

hosted with ❤ by GitHub

Once running, press the Dash button. Remember, too, that detection may take up five seconds as the button wakes up, connects to the Wifi network, and broadcasts the message.

If everything is working correctly, look for the “Heard dash!” message on the console. For each press, this message will appear.

hearddash