def add_payload(self, payload): if self.underlayer and isinstance(self.underlayer, TCP): if isinstance(payload, (SOCKS5Request, SOCKS4Request)): self.underlayer.dport = 1080 elif isinstance(payload, (SOCKS5Reply, SOCKS4Reply)): self.underlayer.sport = 1080 Packet.add_payload(self, payload)
def add_payload(self, payload): Packet.add_payload(self, payload) # Update the DLT if not set if self.getfieldval('dlt') is None and isinstance(payload, Packet): self.setfieldval('dlt', conf.l2types.get(payload.__class__))