Thanks in advance for any help. I am new to scapy (only 2nd day). I need to create packets and send to network interface, expected protocol stack is: ETH/IP/SCTP/S1AP/NAS. As I understand till SCTP this is a trivial task for scapy, however I have an issue. I am doing following:
eth_ip=Ether()/IP(src="192.168.1.1",dst="192.168.2.2")
sctp=SCTP(sport=1,dport=2,tag=0x0,chksum=1)
sctp_data=SCTPChunkData(len=4, tsn=1, stream_id=1, stream_seq=1, delay_sack=0, unordered=0, beginning=1, ending=1, proto_id=18, data="\x01" )
pkt1=eth_ip/sctp/sctp_data
wrpcap("sctp.pcap", pkt1)
So, I craft 1 packet and store it to PCAP, when I open in Wireshark it says that packet is malformed. I would expect to see Eth/ip/sctp/s1ap, of course s1ap message is incorrect, but issue is that I see malformed SCTP layer 3 times and no S1AP. Why? Does anybody have a valid SCTP Data Chunck example?
from scapy.layers.inet import Ether, IP
from scapy.layers.sctp import SCTP, SCTPChunkData
eth_ip = Ether() / IP(src="192.168.1.1",dst="192.168.2.2")
sctp = SCTP(sport=1,dport=2,tag=0x0)
sctp_data_payload = " "
sctp_data_hdr = SCTPChunkData( data=sctp_data_payload )
pkt1 = eth_ip/sctp/sctp_data_hdr
pkt1.show2()
scapy.wrpcap("sctp.pcap", pkt1)
2 tips: