我已经在Smartsniff中捕获了一个数据包,并希望在Python中重新发送它

时间:2016-04-01 16:42:50

标签: python packet-capture packet-sniffers packets

在localhost:23150和localhost:6010之间捕获的数据包

==================================================
Index             : 5
Protocol          : TCP
Local Address     : 127.0.0.1
Remote Address    : 127.0.0.1
Local Port        : 23150
Remote Port       : 6010
Local Host        : 
Remote Host       : 
Service Name      : 
Packets           : 4
Data Size         : 2,048 Bytes
Total Size        : 3,708 Bytes
Data Speed        : 
Capture Time      : 4/1/2016 11:37:32 AM:483
Last Packet Time  : 4/1/2016 11:37:32 AM:484
Duration          : 00:00:00.001
Local MAC Address : 
Remote MAC Address: 
Local IP Country  : 
Remote IP Country : 
==================================================

00000000  63 6C 74 00 04 00 0E 00  01 00 00 00               clt..... ....

这可能吗?如果是这样,怎么样?我已经创建了一个通过套接字发送的函数:

def send_cmd(port, message):
    TCP_IP = '127.0.0.1'
    TCP_PORT = port
    BUFFER_SIZE = 1024
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((TCP_IP, TCP_PORT))
    print "connected"
    s.send(message)
    data = s.recv(BUFFER_SIZE)
    print "received data:", data
    s.close()

感谢您的时间。

0 个答案:

没有答案