大佬,经过反复的测试,我发现我还是不能成功,目前抓包是抓到了四个发出去的包的,按您的方法来模拟各种的不成功。不知道问题出在哪儿现在。虚心求教帮我看看~
前两个包是点击待机按钮的,后两个包是点击零冷水按钮的。目前跑完没有返回值,热水器也没有任何反应,求大佬们帮忙看看:
现在代码:
wanjiale.zip
(1.21 KB, 下载次数: 5)
<div class="blockcode"><blockquote>import socket
import time
class Wanjiale:
def __init__(self, ip, port):
# 创建套接字对象,进行TCP连接
self.tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.ip = ip
self.port = port
self.server_address = (ip, port)
self.tcp_socket.connect(self.server_address)
def send_data(self, data):
'''发送所需的数据'''
payload = bytes.fromhex(data)
self.tcp_socket.send(payload)
response = self.tcp_socket.recv(1024)
return response
def close(self):
'''关闭连接'''
self.tcp_socket.close()
if __name__ == '__main__':
# TCP数据载荷
# len: 87
open_data1 = 'aabb1100120050831186ec120f228fa7122007211b6e411b9b55a8327a87b2eac97af267c0ddb935989f42ce010a9eead64027a800e526810974579b8502efb932a9fb60b75b2a1d22d1ca5d84ac72b915bf745ed6a520'
# len: 103
open_data2 = 'aabb1100a10060da3d2c9f6100b1db77b42d5806d8aa91dbf152e085bcf9f1de37d79159294299fdf6a3b4aa208fe1399f27858f4344a3f1d3f4d26c76e0ab81e0f8daa95254d89d2f7d3b025e7f3ddfd886b5fd3a8bf6a42c39253b936067b4eb1688228e7d44'
# len: 87
open_data3 = 'aabb1100470050edfb116b8f410efdaed5a855daef8a81fc709740e5e1cfb0825a529b31a5d626598d91c0531679a4ca6327444f8e93c0520b8db763349ace3bf4cf39fb50fce3adaa9991dd1f6ec73b70a796f485d7bb'
# len: 190
open_data4 = 'aabb11007f00504a82630c8ee49d52a26ef489fddd00fd4ab63ad13fd350a51ff77c6facfcada9bc32101f0e7f0677733078319dbf63bdee3c688bd0a14cfcdbf39c1b6b2c5a980ac2b2b019ecd7521370b99727e47138aabb1100a300604feafe5e61b80a70f2edfc6d0602d9894f615e7ea1ba7a9cd70c637b1bced3113cab31a6b8e1464c91a801f1e19c40f1fa31808055c55c72a3d931f2bda71fc85429d9f1717308ea88c4ed7860703f204e1523b28349765541de08af29b732ea'
wanjiale = Wanjiale('192.168.3.245', 7681)
response1 = wanjiale.send_data(open_data1)
print(response1)
time.sleep(1)
response2 = wanjiale.send_data(open_data2)
print(response2)
time.sleep(3)
response3 = wanjiale.send_data(open_data3)
print(response3)
time.sleep(1)
response4 = wanjiale.send_data(open_data4)
print(response4)
time.sleep(1)
wanjiale.close()
筛选条件:
ip.addr == 192.168.3.7 && ip.addr == 192.168.3.245
192.168.3.7 是 我雷电模拟器的IP,192.168.3.245 是 热水器的IP
取了 序号 151、155、352、356 四个包的数据来写入代码中。(但结果是啥反应也没有)
此次抓包数据:
抓包202408152231.zip
(66.77 KB, 下载次数: 5)
|