It is a TIPS of OSS, amazon-dash that converts Amazon Dash button to IoT button.
When discovering or running with amazon-dash, if there are multiple NICs, packets of unintended NICs may be monitored. For example, if eth0 and eth1 exist, eth0 may be scanned even if the NIC to which the Amazon Dash button is connected is eth1. In that case, it is necessary to explicitly specify the NIC to scan with the following TIPS.
The result when executed in the following environment was used.
# cat /etc/debian_version
10.7
# python --version
Python 2.7.16
# pip --version
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
# amazon-dash
Welcome to Amazon-dash v1.4.0 using Python 2.7.16
When executing discovery, NIC can be specified as an option.
example
# amazon-dash discovery --interface eth1
Document It was written in the help
# amazon-dash discovery --help
Welcome to Amazon-dash v1.4.0 using Python 2.7.16
December 31 is the last day to block requests from your Amazon-dash buttons to Amazon servers. In 2020 your buttons can be bricked in an update from Amazon servers.
Usage: amazon-dash discovery [OPTIONS]
Discover Amazon Dash device on network.
Options:
--interface TEXT Network interface.
--help Show this message and exit.
In case of run or service (start from systemctl), specify in /etc/amazon-dash.yml
.
example
settings:
interface: eth1
Document
There is no description in /etc/amazon-dash.yml
itself, but you can check it in the source code.
You can check the existence of the corresponding file in the JSON schema with config.py
.
18:#: Json-schema validation
19:SCHEMA = {
20: "title": "Config",
21: "type": "object",
22: "properties": {
23: "settings": {
24: "type": "object",
25: "properties": {
26: "delay": {
27: "type": "integer"
28: },
29: "interface": {
30: "type": "string"
31: },
The NIC name itself has not been validated in amazon-dash, it seems that it is just passed to scan_devices
in scan.py
.
In short, anything is fine as long as the OS can recognize it.
In addition to the physical NIC, the VLAN Interface (eg eth1.100
) is also operating normally.
As a test, I passed an invalid interface name and it stopped with an error like this. If you have any trouble after changing the NIC area, please refer to it.
# amazon-dash discovery --interface foo
Welcome to Amazon-dash v1.4.0 using Python 2.7.16
(snip)
OSError: foo: No such device exists (SIOCGIFHWADDR: No such device)
Exception IOError: IOError(19, 'No such device') in <bound method L2ListenSocket.__del__ of <scapy.arch.linux.L2ListenSocket object at 0xb6744f0c>> ignored
# echo $?
1
Recommended Posts