def __get_wifi_information(self, iface_name: str) -> WifiInformation: """ If the given interface name belongs to an wifi interface, there are some more infomations. :param iface_name: Name of the network interface :return: WifiInformation """ wifi_information = WifiInformation() raw_wifi_info_lst = self.network_ctrl.send_command("iw dev") right_iface = False for raw_wifi_info in raw_wifi_info_lst: raw_wifi_info = raw_wifi_info.replace("\n", "") if "Interface" in raw_wifi_info: right_iface = True if iface_name in raw_wifi_info else False elif right_iface: if "wdev" in raw_wifi_info: wifi_information.wdev = raw_wifi_info.split(" ")[1] elif "ssid" in raw_wifi_info: wifi_information.ssid = raw_wifi_info.split(" ")[1] elif "type" in raw_wifi_info: wifi_information.type = raw_wifi_info.split(" ")[1] elif "channel" in raw_wifi_info: wifi_information.channel = int(raw_wifi_info.split(" ")[1]) wifi_information.channel_width = int(raw_wifi_info.split(" ")[5]) wifi_information.channel_center1 = int(raw_wifi_info.split(" ")[8]) return wifi_information
def __get_wifi_information(self, iface_name: str) -> WifiInformation: """ If the given interface name belongs to an wifi interface, there are some more infomations. :param iface_name: Name of the network interface :return: WifiInformation """ wifi_information = WifiInformation() raw_wifi_info_lst = self.network_ctrl.send_command("iw dev") right_iface = False for raw_wifi_info in raw_wifi_info_lst: raw_wifi_info = raw_wifi_info.replace("\n", "") if "Interface" in raw_wifi_info: right_iface = True if iface_name in raw_wifi_info else False elif right_iface: if "wdev" in raw_wifi_info: wifi_information.wdev = raw_wifi_info.split(" ")[1] elif "ssid" in raw_wifi_info: wifi_information.ssid = raw_wifi_info.split(" ")[1] elif "type" in raw_wifi_info: wifi_information.type = raw_wifi_info.split(" ")[1] elif "channel" in raw_wifi_info: wifi_information.channel = int(raw_wifi_info.split(" ")[1]) wifi_information.channel_width = int( raw_wifi_info.split(" ")[5]) wifi_information.channel_center1 = int( raw_wifi_info.split(" ")[8]) return wifi_information
def _get_wifi_informations(self) -> WifiInformation: wifi_info = WifiInformation() assert isinstance(wifi_info, WifiInformation) wifi_info.wdev = "0x1" wifi_info.type = WlanType.managed wifi_info.channel = 1 wifi_info.channel_width = 20 wifi_info.channel_center1 = 2412 return wifi_info