如何使用Python黑掉IOT设备 | 控制某米台灯演示

作者:FancyPig | 发布时间: | 更新时间:

相关阅读

data-postsbox="{"id":30495,"title":"Flipper Zero:2023年最热门的黑客设备?| 解锁智能汽车 | 解锁保险柜 | 远程遥控 |","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2023/01/20230115014016461.png","cover_video":"https://v.pigsec.cn/Flipper%20Zero-%20Hottest%20Hacking%20Device%20for%202023-_ts.m3u8","views":3540,"comment_count":6,"category":"knowledge","is_forum_post":false}">{"id":30495,"title":"Flipper Zero:2023年最热门的黑客设备?| 解锁智能汽车 | 解锁保险柜 | 远程遥控 |","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2023/01/20230115014016461.png","cover_video":"https://v.pigsec.cn/Flipper%20Zero-%20Hottest%20Hacking%20Device%20for%202023-_ts.m3u8","views":3540,"comment_count":6,"category":"knowledge","is_forum_post":false}
data-postsbox="{"id":33628,"title":"2023年最热门的黑客设备?(第二集) | Flipper Zero","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2023/03/20230308053901425.png","cover_video":"https://v.pigsec.cn/Flipper%20Zero%20next%20level_ts.m3u8","views":2033,"comment_count":4,"category":"knowledge","is_forum_post":false}">{"id":33628,"title":"2023年最热门的黑客设备?(第二集) | Flipper Zero","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2023/03/20230308053901425.png","cover_video":"https://v.pigsec.cn/Flipper%20Zero%20next%20level_ts.m3u8","views":2033,"comment_count":4,"category":"knowledge","is_forum_post":false}
data-postsbox="{"id":24228,"title":"手机也能入侵Wifi?","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2022/10/20221003085226199.png","cover_video":"","views":4286,"comment_count":8,"category":"knowledge","is_forum_post":false}">{"id":24228,"title":"手机也能入侵Wifi?","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2022/10/20221003085226199.png","cover_video":"","views":4286,"comment_count":8,"category":"knowledge","is_forum_post":false}
data-postsbox="{"id":9329,"title":"零基础学会使用Kali linux完成WIFI密码破解(一)","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2022/02/20220207171623782.png","cover_video":"","views":5091,"comment_count":6,"category":"cybersecurity","is_forum_post":false}">{"id":9329,"title":"零基础学会使用Kali linux完成WIFI密码破解(一)","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2022/02/20220207171623782.png","cover_video":"","views":5091,"comment_count":6,"category":"cybersecurity","is_forum_post":false}
data-postsbox="{"id":9394,"title":"零基础学会使用Kali linux完成WIFI密码破解(二)","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2022/02/20220209015305265.png","cover_video":"","views":3440,"comment_count":6,"category":"cybersecurity","is_forum_post":false}">{"id":9394,"title":"零基础学会使用Kali linux完成WIFI密码破解(二)","author":"FancyPig","author_id":1,"cover_image":"https://static.pigsec.cn/wp-content/uploads/2022/02/20220209015305265.png","cover_video":"","views":3440,"comment_count":6,"category":"cybersecurity","is_forum_post":false}

视频讲解

家中的物联网设备真的安全吗?本期视频我们将教大家针对物联网设备进行渗透测试,并通过wireshark来监测明文流量,最终通过Python实现对某米台灯的控制,快来一起学习一下吧!

相关代码

使用Telnet控制台灯

首先你需要使用telnet连接对应的台灯端口

telnet 192.168.0.105:55443

之后你可以尝试打开台灯

{"id":0,"method":"set_power","params":["on", "smooth", 200]}

再或是关闭台灯

{"id":0,"method":"set_power","params":["off", "smooth", 200]}

使用Python发现并控制台灯

相关演示代码如下

from yeelight import discover_bulbs
#首先是探测台灯设备
discover_bulbs()

#创建台灯bulb
from yeelight import Bulb
bulb = Bulb("192.168.0.105")

#开始控制台灯,包括打开台灯、修改亮度、修改颜色
bulb.turn_on()
bulb.get_properties()
bulb.set_brightness(50)
bulb.set_rgb(255, 0, 0)
bulb.set_rgb(1, 0, 0)

bulb.set_color_temp(200)
bulb.set_color_temp(4700)

视频中的yeelight1.py

import time
from yeelight import Bulb
bulb = Bulb("192.168.0.105")

bulb.turn_on()
time.sleep(1)
bulb.set_rgb(255,0,0)
time.sleep(1)
bulb.set_rgb(164,168,50)
time.sleep(1)
bulb.set_rgb(50,90,168)
time.sleep(1)
bulb.set_rgb(168,50,50)
time.sleep(1)
bulb.set_rgb(50,168,54)
time.sleep(1)
bulb.set_rgb(255,0,0)
time.sleep(1)

rgb1 = 50
rgb2 = 10
rgb3 = 50
for i in range(10):
    bulb.set_rgb(rgb1,rgb2,rgb3)
    time.sleep(1)
    i = i + 1
    rgb1 = (i*10.5)
    rgb2 = (i*5.5)
    rgb3 = (i*9.5)
    print(rgb1, rgb2, rgb3)
    bulb.set_rgb(rgb1,rgb2,rgb3)

bulb.set_rgb(255,0,0)

视频中的yeelight2.py

import time
from yeelight import Bulb
bulb1 = Bulb("192.168.0.105")
bulb2 = Bulb("192.168.0.117")
bulb1.turn_on()
bulb2.turn_on()
time.sleep(1)

bulb1.set_rgb(255,0,0)
bulb2.set_rgb(255,0,0)
time.sleep(1)

bulb1.set_rgb(164,168,50)
time.sleep(1)

bulb2.set_rgb(50,90,168)
time.sleep(1)

bulb1.set_rgb(168,50,50)
time.sleep(1)

bulb2.set_rgb(50,168,54)
time.sleep(1)

bulb1.set_rgb(255,0,0)
time.sleep(1)

rgb1 = 50
rgb2 = 10
rgb3 = 50
for i in range(10):
    bulb1.set_rgb(rgb1,rgb2,rgb3)
    bulb2.set_rgb(rgb1-10,rgb2-10,rgb3-10)
    time.sleep(1)
    i = i + 1
    rgb1 = (i*10.5)
    rgb2 = (i*5.5)
    rgb3 = (i*9.5)
    print(rgb1, rgb2, rgb3)
    bulb1.set_rgb(rgb1,rgb2,rgb3)

bulb1.set_rgb(50,64,168)
bulb2.set_rgb(50,64,168)
标签:IOT安全, iot安全入门, iot安全怎么学, iot安全培训, iot安全招聘, 小米家居智能控制系统, 小米台灯怎么调节颜色, python什么东西