Cut Internet temporarily in a device in your LAN

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

I got it to work, so must be something in your installation or configuration process that goes wrong

Good to hear it can work. Can you show me your portainer config just in case i got it wrong? Thanks

@Tomer_Klein
Can you write the detailed instructions on your GitHub page?
Your blog is offline.

@Vasco
Can you show me your command line switches?

I have

fpad_internet:
        friendly_name: "fPad internet"
        command_off: "arpspoof -i eno1 -t 192.168.79.1 192.168.79.16"
        command_on: "ps -ef | grep 'arpspoof -i eno1 -t 192.168.79.1 192.168.79.16' | grep -v grep | awk '{print $2}' | xargs kill"
        # command_state: "ps -ef | grep 'arpspoof -i eno1 -t 192.168.79.1 192.168.79.16' | grep -v grep | awk '{print $2}'"
        # value_template: >
        #   {{ value is not defined }}

These commands are working when used inside the container (portainer), but when using the command_line switch I’m having this error

Logger: homeassistant.components.command_line.switch
Source: components/command_line/switch.py:109
Integration: command_line (documentation, issues)
First occurred: 11:05:22 (1 occurrences)
Last logged: 11:05:22

Command failed: ps -ef | grep 'arpspoof -i eno1 -t 192.168.79.1 192.168.79.16' | grep -v grep | awk '{print $2}' | xargs kill

One of the switches I have:

switch:

  - platform: command_line
    switches:
      kill_smartlab_dashboard:
        command_on: "/usr/bin/curl -X GET http://192.168.1.12:7022/disconnect?ip=192.168.1.6"
        command_off: "/usr/bin/curl -X GET http://192.168.1.12:7022/reconnect?ip=192.168.1.6"
        command_state: "/usr/bin/curl -X GET http://192.168.1.12:7022/status?ip=192.168.1.6"
        value_template: '{{ value == "1" }}'
        friendly_name: Dashboard
1 Like

I can’t get it to work!

Here are all my settings in Portainer:

Command & Logging tab:

Volumes tab:

Network tab:

Env tab:

Labels tab:

Restart policy tab:

Runtime & Resources tab:

Capabilities tab:

And this is what I get:
image

But:
image

Can anybody figure out what I’m doing wrong?

1 Like

Where do you run this on? Latest tag bugged my system. I needed the arp one

I am just getting around to setup this up using @ Vasco settings and help. When I try to deploy the container, I get this error.

Failure
starting container with non-empty request body was deprecated since API v1.22 and removed in v1.24

It seems others are having issues as well and a workaround is to install portainer manually. I do not know how to do this really.

Hello,

Per request from @gieljnssns, I’ve created an addon based on the image here : GitHub - alexbelgium/hassio-addons: My home assistant addons

4 Likes

To avoid that you can install the portainer version from my repo (link above)

1 Like

Yep, that is what I did a few days after my initial post.

1 Like

Wow, great!
Thanks for that (:slight_smile:

1 Like

And thanks for the great app and docker image! I’ve referenced clearly your links in the addon readme to show that I’m only owner of the addon but that you are owner of the app. Please let me know if you’d like any modification to make this clearer.

I’ve taken the opportunity to map both of your env variables as addon options. For interface_name, if it is kept blank, it will be autofilled at addon launch.

1 Like

Hi @alexbelgium , no modification needed.
I have never developed an addon, and now with your work i can learn how to do it.
Thanks!

1 Like

Something happened after few updates prior. Not sure when, but I noticed my arpspoof container have been deleted from 2.9.3. I am on 2.11.0 now and re-added the container, but it is not working. When I try to run this line in the browser, nothing change. It stays at 0. The port has changed?? How was port 7022 designated to be used?

http://192.168.1.20:7022/disconnect?ip=192.168.1.104

The log is saying No such device, but I have checked and issued static ip address.

2021-12-11 23:33:58.443 | INFO     | __main__:disconnect:72 - Disconnecting ip: 192.168.1.104
192.168.1.111 - - [11/Dec/2021 23:33:58] "GET /disconnect?ip=192.168.1.104 HTTP/1.1" 200 -
arpspoof: libnet_check_iface() ioctl: No such device

2021-12-11 23:34:14.750 | INFO     | __main__:get_status:25 - Getting state for ip: 192.168.1.102
192.168.1.20 - - [11/Dec/2021 23:34:14] "GET /status?ip=192.168.1.102 HTTP/1.1" 200 -
2021-12-11 23:34:14.883 | INFO     | __main__:get_status:25 - Getting state for ip: 192.168.1.103
192.168.1.20 - - [11/Dec/2021 23:34:14] "GET /status?ip=192.168.1.103 HTTP/1.1" 200 -
2021-12-11 23:34:15.020 | INFO     | __main__:get_status:25 - Getting state for ip: 192.168.1.104
192.168.1.20 - - [11/Dec/2021 23:34:15] "GET /status?ip=192.168.1.104 HTTP/1.1" 200 -
2021-12-11 23:34:44.750 | INFO     | __main__:get_status:25 - Getting state for ip: 192.168.1.102
192.168.1.20 - - [11/Dec/2021 23:34:44] "GET /status?ip=192.168.1.102 HTTP/1.1" 200 -
2021-12-11 23:34:44.885 | INFO     | __main__:get_status:25 - Getting state for ip: 192.168.1.103
192.168.1.20 - - [11/Dec/2021 23:34:44] "GET /status?ip=192.168.1.103 HTTP/1.1" 200 -
2021-12-11 23:34:45.025 | INFO     | __main__:get_status:25 - Getting state for ip: 192.168.1.104
192.168.1.20 - - [11/Dec/2021 23:34:45] "GET /status?ip=192.168.1.104 HTTP/1.1" 200 -

EDIT: Nevermind fixed. I had the interface in all caps where is should be low caps.

eth0

Hi, if you keep the interface field blank it should auto fill! Otherwise glad that it works

1 Like

Hi, Arpspoof sort-of works for me sometimes, it’s weird. I turn on killswitch of device A - fine, works. I turn on killswitch of device B, device A connects to internet. Basically killing one device unkills (reconnects) the others. The devices mostly eventually break through and connect.

Is that how it’s supposed to work? No errors in Arpspoof log.

Tried a Tuya bulb, Pi4 with HA (that one cannot be killed whatsoever, it just ignores the killswitch and always connects), iPhone 11 Pro and Synology DS216j.

A few days ago, I’ve upgrade from rpi4 to a mini pc. I’ve used the same ip address and restore from backup. Everything seems to be running ok on the new machine, but now I get a connection refused error. I have no idea how to fix this or why I am getting this. I have not changed any settings to my knowledge. One thing I did notice was that I had to reinstall the Portainer and set it up again. I have followed the same procedure in this thread. I have changed my interface_name from eth0 to enp3s0.

I see errors in Ha about not able to connect. This is my settings as before.

  - platform: command_line
    switches:

      is_internet:
        command_on: "/usr/bin/curl -X GET http://192.168.1.20:7022/disconnect?ip=192.168.1.103"
        command_off: "/usr/bin/curl -X GET http://192.168.1.20:7022/reconnect?ip=192.168.1.103"
        command_state: "/usr/bin/curl -X GET http://192.168.1.20:7022/status?ip=192.168.1.103"
        value_template: '{{ value == "1" }}'

When I try a test cmd via browser. I get refused to connect error.

http://192.168.1.20:7022/status?ip=192.168.1.103