Пример #1
0
 def sniff_packets(self):
     for v in self.victim:
         t = scapy.AsyncSniffer(filter='ether src ' + self.ip_mac[v],
                                prn=self.process_packet,
                                iface=self.interfaces[1],
                                store=False)
         t.start()
Пример #2
0
    def test_dataflow(self):

        if not self.ingress_packet:
            return True

        # print("wait 10 secs")
        # time.sleep(10)

        self.test_unit.set_path_xps_packetdrv()
        self.test_unit.cmd("packet_driver_receive 10", self.enable_log)

        result = True
        self.test_unit.init_test_enale_egress_ports()
        for igr_port in self.ingress_port:

            self.test_unit.init_test_counters(igr_port)
            self.test_unit.set_port_enable(igr_port)

            pkts = defaultdict(list)
            if self.e_taps:
                etap_list = self.e_taps if isinstance(
                    self.e_taps, list) else list(self.e_taps)
                t = t_scapy.AsyncSniffer(
                    iface=etap_list,
                    count=int(self.expected_count),
                    prn=lambda x: pkts[x.sniffed_on].append(x),
                    timeout=10)
                t.start()
                sleep(1)

            t_scapy.sendp(self.packet_info,
                          iface=self.i_tap,
                          count=self.packet_count)
            sleep(4)

            if (self.e_taps):
                t.join()

            self.captured_packet = pkts
            if self.enable_log:
                print("packets sniffed after AsyncSniffer stopped")
                print(pkts)

            if not self.test_unit.check_acl_counter_info():
                self.run_data.add_result(
                    self.curr_testname, 'Failed in Acl Counter check',
                    (datetime.now() - self.start_time).total_seconds())
                result = False
                break

            if not self.check_packet_action(igr_port):
                result = False
                break

        return result
Пример #3
0
def start_ps(interface):

    # FIRST, CHECK IF IT IS ALREADY LAUNCHED
    iface_aux = libdb.get_iface_ps()
    if (not (len(iface_aux) == 0)):
        return 0

    print(colored("[*] STARTING PASSIVE SCANNER", "blue"))

    # SNIFERING
    ps = sc.AsyncSniffer(iface=interface, prn=ps_packet_handler, store=False)
    ps.start()

    libdb.insert_process('Passive Scanner', interface)
    print(colored("[*] PASSIVE SCANNER STARTED", "blue"))
    return ps
Пример #4
0
 def start_stop(self):
     # global g.thread_sniff
     if f.check_npcap(self) is False:
         return
     if self.btn1_interfaces.text.get() == "Select one interface":
         AW.MyAlertWindow(self.window,
                          "You need to select one network interface")
         return
     if self.btn2_start.text.get() == "Start":
         g.thread_sniff = scpa.AsyncSniffer(
             iface=f.return_interface(self),
             lfilter=lambda y: y.haslayer(scplh.HTTPRequest),
             prn=f.process_packet(self),
             store=False)
         g.thread_sniff.start()
         self.label1_dynamic.text.set("Looking for OW DEMO link")
         self.label1_dynamic.frame.config(fg="green")
         self.btn2_start.text.set("Stop")
         self.entry1_url.frame.delete(0, tk.END)
     else:
         g.thread_sniff.stop(join=False)
         self.label1_dynamic.text.set("Not looking for anything")
         self.label1_dynamic.frame.config(fg="red")
         self.btn2_start.text.set("Start")
Пример #5
0
 def sniff_packets(self):
     for v in self.victim:
         t = scapy.AsyncSniffer(filter='udp dst port 53', prn=self.process_packet, iface=self.interfaces[1], store=0)
         t.start()