Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pysap/SAPNI.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from socketserver import BaseRequestHandler, ThreadingMixIn, TCPServer
# External imports
from scapy.fields import LenField
from scapy.packet import Packet, Raw
from scapy.packet import Packet, Raw, raw
from scapy.supersocket import socket, StreamSocket
# Custom imports
from pysap.utils import Worker
Expand Down Expand Up @@ -145,7 +145,11 @@ def recv(self):
# Decode the packet payload according to the base class defined
packet = SAPNI(nidata)
if self.basecls:
packet.decode_payload_as(self.basecls)
if callable(self.basecls) and not isinstance(self.basecls, type):
cls = self.basecls(packet, raw(packet.payload))
else:
cls = self.basecls
packet.decode_payload_as(cls)
elif keep_alive_request:
packet = SAPNI(length=nilength) / Raw(nidata[4:])
return packet
Expand Down
Loading
Loading