Sniffer - Application#6 Basic Network Sniffer#In Scapy we...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
############# Application #6 - Basic Network Sniffer ############# #In Scapy, we will use the sniff() function to capture network packets. #To see a list of what commands Scapy has available, run the lsc() function. #Run the ls() command to see ALL the supported protocols. #Run the ls(protocol) command to see the fields and default values for any protocol. #See packet layers with the .summary() function. #See packet contents with the .show() function. #Dig into a specific packet layer using a list index: pkts[3][2].summary()... #...the first index chooses the packet out of the pkts list, the second index chooses the layer for that specific packet. #Using the .command() packet method will return a string of the command necessary to recreate that sniffed packet. #To see the list of optional arguments for the sniff() function: ''' >>> print sniff.__doc__ Sniff packets sniff([count=0,] [prn=None,] [store=1,] [offline=None,] [lfilter=None,] + L2ListenSocket args) -> list of packets count: number of packets to capture. 0 means infinity store: wether to store sniffed packets or discard them prn: function to apply to each packet. If something is returned, it is displayed. Ex: ex: prn = lambda x: x.summary() lfilter: python function applied to each packet to determine if further action may be done ex: lfilter = lambda x: x.haslayer(Padding) offline: pcap file to read packets from, instead of sniffing them timeout: stop sniffing after a given time (default: None) L2socket: use the provided L2socket opened_socket: provide an object ready to use .recv() on
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern