Ejemplo n.º 1
0
          if adhoc_interface == "ath0" and monitor_interface == "ath1":
             working_iface_monitor = re.compile('[0]').sub('2', adhoc_interface)
             backup_iface_monitor = re.compile('[1]').sub('3', monitor_interface)
          elif adhoc_interface == "ath1" and monitor_interface == "ath0":
             working_iface_monitor = re.compile('[1]').sub('3', adhoc_interface)
             backup_iface_monitor = re.compile('[0]').sub('2', monitor_interface)
          else:
             print "Please specify [ath0, ath1] for each interface. "
             sys.exit(0)
       
          print "Current Interfaces: [wa: %s] [wm: %s] [ba: %s] [bm: %s]" % (working_iface_adhoc, working_iface_monitor, backup_iface_adhoc, backup_iface_monitor)
          print "Current Interface: [wa: ath%s] [ba: ath%s]" % (working, backup)
          
          cf = Configure(working_iface_adhoc, backup_iface_adhoc)
          ff = FrameFilter(cf, snr_threshold, FILTER)
          p = pcap.pcapObject()
          p.open_live(backup_iface_monitor, 96, 0, 100)

          while 1:
             while ff.rx_frame < 101: # Approx. 100ms * 100 = 10s ; Only beacon frames counted
                apply(ff.filter, p.next())
                #ff.print_tx_filter(working_iface_adhoc) # maybe 1s

             stime = time.time()
             #print "loop starts %f" % stime

             try:
                for daddr in ['00:80:92:3e:18:11', '00:80:92:3e:18:18']:
                   print "XXXXXXXXXXXXXXXX"
                   ff.addr_lq[daddr].refresh(ff.addr_lq[daddr].snr.emavalue(0.8), ff.timestamp) # calc rtETX
Ejemplo n.º 2
0
                working_iface_monitor = re.compile('[1]').sub(
                    '3', adhoc_interface)
                backup_iface_monitor = re.compile('[0]').sub(
                    '2', monitor_interface)
            else:
                print "Please specify [ath0, ath1] for each interface. "
                sys.exit(0)

            print "Current Interfaces: [wa: %s] [wm: %s] [ba: %s] [bm: %s]" % (
                working_iface_adhoc, working_iface_monitor, backup_iface_adhoc,
                backup_iface_monitor)
            print "Current Interface: [wa: ath%s] [ba: ath%s]" % (working,
                                                                  backup)

            cf = Configure(working_iface_adhoc, backup_iface_adhoc)
            ff = FrameFilter(cf, snr_threshold, FILTER)
            p = pcap.pcapObject()
            p.open_live(backup_iface_monitor, 96, 0, 100)

            while 1:
                while ff.rx_frame < 101:  # Approx. 100ms * 100 = 10s ; Only beacon frames counted
                    apply(ff.filter, p.next())
                    #ff.print_tx_filter(working_iface_adhoc) # maybe 1s

                stime = time.time()
                #print "loop starts %f" % stime

                try:
                    for daddr in ['00:80:92:3e:18:11', '00:80:92:3e:18:18']:
                        print "XXXXXXXXXXXXXXXX"
                        ff.addr_lq[daddr].refresh(
Ejemplo n.º 3
0
    working_iface_adhoc = adhoc_interface
    backup_iface_adhoc = monitor_interface
    if adhoc_interface == "ath0" and monitor_interface == "ath1":
       working_iface_monitor = re.compile('[0]').sub('2', adhoc_interface)
       backup_iface_monitor = re.compile('[1]').sub('3', monitor_interface)
    elif adhoc_interface == "ath1" and monitor_interface == "ath0":
       working_iface_monitor = re.compile('[1]').sub('3', adhoc_interface)
       backup_iface_monitor = re.compile('[0]').sub('2', monitor_interface)
    else:
       print "Please specify [ath0, ath1] for each interface. "
       sys.exit(0)
       
    print "Interfaces: [wa: %s] [wm: %s] [ba: %s] [bm: %s]" % (working_iface_adhoc, working_iface_monitor, backup_iface_adhoc, backup_iface_monitor)

    cf = Configure(working_iface_adhoc, backup_iface_adhoc)
    ff = FrameFilter(cf, snr_threshold, FILTER)
    p = pcap.pcapObject()
    p.open_live(backup_iface_monitor, 96, 0, 100)

    try:
       while 1:
          while ff.rx_frame < 10: # Approx. 100ms * 100 = 10s ; Only beacon frames counted
             apply(ff.filter, p.next())
             #ff.print_rx_filter(backup_iface_monitor)
             ff.print_tx_filter(working_iface_adhoc) # maybe 1s

          stime = time.time()
          print "loop starts %f" % stime

          # Initialization
          try: