def pkt_callback(self, pkt): if pkt.haslayer(scapy2.TCP) and pkt.getlayer(scapy2.IP).src == "22.0.0.2": self.sniffed_cnt += 1