Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update findbutton #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions bin/findbutton
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if (last_argument.indexOf('findbutton') === -1) {
iface = last_argument;
}
var pcap_session = create_session(iface, 'all');
var macList = {};

console.log("Watching for arp & udp requests on your local network, please try to press your dash now\nDash buttons should appear as manufactured by 'Amazon Technologies Inc.' ");

Expand All @@ -29,17 +30,19 @@ pcap_session.on('packet', function(raw_packet) {
possible_dash = packet.payload.shost.addr;
}
possible_dash = int_array_to_hex(possible_dash);

if(!macList.hasOwnProperty(possible_dash)){
var log = 'Possible dash hardware address detected: {0} Manufacturer: {1} Protocol: {2}',
manufacturerKey = possible_dash.slice(0,8).toString().toUpperCase().split(':').join(''),
manufacturer;

var log = 'Possible dash hardware address detected: {0} Manufacturer: {1} Protocol: {2}',
manufacturerKey = possible_dash.slice(0,8).toString().toUpperCase().split(':').join(''),
manufacturer;

if(manufacturer_directory.hasOwnProperty(manufacturerKey)) {
manufacturer = manufacturer_directory[manufacturerKey];
} else {
manufacturer = 'unknown';
if(manufacturer_directory.hasOwnProperty(manufacturerKey)) {
manufacturer = manufacturer_directory[manufacturerKey];
} else {
manufacturer = 'unknown';
}
console.log(log.replace('{0}', possible_dash).replace('{1}', manufacturer).replace('{2}', protocol));
macList[possible_dash] = manufacturer;
}

console.log(log.replace('{0}', possible_dash).replace('{1}', manufacturer).replace('{2}', protocol));
}
});