Beispiel #1
0
    def __init__(self,
                 ifname=None,
                 global_iface=None,
                 hostname=None,
                 port=9877,
                 global_port=9878):
        self.hostname = hostname
        self.group_ifname = None
        self.gctrl_mon = None
        self.host = remotehost.Host(hostname, ifname)
        self._group_dbg = None
        if ifname:
            self.set_ifname(ifname, hostname, port)
            res = self.get_driver_status()
            if 'capa.flags' in res and int(res['capa.flags'], 0) & 0x20000000:
                self.p2p_dev_ifname = 'p2p-dev-' + self.ifname
            else:
                self.p2p_dev_ifname = ifname
        else:
            self.ifname = None

        self.global_iface = global_iface
        if global_iface:
            if hostname != None:
                self.global_ctrl = wpaspy.Ctrl(hostname, global_port)
                self.global_mon = wpaspy.Ctrl(hostname, global_port)
                self.global_dbg = hostname + "/" + str(global_port) + "/"
            else:
                self.global_ctrl = wpaspy.Ctrl(global_iface)
                self.global_mon = wpaspy.Ctrl(global_iface)
                self.global_dbg = ""
            self.global_mon.attach()
        else:
            self.global_mon = None
Beispiel #2
0
 def set_ifname(self, ifname, hostname=None, port=9877):
     self.ifname = ifname
     if hostname != None:
         self.ctrl = wpaspy.Ctrl(hostname, port)
         self.mon = wpaspy.Ctrl(hostname, port)
         self.host = remotehost.Host(hostname, ifname)
         self.dbg = hostname + "/" + ifname
     else:
         self.ctrl = wpaspy.Ctrl(os.path.join(wpas_ctrl, ifname))
         self.mon = wpaspy.Ctrl(os.path.join(wpas_ctrl, ifname))
         self.dbg = ifname
     self.mon.attach()
Beispiel #3
0
 def __init__(self, ifname, bssidx=0, hostname=None, port=8877):
     self.hostname = hostname
     self.host = remotehost.Host(hostname, ifname)
     self.ifname = ifname
     print hapd_ctrl
     print ifname
     self.ctrl = wpaspy.Ctrl(os.path.join(hapd_ctrl, ifname))
     self.mon = wpaspy.Ctrl(os.path.join(hapd_ctrl, ifname))
     self.dbg = ifname
     self.mon.attach()
     self.bssid = None
     self.bssidx = bssidx
Beispiel #4
0
 def __init__(self, hostname=None, port=8878):
     self.host = remotehost.Host(hostname)
     self.hostname = hostname
     self.port = port
     if hostname is None:
         self.ctrl = wpaspy.Ctrl(hapd_global)
         self.mon = wpaspy.Ctrl(hapd_global)
         self.dbg = ""
     else:
         self.ctrl = wpaspy.Ctrl(hostname, port)
         self.mon = wpaspy.Ctrl(hostname, port)
         self.dbg = hostname + "/" + str(port)
     self.mon.attach()
Beispiel #5
0
 def __init__(self, apdev=None):
     try:
         hostname = apdev['hostname']
         port = apdev['port']
     except:
         hostname = None
         port = 8878
     self.host = remotehost.Host(hostname)
     self.hostname = hostname
     self.port = port
     if hostname is None:
         self.ctrl = wpaspy.Ctrl(hapd_global)
         self.mon = wpaspy.Ctrl(hapd_global)
         self.dbg = ""
     else:
         self.ctrl = wpaspy.Ctrl(hostname, port)
         self.mon = wpaspy.Ctrl(hostname, port)
         self.dbg = hostname + "/" + str(port)
     self.mon.attach()
Beispiel #6
0
def get_phy(ap, ifname=None):
    phy = "phy3"
    try:
        hostname = ap['hostname']
    except:
        hostname = None
    host = remotehost.Host(hostname)

    if ifname == None:
        ifname = ap['ifname']
    status, buf = host.execute(["iw", "dev", ifname, "info"])
    if status != 0:
        raise Exception("iw " + ifname + " info failed")
    lines = buf.split("\n")
    for line in lines:
        if "wiphy" in line:
            words = line.split()
            phy = "phy" + words[1]
            break
    return phy