Exemplo n.º 1
0
  def _thread_func (self):
    while not self._quitting:
      pcapc.dispatch(self.pcap,100,self.callback,self)
      self.packets_received,self.packets_dropped = pcapc.stats(self.pcap)

    self._quitting = False
    self._thread = None
Exemplo n.º 2
0
  def _thread_func (self):
    while not self._quitting:
      pcapc.dispatch(self.pcap,100,self.callback,self,bool(self.use_bytearray),True)
      self.packets_received,self.packets_dropped = pcapc.stats(self.pcap)

    self._quitting = False
    self._thread = None
Exemplo n.º 3
0
 def cb(obj, data, sec, usec, length):
     global drop, total, bytes_got, bytes_real, bytes_diff
     #print ">>>",data
     t, d = pcapc.stats(obj.pcap)
     bytes_got += len(data)
     bytes_real += length
     nbd = bytes_real - bytes_got
     if nbd != bytes_diff:
         bytes_diff = nbd
         print "lost bytes:", nbd
     if t > total:
         total = t + 500
         print t, "total"
     if d > drop:
         drop = d
         print d, "dropped"
     p = pkt.ethernet(data)
     ip = p.find('ipv4')
     if ip:
         print ip.srcip, "\t", ip.dstip, p
Exemplo n.º 4
0
 def cb (obj, data, sec, usec, length):
   global drop,total,bytes_got,bytes_real,bytes_diff
   #print ">>>",data
   t,d = pcapc.stats(obj.pcap)
   bytes_got += len(data)
   bytes_real += length
   nbd = bytes_real - bytes_got
   if nbd != bytes_diff:
     bytes_diff = nbd
     print "lost bytes:",nbd
   if t > total:
     total = t + 500
     print t,"total"
   if d > drop:
     drop = d
     print d, "dropped"
   p = pkt.ethernet(data)
   ip = p.find('ipv4')
   if ip:
     print ip.srcip,"\t",ip.dstip, p