【问题标题】:How Orvibo S20 WIFI plugs are controlled outside of local network?Orvibo S20 WIFI 插头如何在本地网络之外进行控制?
【发布时间】:2015-02-22 16:35:51
【问题描述】:

我买了一个 Orvibo S20 WIFI 插头。在本地网络中控制时效果很好。有关控制协议的一些信息可在此处获得 (Wifi socket communication with android phone)。 但是在本地网络之外(来自蜂窝或互联网),插头控制不起作用。 有人知道如何在本地网络之外控制这些插头吗?使用哪些协议、端口、插件何时更新 dynDNS 服务器...? 感谢您的帮助

【问题讨论】:

  • 请注意,您需要在 WiWo 应用程序中创建一个用户帐户,然后才能从您的 LAN 外部进行控制 - 一旦我创建了一个帐户,事情就神奇地开始工作,而无需设置端口转发或类似功能。

标签: networking wifi iot


【解决方案1】:

我认为 S20 与外部服务器通信,该服务器将命令从应用程序路由到设备。我认为这是因为当我的互联网连接中断时,即使通过应用程序从本地网络也无法使用我的 S20。

如果您的应用无法在本地网络之外运行,我最好的猜测是设备和外部服务器之间可能存在某种防火墙问题导致问题。

编辑: 实际上,在进一步测试后,如果互联网中断,该应用程序确实可以在本地网络连接上运行。不过,您的问题可能与端口/防火墙有关。

【讨论】:

    【解决方案2】:

    有两种方法可以将密码发送到套接字。要么连接到由套接字创建的未加密 Wifi 网络,然后使用 HF-A11(实际上是 HF-LPB100)芯片的 AT+ 命令通过 UDP 端口 48899 发送密码。

    或者尝试通过将密码编码为wifi数据包长度来发送密码,并重复发送包含0x05(UDP端口49999)的各种长度的数据包。 Socket 嗅探 wifi 加密的 Wifi 流量并尝试从中确定 wifi 密码。

    我的博客https://stikonas.eu/wordpress/2015/02/24/reverse-engineering-orvibo-s20-socket/ 上提供了更多信息。那里有一些其他有用帖子的链接,可以让您了解套接字是如何工作的(基本上在端口 10000 上发送/接收 UDP 数据包)。

    很遗憾,将密码发送到套接字的两种方法都不安全,因此出于安全考虑,您可以认为您的 wifi 密码已泄露。

    (这主要是对 Humberto Figueiredo 的回复,但 StackExchange 规则不允许我将其作为评论发布)

    【讨论】:

      【解决方案3】:

      我使用了下面的脚本,其中也包含一个 PHP 脚本。

      #!/bin/bash
      
      # script to find the lan ip address mini computer
      hostname -I > /tmp/plug_config_own_ip.txt
      
      # script to find the mac addres mini computer
      ifconfig eth0 | grep HWaddr >& /tmp/plug_config_own_mac.txt
      
      # script to find the wan ip address mini computer
      wget http://ipecho.net/plain -O - -q > /tmp/plug_config_own_ip_wan.txt
      
      # script to populate the arp table
      sudo nmap --send-ip -sP 192.168.1.0/24
      sudo nmap --send-ip -sP 192.168.0.0/24
      
      # script to find the ip & mac address & little endian wifi plugs
      ping -c 4 HF-LPB100 && arp -n  | grep ac:cf:23 >& /tmp/plug_config_wifi_socket_ip.txt
      arp -n  | grep ac:cf:23 >& /tmp/plug_config_wifi_socket_ip.txt
      
      
      # php script to upload information into database
      php /../plug_config.php > /tmp/plug_config_output.txt 2>/tmp/plug_config_error.txt &
      

      PHP 脚本主要用于创建打开/关闭不同 WIFI 套接字的编码。这就是为什么我需要WIFI套接字的IP、mac地址。除此之外,这个 PHP 脚本还存储了打开和关闭 WIFI 套接字的代码行。后来我使用这些信息来自动打开或关闭设备。请参阅下面的 PHP:

      <?php
      include '/DBconfig.php';
      
      //
      // Config variables
      //
      $filename1 = "/tmp/plug_config_own_ip.txt";
      $filename2 = "/tmp/plug_config_own_ip_wan.txt";
      $filename3 = "/tmp/plug_config_own_mac.txt";
      $filename4 = "/tmp/plug_config_wifi_socket_ip.txt";
      
      $mysqli= new mysqli($host  , $user  , $pw  ,$db);
      if ($mysqli->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
      }
      
      
      if (file_exists($filename2)) {
          $file = fopen($filename2,"r");
        $ip_address_wan = file($filename2,FILE_IGNORE_NEW_LINES)[0];
          $ip_address_wan = trim($ip_address_wan);
        // echo "ip_address_wan: ".$ip_address_wan;
      fclose($file);
      } else {
              echo "The file $filename2 does not exist";
      }
      
      if (file_exists($filename3)) {
          $file = fopen($filename3,"r");
        $mac_address = file($filename3,FILE_IGNORE_NEW_LINES)[0];
        $mac_address = substr(strrchr($mac_address, "HWaddr "), 7);
        $mac_address = trim($mac_address);
        // echo "mac_address: ".$mac_address;
      fclose($file);
      } else {
              echo "The file $filename3 does not exist";
      }
      
      // get information from wifi sockets
      
      if (file_exists($filename4)) {
          $file = fopen($filename4,"r");
      
      $ln=1;
      $device_ind = 2001;
      while(! feof($file))
        {
        $data = fgets($file);
        //echo "data: ".$data;
          $ip_address = trim(substr($data, 0,15));
          IF(empty($ip_address)){$device_ind=0;}
        //echo "ip_address: ".$ip_address;
        $mac_address = trim(substr($data,(strpos($data, "ether"))+8, 20));
        // echo "mac_address: ".$mac_address;
        $mac = substr($mac_address,0,2)." ".substr($mac_address,3,2)." ".substr($mac_address,6,2)." ".substr($mac_address,9,2)." ".substr($mac_address,12,2)." ".substr($mac_address,15,2);
        $mac = trim($mac);
        // echo "mac: ".$mac;
        $little_endian = substr($mac_address,15,2)." ".substr($mac_address,12,2)." ".substr($mac_address,9,2)." ".substr($mac_address,6,2)." ".substr($mac_address,3,2)." ".substr($mac_address,0,2);
        $little_endian = trim($little_endian);
        // echo "little_endian: ".$little_endian;
        $subscribe_code = "echo '68 64 00 1e 63 6c ".$mac." 20 20 20 20 20 20 ".$little_endian." 20 20 20 20 20 20 ' | xxd -r -p | nc -i5 -n -4u -w1  ".$ip_address." 10000";
        $subscribe_code = base64_encode($subscribe_code);
        //echo "subscribe_code: ".$subscribe_code;
        $on_code = "echo '68 64 00 17 64 63 ".$mac." 20 20 20 20 20 20 00 00 00 00 01' | xxd -r -p | nc -i5 -n -4u -w1 ".$ip_address." 10000";
        $on_code = base64_encode($on_code);
        //echo "on_code: ".$on_code;
        $off_code = "echo '68 64 00 17 64 63 ".$mac." 20 20 20 20 20 20 00 00 00 00 00' | xxd -r -p | nc -i5 -n -4u -w1 ".$ip_address." 10000";
        $off_code = base64_encode($off_code);
        //echo "off_code: ".$off_code;
        //$status_code = "";
        // echo "status_code: ".$status_code;
        // insert information into soso_devices table
        $query = "INSERT INTO soso_devices (`device_ind`,`ip_address`, `mac_address`, `mac`, `little_endian`, `subscribe_code`, `on_code`, `off_code`, `status`) VALUES ('".$device_ind."','".$ip_address."','".$mac_address."','".$mac."','".$little_endian."','".$subscribe_code."','".$on_code."','".$off_code."','Y')";
        $mysqli->query($query);
        //echo $query;
        $device_ind++;
        $ln++;
        }
      
      fclose($file);
      
      
      } else {
              echo "The file $filename4 does not exist";
      }
      
      
      mysqli_close($mysqli); // closing connection
      
      ?>
      

      希望这会有所帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-08
        • 1970-01-01
        • 1970-01-01
        • 2017-12-10
        • 1970-01-01
        相关资源
        最近更新 更多