from scapy.all import *
import socket
# 设置目标地址为多播地址
ssdpAddress = "239.255.255.250"
ssdpPort = 1900
# 构建 SSDP 探测请求
payload = (
"M-SEARCH * HTTP/1.1\r\n"
"HOST: 239.255.255.250:1900\r\n"
"MAN: \"ssdp:discover\"\r\n"
"MX: 2\r\n"
"ST: ssdp:all\r\n"
"\r\n"
)
# 使用 UDP 包装并发送
packet = IP(dst=ssdpAddress) / UDP(sport=RandShort(), dport=ssdpPort) / payload
# 发送请求并获取响应
answers, unanswers = sr(packet, multi=True, timeout=5)
# 打印响应
for snd, rcv in answers:
print(rcv.summary())
try:
# 试图解析响应中的HTTP头
http_header_raw = rcv.load.decode()
http_headers = dict(re.findall(r"(?P<name>.*?): (?P<value>.*?)\r\n", http_header_raw))
print(http_headers)
except:
pass
“default global trust center link key” which is 5A:69:67:42:65:65:41:6C:6C:69:61:6E:63:65:30:39
“light link master key” which is 9F:55:95:F1:02:57:C8:A4:69:CB:F4:2B:C9:3F:EE:31
“light link commissioning key” which is 81:42:86:86:5D:C1:C8:B2:C8:CB:C5:2E:5D:65:D1:B8
Last modification:April 17, 2024
© Allow specification reprint