diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 7bcaf70..0000000 --- a/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ubuntu -MAINTAINER Osbert Feng - -USER root -RUN apt-get update -qq && apt-get install -qq -y python-scapy tcpdump tcpreplay wireshark python-requests - -RUN useradd -m -s /bin/bash amzn-dash -RUN echo amzn-dash:amzn-dash | chpasswd - -USER root -ADD dash-listen.py /home/amzn-dash/dash-listen.py -CMD python /home/amzn-dash/dash-listen.py - -# NOTE: To run this, you must link against the host networking stack -# docker run --net=host -e DASH_MAC_ADDRESS= -e URL_CALLBACK=http://url/to/callback dash-listen diff --git a/dash-listen.py b/dash-listen.py deleted file mode 100644 index 6bd9cc8..0000000 --- a/dash-listen.py +++ /dev/null @@ -1,26 +0,0 @@ -# sudo apt-get install python-scapy tcpdump tcpreplay wireshark - -# Note that wireshark prompts during installation if non-root users -# should be allowed to perform packed capture. - -from scapy.all import * -import os -import requests - -DASH_MAC_ADDRESS=os.environ.get('DASH_MAC_ADDRESS') -URL_CALLBACK=os.environ.get('URL_CALLBACK') - -def arp_display(pkt): - if pkt[ARP].op == 1: #who-has (request) - if pkt[ARP].psrc == '0.0.0.0': # ARP Probe - if pkt[ARP].hwsrc == DASH_MAC_ADDRESS: - requests.get(URL_CALLBACK) - else: - print "ARP Probe from unknown device: " + pkt[ARP].hwsrc - - -while True: - try: - print sniff(prn=arp_display, filter="arp", store=0, count=10) - except: - pass diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..80e3d53 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,25 @@ +FROM alpine + +MAINTAINER Osbert Feng + +# since 2019-09-05 +MAINTAINER Pascal Gollor + +ENV DASH_MAC_ADDRESS +ENV URL_CALLBACK + +USER root +RUN apk updage +RUN apk add python-scapy python-requests +#RUN apt-get update -qq && apt-get install -qq -y python-scapy tcpdump tcpreplay wireshark python-requests +RUN rm -rf /var/cache/apk/* + +RUN useradd -m -s /bin/bash amzn-dash +RUN echo amzn-dash:amzn-dash | chpasswd + +USER root +ADD dash-listen.py /home/amzn-dash/dash-listen.py +CMD python /home/amzn-dash/dash-listen.py + +# NOTE: To run this, you must link against the host networking stack +# docker run --net=host -e DASH_MAC_ADDRESS= -e URL_CALLBACK=http://url/to/callback dash-listen diff --git a/docker/dash-listen.py b/docker/dash-listen.py new file mode 100644 index 0000000..6bd9cc8 --- /dev/null +++ b/docker/dash-listen.py @@ -0,0 +1,26 @@ +# sudo apt-get install python-scapy tcpdump tcpreplay wireshark + +# Note that wireshark prompts during installation if non-root users +# should be allowed to perform packed capture. + +from scapy.all import * +import os +import requests + +DASH_MAC_ADDRESS=os.environ.get('DASH_MAC_ADDRESS') +URL_CALLBACK=os.environ.get('URL_CALLBACK') + +def arp_display(pkt): + if pkt[ARP].op == 1: #who-has (request) + if pkt[ARP].psrc == '0.0.0.0': # ARP Probe + if pkt[ARP].hwsrc == DASH_MAC_ADDRESS: + requests.get(URL_CALLBACK) + else: + print "ARP Probe from unknown device: " + pkt[ARP].hwsrc + + +while True: + try: + print sniff(prn=arp_display, filter="arp", store=0, count=10) + except: + pass