Hi mates
I'm trying to do a project for a friend of mine, which consists on re-using an Amazon dash button, to poweroff his computer with Windows 10.
I saw there are "flic" buttons (expensive), and they make it easier to activate events through IFTTT which in turn can do the task, following the steps provided in a github page I have read. So now I have the final part already prepared, but I only need my dash button to activate a curl command in a custom script I made in a OpenWRT router I have (Comtrend AR-5387un)(call it JAZZTEL_VILLEGOLAS), and then the curl command activates the IFTTT applet.
I have posted a Question in this forum - you can see here for reference. Because I needed help with the "somewhat difficult" part of the script. I finally developed my script further to this point (this version I call it dashbuttonsc3):
#!/bin/sh
#coded by borhacker
continue=true
while [ $continue == true ]
do
if [ `timeout 10 tcpdump -i wlan0 -U -s0 -v | grep -c "DASHBUTTON.lan" ` -gt 0 ]
then
echo "match"
curl https://maker.ifttt.com/trigger/button/json/with/key/mykey-sdpahdf
else
echo "no-match"
fi
done
Also I have developed a init.d script (called dashbuttonserv4):
#!/bin/sh /etc/rc.common
#coded by borhacker
STOP=09
START=21
continue=true
start() {
while [ $continue == true ]
do
if [ `timeout 10 tcpdump -i wlan0 -U -s0 -v | grep -c "DASHBUTTON.lan" ` -gt 0 ]
then
echo "match"
curl https://maker.ifttt.com/trigger/button/json/with/key/mykey-sdpahdf
else
echo "no-match"
fi
done
}
stop() {
continue=false
}
Now I'm facing two problems, one of which I'd like to face later, and the other is what I did this thread for:
Previously, I had an earlier version on the script - dashbuttonsc2 - which worked correctly, but not always. The only difference with dashbuttonsc3 was the (if ... tcpdump) line, which in dashbuttonsc2 was like this:
if [ `timeout 10 tcpdump -i wlan0 host 192.168.2.26 -U -s0 -v | grep -c "DASHBUTTON.lan" ` -gt 0 ]
Sometimes I pressed the button (being the script executed in the infinite loop), and I could see the packets being captured, but sometimes as well, I pressed the button and there were no packets. So I modified the tcpdump command to include all packets in wlan0
, and not only with the address 192.168.2.26
. So then, it became the script called dashbuttonsc3. That address is the one assigned to the dash button, by a static lease from the DHCP server of JAZZTEL_VILLEGOLAS. Then it started to capture more packets, but still there are times when I press the button and I don't see any activity.
I don't know what could be happening so that there is no packets being captured.
So I ask you please,
can you tell me how can I run a WiFi packet sniffing tool, to capture the MAC address of the dashbutton, and be integrated in my script, instead of the tcpdump command? I have heard about the monitor mode and sniffing WiFi packets, etc. I have seen too, in my Wireless configuration, the monitor mode is available, and the router is only used for this purpose, so I don't have any drawbacks in using the monitor mode. The button is configured to search for the AMAZONSERV SSID and password mypassword123 (not exactly!! ).
So maybe with this tool I could capture everything that comes from my dash button.
The other problem is related to automating the init.d script (dashbuttonserv4) but I will ask later about this.
Note, for completeness, regarding my network (maybe you're needing to know this technical aspects):
- My home network is using the subnet 192.168.1.0/24
- JAZZTEL_VILLEGOLAS is only used to do this specific task
- JAZZTEL_VILLEGOLAS has two interfaces, and they're isolated.
-
- one is
br-lan
, which is connected to my home network with the IP192.168.1.25
- one is
-
- the other is
wlann
which is connected to the Wireless AP with the SSIDAMAZONSERV
. Thewlann
interface is in the subnet 192.168.2.0/24
- the other is
- The DHCP server is disabled in
br-lan
, and the DHCP server is enabled in thewlann
to give IP address to my dash button192.168.2.26
. Also this DHCP server is serving an unexistant gateway, the192.168.2.1
, to make the dash button think it can connect to internet and make it try to connect. -
JAZZTEL_VILLEGOLAS, in the
wlann
interface, has the static IP192.168.2.3
. - The firewall has only 1 zone,
lan
, and is assigned to br-lan. output-accept. input-accept. forward-reject. - I configured it like this to prevent my dash button to connect to amazon servers, and it could get banned/bricked/not working. They say that Amazon doesn't want us to use the dash buttons anymore.
Thanks a lot for your time and your help
Borhacker