Ejemplo n.º 1
0
 def __str__(self, arrow='>'):
     p = net.proto_ntoa(self.p)
     if self.dport is not None:
         if self.sport is None: # XXX - ICMP
             return '%s %s %s %s:%s' % (p, self.src, arrow, self.dst, self.dport)
         return '%s %s:%s %s %s:%s' % \
                (p, self.src, self.sport, arrow, self.dst, self.dport)
     return '%s %s %s %s' % (p, self.src, arrow, self.dst)
Ejemplo n.º 2
0
 def __str__(self, arrow='>'):
     p = net.proto_ntoa(self.p)
     if self.dport is not None:
         if self.sport is None:  # XXX - ICMP
             return '%s %s %s %s:%s' % (p, self.src, arrow, self.dst,
                                        self.dport)
         return '%s %s:%s %s %s:%s' % \
                (p, self.src, self.sport, arrow, self.dst, self.dport)
     return '%s %s %s %s' % (p, self.src, arrow, self.dst)
Ejemplo n.º 3
0
 def __event_to_fcaps(self, event):
     if event in _services:
         return [_services[event]]
     svcs = net.serv_aton(event)
     l = []
     for p in (1, 6, 17):
         ports = [str(svc[1]) for svc in svcs if svc[0] == p]
         if ports:
             l.append('%s and dst port %s' %
                      (net.proto_ntoa(p), ' or '.join(ports)))
     return l
Ejemplo n.º 4
0
 def __event_to_fcaps(self, event):
     if event in _services:
         return [ _services[event] ]
     svcs = net.serv_aton(event)
     l = []
     for p in (1, 6, 17):
         ports = [ str(svc[1]) for svc in svcs if svc[0] == p ]
         if ports:
             l.append('%s and dst port %s' %
                      (net.proto_ntoa(p), ' or '.join(ports)))
     return l