Skip to content

Scapy Prepper

Tangle Coalbox:

Welcome to the roof! Alabaster Snowball here.

I'm watching some elves play NetWars!

Feel free to try out our Scapy Present Packet Prepper!

If you get stuck, you can help() to see how to get tasks and hints.


[pkt[Raw].load for pkt in TCP_PACKETS if Raw in pkt]


On the roof (see map)


Let's jump into the terminal and get started

Welcome to the "Present Packet Prepper" interface! The North Pole could use your help preparing present packets for shipment. Start by running the task.submit() function passing in a string argument of 'start'. Type for help on this question.

>>> task.submit("start")
Correct! adding a () to a function or class will execute it. Ex - FunctionExecuted()

Submit the class object of the scapy module that sends packets at layer 3 of the OSI model.

>>> task.submit(send)
Correct! The "send" scapy class will send a crafted scapy packet out of a network interface.

Submit the class object of the scapy module that sniffs network packets and returns those packets in a list.

>>> task.submit(sniff)
Correct! the "sniff" scapy class will sniff network traffic and return these packets in a list.

Submit the NUMBER only from the choices below that would successfully send a TCP packet and then return the first sniffed response packet to be stored in a variable named pkt:

  1. pkt = sr1(IP(dst="")/TCP(dport=20))
  2. pkt = sniff(IP(dst="")/TCP(dport=20))
  3. pkt = sendp(IP(dst="")/TCP(dport=20))
>>> task.submit(1)
Correct! sr1 will send a packet, then immediately sniff for a response packet.

Submit the class object of the scapy module that can read pcap or pcapng files and return a list of packets.

>>> task.submit(rdpcap)
Correct! the "rdpcap" scapy class can read pcap files.

The variable UDP_PACKETS contains a list of UDP packets. Submit the NUMBER only from the choices below that correctly prints a summary of UDP_PACKETS:

  1. UDP_PACKETS.print()
  3. UDP_PACKETS.list()
>>> task.submit(2)
Correct! .show() can be used on lists of packets AND on an individual packet.

Submit only the first packet found in UDP_PACKETS.

>>> task.submit(UDP_PACKETS[0])
Correct! Scapy packet lists work just like regular python lists so packets can be accessed by their position in the list starting at offset 0.

Submit only the entire TCP layer of the second packet in TCP_PACKETS.

>>> task.submit(TCP_PACKETS[1][TCP]
Correct! Most of the major fields like Ether, IP, TCP, UDP, ICMP, DNS, DNSQR, DNSRR, Raw, etc... can be accessed this way. Ex - pkt[IP][TCP]

Change the source IP address of the first packet found in UDP_PACKETS to and then submit this modified packet

>>> UDP_PACKETS[0][IP].src=""
>>> task.submit(UDP_PACKETS[0])
Correct! You can change ALL scapy packet attributes using this method.

Submit the password task.submit('elf_password') of the user alabaster as found in the packet list TCP_PACKETS.

>>> [pkt[Raw].load for pkt in TCP_PACKETS if Raw in pkt]
[b'220 North Pole FTP Server\r\n', b'USER alabaster\r', b'331 Password required for alabaster.\r', b'PASS echo\r\n', b'230 User alabaster logged in.\r']

>>> task.submit("echo")
Correct! Here is some really nice list comprehension that will grab all the raw payloads from tcp packets:
[pkt[Raw].load for pkt in TCP_PACKETS if Raw in pkt]

The ICMP_PACKETS variable contains a packet list of several icmp echo-request and icmp echo-reply packets. Submit only the ICMP chksum value from the second packet in the ICMP_PACKETS list.

>>> task.submit(ICMP_PACKETS[1][ICMP].chksum)
Correct! You can access the ICMP chksum value from the second packet using ICMP_PACKETS[1][ICMP].chksum .

Submit the number of the choice below that would correctly create a ICMP echo request packet with a destination IP of stored in the variable named pkt 1. pkt = Ether(src='')/ICMP(type="echo-request") 2. pkt = IP(src='')/ICMP(type="echo-reply") 3. pkt = IP(dst='')/ICMP(type="echo-request")

>>> task.submit(3)
Correct! Once you assign the packet to a variable named "pkt" you can then use that variable to send or manipulate your created packet.

Create and then submit a UDP packet with a dport of 5000 and a dst IP of (all other packet attributes can be unspecified)

>>> task.submit(IP(dst="")/UDP(dport=5000))
Correct! Your UDP packet creation should look something like this:
pkt = IP(dst="")/UDP(dport=5000)

Create and then submit a UDP packet with a dport of 53, a dst IP of, and is a DNS query with a qname of elveslove.santa. (all other packet attributes can be unspecified)

>>> task.submit(IP(dst="")/UDP(dport=53)/DNSQR(qname="elveslove.santa"))
Correct! Your UDP packet creation should look something like this:
pkt = IP(dst="")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="elveslove.santa"))

The variable ARP_PACKETS contains an ARP request and response packets. The ARP response (the second packet) has 3 incorrect fields in the ARP layer. Correct the second packet in ARP_PACKETS to be a proper ARP response and then task.submit(ARP_PACKETS) for inspection.

>>> ARP_PACKETS[1].hwsrc="00:13:46:0b:22:ba"
>>> ARP_PACKETS[1].hwdst="00:16:ce:6e:8b:24"
>>> ARP_PACKETS[1].op=2
<Ether  dst=00:16:ce:6e:8b:24 src=00:13:46:0b:22:ba type=ARP |<ARP  hwtype=0x1 ptype=IPv4 hwlen=6 plen=4 op=is-at hwsrc=00:13:46:0b:22:ba psrc= hwdst=00:16:ce:6e:8b:24 pdst= |<Padding  load='\xc0\xa8\x00r' |>>>

>>> task.submit(ARP_PACKETS)
Great, you prepared all the present packets!

Congratulations, all pretty present packets properly prepared for processing!