How do I get information about libpcap version and link-layer using Python?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sangho
    New Member
    • Oct 2013
    • 1

    How do I get information about libpcap version and link-layer using Python?

    I have the following code. But, I don't know function or code about libpcap version and link-layer. So, So I have not been able to proceed. I am a beginner of Python. Help me!!

    Code:
    import dpkt
    import socket
    import sys
    
    f = open('filename')
    pcap = dpkt.pcap.Reader(f)
    
    for ts, buf in pcap:
      print ts, len(buf)
      for c in buf:
        print hex(ord(c)),
      print
    Last edited by Rabbit; Oct 18 '13, 07:37 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
Working...