[LINUX] How to specify the NIC to scan with amazon-dash

Explicitly specify the NIC with amazon-dash

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.

Execution environment

The result when executed in the following environment was used.

# cat /etc/debian_version 

# 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

Specifying NIC in discovery

When executing discovery, NIC can be specified as an option.


# 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.

  --interface TEXT  Network interface.
  --help            Show this message and exit.

Specifying the NIC in run

In case of run or service (start from systemctl), specify in /etc/amazon-dash.yml.


  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:                },

About the name of the NIC

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


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 $?

Recommended Posts

How to specify the NIC to scan with amazon-dash
[Python] How to specify the download location with youtube-dl
How to specify the launch browser for JupyterLab 3.0.0
Specify the Python executable to use with virtualenv
How to try the friends-of-friends algorithm with pyfof
How to specify attributes with Mock of python
[TF] How to specify variables to update with Optimizer
How to Learn Kaldi with the JUST Corpus
How to delete the specified string with the sed command! !! !!
[Introduction to Python] How to iterate with the range function?
How to create a submenu with the [Blender] plugin
Specify MinGW as the compiler to use with Python
[Python] Summary of how to specify the color of the figure
[Python] How to rewrite the table style with python-pptx [python-pptx]
Try to specify the axis with PyTorch's Softmax function
[Selenium] How to specify the relative path of chromedriver?
How to use the generator
How to update with SQLAlchemy?
How to cast with Theano
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
How to use the decorator
How to Delete with SQLAlchemy?
How to increase the axis
How to start the program
I tried to simulate how the infection spreads with Python
How to return to the previous directory with the Bash cd command
How to manipulate the DOM in an iframe with Selenium
A story about how to deal with the CORS problem
How to get into the python development environment with Vagrant
[Introduction to Python] How to get data with the listdir function
How to cancel RT with tweepy
How to calculate the autocorrelation coefficient
Python: How to use async with
How to use the zip function
How to use the optparse module
How to use virtualenv with PowerShell
How to deal with imbalanced data
How to install python-pip with ubuntu20.04LTS
How to deal with imbalanced data
How to read the SNLI dataset
How to get the Python version
How to get started with Scrapy
How to get started with Python
[Python] How to import the library
How to deal with DistributionNotFound errors
How to get started with Django
How to Data Augmentation with PyTorch
How to use FTP with Python
How to overwrite the output to the console
How to calculate date with python
How to install mysql-connector with pip3
How to INNER JOIN with SQLAlchemy
How to use the ConfigParser module
How to install Anaconda with pyenv
How to authenticate with Django Part 2
How to authenticate with Django Part 3
[Introduction to Python] How to split a character string with the split function
How to get the ID of Type2Tag NXP NTAG213 with nfcpy
How to make a command to read the configuration file with pyramid