Cut Internet temporarily in a device in your LAN

Also curious as @ashfaaaa asked, is this possible with HA via Docker install?

Iā€™m also interested in this as an Hass.io addon.

Yes, me three with Hassio install. My kid is out of control with youtube. This is the solution to my problem

Well, Long time ago i was searching for a way to implement some kind of Internet kill switch. i came a cross an article that shows how to use arpspoof in order to that. the problem was that alpine does not support arpspoof so i have developed dockere container with arpspoos warpped with python flask and here is the result.

Finally, got it working.
ArpSpoof docker

https://en.techblog.co.il/2021/03/15/home-assistant-cut-internet-connection-using-arpspoof/

3 Likes

nice guide, easy to follow and setup

@Tomer_Klein the link doesnā€™t work, do you have new one that works?

https://hub.docker.com/r/techblog/arpspoof-docker

Would you be able to post the ā€œHow toā€ to your Github page

I would like to know as well a how to install guide.

lol after googling and reverse engineering links back to each site, i think i found something. But itā€™s Hebrew, so used google translate to make it readable for those who canā€™t read that.

https://translate.google.com/translate?sl=auto&tl=en&u=https://www.home-assistant.co.il/single-post/2018/10/04/Cut-internet-connection-using-ArpSpoof

Yes,
Sorry for that.
My site has been hackd and i had to take it down.
working on new guid, will publish it in a few days.

The howto is back online, there are some images still missing, but the instructions are there.

Got it up and running. Fun, reminds me of some days at school where we did the same to teachers using netcut xD also arp spoofing tool.

For those running docker on rpi. Make sure you use the arm tag

I was thinking, would be awesome to have a card which automatically populates with unknown devices. And I hope @thomasloven can help me a bit. This could be very powerful in first line of direct defence.

So, first off all I think Iā€™d use nmap tracker and have it scan my DHCP range (192.168.1.1-255) or maybe (192.168.1.2-254 , as 192.168.1.1 is my router and 255 is just a broadcast address)

Then maybe (and this is where I could use @thomasloven his knowledge) use auto-entities card from thomas ( GitHub - thomasloven/lovelace-auto-entities: šŸ”¹Automatically populate the entities-list of lovelace cards )

So, domain maybe device_tracker as filter, exclude the devices I know.

Then comes the tricky part, hope there is a solution to this. It needs a way to dynamically fill in some predefined data and insert some variables.

  - platform: command_line
    switches:
      kill_internet:
        command_on: "/usr/bin/curl -X GET http://[docker_ip]:7022/disconnect?ip=[IP_to_Block]"
        command_off: "/usr/bin/curl -X GET http://[docker_ip]:7022/reconnect?ip=[IP_to_Block]"
        command_state: "/usr/bin/curl -X GET http://[docker_ip]:7022/status?ip=[IP_to_Block]"
        value_template: '{{ value == "1" }}'
        friendly_name: Internet Kill Switch

As where IP_to_Block should be auto populated by the nmap attribute: ip

@thomasloven can you please help me with this idea, or point me into a direction as to where I can continue my investigation?

Oh ok. Now that the link is backup online. I remembered looking at the page, but didnā€™t go forward with the install because I have no idea how to install it on my HomeAssistantOS over a rpi3. Never played with Docker either.

  1. Install portainer addon
  2. Open portainer
  3. Choose new container
  4. Fill in all the details, below is the template. Portainer is the gui. So there you have a few tabs to fill, such as labelw, image, environment etc. You can ignore the volume as I donā€™t need to map anything.
version: "3.7"

services:

  arpspoof:
    image: techblog/arpspoof-docker
 #   build: https://github.com/t0mer/broadlinkmanager-docker.git
    network_mode: host #Network mode must be set to host
    container_name: arpspoof
    restart: unless-stopped
    labels:
      - "com.ouroboros.enable=true"
    volumes:
      - ./arpspoof/arpspoof.py:/opt/arpspoof/arpspoof.py
    environment:
      - ROUTER_IP= #Required Router IP
      - INTERFACE_NAME= #Required Interface name

I will PM you a few screenshots of my setup in portainer. Makes it easier.

1 Like

Iā€™ve found two portainer. I should choice Home assistant Community Add-oms?

2021-06-12_18-13-52

Community addons version is fine

Has anybody gotten this to work? I have installed it however ports are not being published so i cannot send curl commands to it