Orvibo S20 WIFI插头如何在本地网络之外进行控制?

时间:2015-02-22 16:35:52

标签: networking wifi iot

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

3 个答案:

答案 0 :(得分:0)

我认为S20与外部服务器通信,外部服务器将命令从应用程序路由到设备。我之所以认为这是因为当我的互联网连接断电时,我的S20甚至无法通过应用从本地网络上获得。

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

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

答案 1 :(得分:0)

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

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

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

不幸的是,将密码发送到套接字的两种方法都不安全,因此出于安全考虑,您可以认为您的wifi密码已被盗用。

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

答案 2 :(得分:0)

我使用了一个包含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

?>

希望这有用。

相关问题