Exemple #1
0
 def initPcap(self):
     self.pcap = pcapy.open_live(self.interface, 65535, 1, 0)
     try:
         self.pcap.setfilter("host %s or ether host %s" %
                             (self.ipAddress, self.macAddress))
     except:
         self.pcap.setfilter(
             "host %s or ether host %s" % (self.ipAddress, self.macAddress),
             1, 0xFFFFFF00)
Exemple #2
0
 def __init__(self,
              device,
              snaplen,
              promisc,
              to_ms,
              monitor=False):  # noqa: E501
     if monitor:
         warning(
             "pcapy does not support monitor mode ! Use pypcap or libpcap instead !"
         )  # noqa: E501
     self.pcap = pcap.open_live(device, snaplen, promisc, to_ms)
Exemple #3
0
 def __init__(self, device, snaplen, promisc, to_ms, monitor=False):
     self.errbuf = create_string_buffer(PCAP_ERRBUF_SIZE)
     if monitor:
         self.pcap = pcap.pcap_create(device, self.errbuf)
         pcap.pcap_set_snaplen(self.pcap, snaplen)
         pcap.pcap_set_promisc(self.pcap, promisc)
         pcap.pcap_set_timeout(self.pcap, to_ms)
         if pcap.pcap_set_rfmon(self.pcap, 1) != 0:
             warning("Could not set monitor mode")
         if pcap.pcap_activate(self.pcap) != 0:
             raise OSError("Could not activate the pcap handler")
     else:
         self.pcap = pcap.open_live(device, snaplen, promisc, to_ms)
Exemple #4
0
 def __init__(self, device, snaplen, promisc, to_ms, monitor=False):  # noqa: E501
     self.errbuf = create_string_buffer(PCAP_ERRBUF_SIZE)
     if monitor:
         self.pcap = pcap.pcap_create(device, self.errbuf)
         pcap.pcap_set_snaplen(self.pcap, snaplen)
         pcap.pcap_set_promisc(self.pcap, promisc)
         pcap.pcap_set_timeout(self.pcap, to_ms)
         if pcap.pcap_set_rfmon(self.pcap, 1) != 0:
             warning("Could not set monitor mode")
         if pcap.pcap_activate(self.pcap) != 0:
             raise OSError("Could not activate the pcap handler")  # noqa: E501
     else:
         self.pcap = pcap.open_live(device, snaplen, promisc, to_ms)  # noqa: E501
Exemple #5
0
 def __init__(self, device, snaplen, promisc, to_ms, monitor=False):  # noqa: E501
     if monitor:
         try:
             self.pcap = pcap.create(device)
             self.pcap.set_snaplen(snaplen)
             self.pcap.set_promisc(promisc)
             self.pcap.set_timeout(to_ms)
             if self.pcap.set_rfmon(1) != 0:
                 warning("Could not set monitor mode")
             if self.pcap.activate() != 0:
                 raise OSError("Could not activate the pcap handler")   # noqa: E501
         except AttributeError:
             raise OSError("Your pcapy version does not support"
                           "monitor mode ! Use pcapy 0.11.4+")
     else:
         self.pcap = pcap.open_live(device, snaplen, promisc, to_ms)   # noqa: E501
Exemple #6
0
 def __init__(self, *args, **kargs):
     self.pcap = pcap.open_live(*args, **kargs)
Exemple #7
0
 def __init__(self, *args, **kargs):
     self.pcap = pcap.open_live(*args, **kargs)
Exemple #8
0
 def __init__(self, *args, **kargs):
     if sys.platform == 'darwin':
         warning("Mac OS WiFI monitor mode not supported unless patched python-libpcap is used.")
     self.pcap = pcap.open_live(*args, **kargs)
 def initPcap(self):
     self.pcap = pcapy.open_live(self.interface, 65535, 1, 0)
     try:       self.pcap.setfilter("host %s or ether host %s" % (self.ipAddress, self.macAddress))
     except:    self.pcap.setfilter("host %s or ether host %s" % (self.ipAddress, self.macAddress), 1, 0xFFFFFF00)
Exemple #10
0
 def __init__(self, device, snaplen, promisc, to_ms, monitor=False):  # noqa: E501
     if monitor:
         warning("pcapy does not support monitor mode ! Use pypcap or libpcap instead !")  # noqa: E501
     self.pcap = pcap.open_live(device, snaplen, promisc, to_ms)