Nekmo / amazon-dash

Hack your Amazon Dash to run what you want.
MIT License
828 stars 67 forks source link

Sniffing automatically happens on the interface with the default route #55

Closed fleaz closed 6 years ago

fleaz commented 6 years ago

Description

Hi, I just wanted to use amazon-dash and installed it on my homeserver, but during discovery I realised that something is not working as expected. The problem seems to be that sniffing happens on the interface with the default IPv4 route. Due to the fact that my homeserver is also my router, the interface with the default route is not the interface where my LAN is conencted. Therefore the sniff function does not see the Layer2 traffic from my LAN (and therefore not my Dash Button) but only all UDP Traffic from the VPN interface which contains my default route. Due to the fact that it's a Layer3 VPN amazon-dash discovery shows IP Addresses instead of MAC addresses which proves my hypothesis. When I delete my v4 default route and set the default gateway to something inside of my LAN, everything works as expected.

A possible solution could be to optionally set an interface name in the /etc/amazon-dash.yml and pass this as an argument to scapy's sniff() function? Haven't read that much of scapy docu so I'm not sure if this is possible. But you will probably know scapy better.

Let my know if I can help you any more with debugging this problem.

Best regards, Felix

What I Did

$ pip3 install amazon-dash
$ python3 -m amazon_dash.install
$ amazon-dash discovery
Nekmo commented 6 years ago

An option to select the network interface should be possible. I do not know if it is possible but I will investigate it.

fleaz commented 6 years ago

I looked into the Scapy documentation and found that you can pass iface= to the sniff() function. Therefore it should be not much work to implement a interface option into the amazon-dash.yml

Sadly I will write a lot of exams in the next few weeks and therefore don't have the time to write a PR to implement this myself.

But thanks for looking into this :)

Nekmo commented 6 years ago

Thanks for your help :) I will include this feature for the next version.

Nekmo commented 6 years ago

Interface is now available on develop branch:

Settings:

settings:
  delay: 15
  interface: '<interface>'

On discovery command:

amazon-dash discovery --interface <interface>

Tell me if it works for you :)

fleaz commented 6 years ago

Works like a charm! Thanks for the fast fix :)

Nekmo commented 6 years ago

You're welcome :)