'Performs the sniffing'

def sniff_and_analyze(self):

    from scapy.all import sniff
    all_ports = self._tcp_ports[:]
    all_ports.extend(self._udp_ports)
    all_ports = list(set(all_ports))
    filter = '    or    '.join([('port    ' + str(p)) for p in all_ports])
    msg = 'ExtrusionServer    listening    on    interface:    %s'
    om.out.information((msg % self._iface))
    self._sniffing = True
    try:
        packets = sniff(filter=filter, iface=self._iface, timeout=5)
    except socket.error:
        msg = 'Failed    to    sniff    on    interface:    "%s".    Hints:    Are    you    root?    Does    this    interface    exist?'
        msg %= self._iface
        om.out.error(msg)
        raise BaseFrameworkException(msg)
    else:
        self.reverse_ports_allowed = self._analyze_packets(packets)
        return self.reverse_ports_allowed
    finally:
        self._sniffing = False
