Skip to Content
Mastering Python for Networking and Security
book

Mastering Python for Networking and Security

by José Manuel Ortega
September 2018
Intermediate to advanced
426 pages
10h 46m
English
Packt Publishing
Content preview from Mastering Python for Networking and Security

Chapter 5: Analyzing Network Traffic

  1. What is the Scapy function that can capture packets in the same way that tools such as tcpdump and Wireshark do?

scapy> pkts = sniff (iface = "eth0", count = n), where n is the number of packets.

  1. What is the best way to send a packet with Scapy indefinitely every five seconds in the form of a loop?

scapy> sendp (packet, loop=1, inter=5)

  1. What is the method that must be invoked with Scapy to check whether a certain port (port) is open or closed on a certain machine (host), and also to show detailed information about how packets are being sent?

scapy> sr1(IP(dst=host)/TCP(dport=port), verbose=True)

  1. What functions are necessary for implementing the traceroute command in Scapy?

IP/UDP/sr1

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Python for Networking and Security - Second Edition

Mastering Python for Networking and Security - Second Edition

José Manuel Ortega
Python for Cybersecurity

Python for Cybersecurity

Howard E. Poston, III

Publisher Resources

ISBN: 9781788992510Supplemental Content