Scapy:如何匹配查询和答案

时间:2013-09-16 16:57:01

标签: python networking protocols scapy

我正在Scapy中实现一个协议,这是我迄今为止所做的(详细信息省略):

class Protocol - #Defines some common headers
    def guess_payload_class:
        return ProtocolAction1

class ProtocolAction1 - #Defines some action to be done by the protocol.


class ProtocolAnswer - #Defines some common headers
    def guess_payload_class:
        return ProtocolAction1Anser

class ProtocolAction1Answer - #Defines the answer when Action1 has been done.

bind_layers(UDP, Protocol, dport=port)
bind_layers(UDP, ProtocolAnswer, sport=port)

但是,当我执行sr(IP()/UDP()/Protocol()/ProtocolAction1())时,我永远无法得到答案(尽管服务器发送了它)。我的目的是获得IP()/UDP()/ProtocolAnswer()/ProtocolAction1Answer()。我做错了什么,我该如何解决?

0 个答案:

没有答案