1
0
mirror of https://github.com/gryf/wicd.git synced 2026-03-10 11:35:49 +01:00

Merged r335 of mainline 1.6.

This commit is contained in:
Andrew Psaltis
2009-03-23 12:32:03 -04:00
20 changed files with 120 additions and 97 deletions

View File

@@ -1,8 +1,10 @@
#!/usr/bin/python #!/usr/bin/python
""" autoconnect -- Triggers an automatic connection attempt. """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -7,8 +7,8 @@ Manages and loads the pluggable backends for wicd.
""" """
# #
# Copyright (C) 2008 Adam Blackburn # Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2008 Dan O'Reilly # Copyright (C) 2008-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -13,8 +13,8 @@ class WirelessInterface() -- Control a wireless network interface.
""" """
# #
# Copyright (C) 2008 Adam Blackburn # Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2008 Dan O'Reilly # Copyright (C) 2008-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as
@@ -31,7 +31,9 @@ class WirelessInterface() -- Control a wireless network interface.
from wicd import misc from wicd import misc
from wicd import wnettools from wicd import wnettools
from wicd.wnettools import * from wicd.wnettools import GetDefaultGateway, GetWiredInterfaces, \
GetWirelessInterfaces, IsValidWpaSuppDriver, BaseWirelessInterface, \
BaseWiredInterface, BaseInterface
import re import re
import os import os
import os.path import os.path
@@ -53,11 +55,11 @@ RALINK_DRIVER = 'ralink legacy'
def NeedsExternalCalls(*args, **kargs): def NeedsExternalCalls(*args, **kargs):
""" Return True, since this backend using iwconfig/ifconfig. """ """ Return True, since this backend uses iwconfig/ifconfig. """
return True return True
class Interface(wnettools.BaseInterface): class Interface(BaseInterface):
""" Control a network interface. """ """ Control a network interface. """
def __init__(self, iface, verbose=False): def __init__(self, iface, verbose=False):
""" Initialize the object. """ Initialize the object.
@@ -67,11 +69,11 @@ class Interface(wnettools.BaseInterface):
verbose -- whether to print every command run verbose -- whether to print every command run
""" """
wnettools.BaseInterface.__init__(self, iface, verbose) BaseInterface.__init__(self, iface, verbose)
self.Check() self.Check()
class WiredInterface(Interface, wnettools.BaseWiredInterface): class WiredInterface(Interface, BaseWiredInterface):
""" Control a wired network interface. """ """ Control a wired network interface. """
def __init__(self, iface, verbose=False): def __init__(self, iface, verbose=False):
""" Initialise the wired network interface class. """ Initialise the wired network interface class.
@@ -81,11 +83,11 @@ class WiredInterface(Interface, wnettools.BaseWiredInterface):
verbose -- print all commands verbose -- print all commands
""" """
wnettools.BaseWiredInterface.__init__(self, iface, verbose) BaseWiredInterface.__init__(self, iface, verbose)
Interface.__init__(self, iface, verbose) Interface.__init__(self, iface, verbose)
class WirelessInterface(Interface, wnettools.BaseWirelessInterface): class WirelessInterface(Interface, BaseWirelessInterface):
""" Control a wireless network interface. """ """ Control a wireless network interface. """
def __init__(self, iface, verbose=False, wpa_driver='wext'): def __init__(self, iface, verbose=False, wpa_driver='wext'):
""" Initialise the wireless network interface class. """ Initialise the wireless network interface class.
@@ -95,7 +97,6 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
verbose -- print all commands verbose -- print all commands
""" """
wnettools.BaseWirelessInterface.__init__(self, iface, verbose, BaseWirelessInterface.__init__(self, iface, verbose, wpa_driver)
wpa_driver)
Interface.__init__(self, iface, verbose) Interface.__init__(self, iface, verbose)

View File

@@ -14,8 +14,8 @@ class WirelessInterface() -- Control a wireless network interface.
""" """
# #
# Copyright (C) 2008 Adam Blackburn # Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2008 Dan O'Reilly # Copyright (C) 2008-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as
@@ -33,11 +33,22 @@ class WirelessInterface() -- Control a wireless network interface.
from wicd import misc from wicd import misc
from wicd import wnettools from wicd import wnettools
from wicd import wpath from wicd import wpath
from wicd.wnettools import * from wicd.wnettools import GetDefaultGateway, GetWiredInterfaces, \
from wicd.wnettools import wep_pattern, signaldbm_pattern, neediface GetWirelessInterfaces, IsValidWpaSuppDriver, BaseWirelessInterface, \
BaseWiredInterface, BaseInterface, wep_pattern, signaldbm_pattern, neediface
import iwscan try:
import wpactrl import iwscan
IWSCAN_AVAIL = True
except ImportError:
print "WARNING: python-iwscan not found, falling back to using iwlist scan."
IWSCAN_AVAIL = False
try:
import wpactrl
WPACTRL_AVAIL = True
except ImportError:
print "WARNING: python-wpactrl not found, falling back to using wpa_cli."
WPACTRL_AVAIL = False
import re import re
import os import os
@@ -56,7 +67,7 @@ This backend uses IOCTL calls and python libraries to query
network information whenever possible. This makes it fast, network information whenever possible. This makes it fast,
but it may not work properly on all systems. but it may not work properly on all systems.
Dependencies: (Optional) Dependencies:
python-wpactrl (http://projects.otaku42.de/wiki/PythonWpaCtrl) python-wpactrl (http://projects.otaku42.de/wiki/PythonWpaCtrl)
python-iwscan (http://projects.otaku42.de/browser/python-iwscan/)""" python-iwscan (http://projects.otaku42.de/browser/python-iwscan/)"""
@@ -105,7 +116,7 @@ def NeedsExternalCalls(*args, **kargs):
return False return False
class Interface(wnettools.BaseInterface): class Interface(BaseInterface):
""" Control a network interface. """ """ Control a network interface. """
def __init__(self, iface, verbose=False): def __init__(self, iface, verbose=False):
""" Initialise the object. """ Initialise the object.
@@ -115,7 +126,7 @@ class Interface(wnettools.BaseInterface):
verbose -- whether to print every command run verbose -- whether to print every command run
""" """
wnettools.BaseInterface.__init__(self, iface, verbose) BaseInterface.__init__(self, iface, verbose)
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.Check() self.Check()
@@ -162,7 +173,7 @@ class Interface(wnettools.BaseInterface):
return bool(flags & 1) return bool(flags & 1)
class WiredInterface(Interface, wnettools.BaseWiredInterface): class WiredInterface(Interface, BaseWiredInterface):
""" Control a wired network interface. """ """ Control a wired network interface. """
def __init__(self, iface, verbose=False): def __init__(self, iface, verbose=False):
""" Initialise the wired network interface class. """ Initialise the wired network interface class.
@@ -172,7 +183,7 @@ class WiredInterface(Interface, wnettools.BaseWiredInterface):
verbose -- print all commands verbose -- print all commands
""" """
wnettools.BaseWiredInterface.__init__(self, iface, verbose) BaseWiredInterface.__init__(self, iface, verbose)
Interface.__init__(self, iface, verbose) Interface.__init__(self, iface, verbose)
@neediface(False) @neediface(False)
@@ -240,7 +251,7 @@ class WiredInterface(Interface, wnettools.BaseWiredInterface):
return bool(reg & 0x0004) return bool(reg & 0x0004)
class WirelessInterface(Interface, wnettools.BaseWirelessInterface): class WirelessInterface(Interface, BaseWirelessInterface):
""" Control a wireless network interface. """ """ Control a wireless network interface. """
def __init__(self, iface, verbose=False, wpa_driver='wext'): def __init__(self, iface, verbose=False, wpa_driver='wext'):
""" Initialise the wireless network interface class. """ Initialise the wireless network interface class.
@@ -250,7 +261,7 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
verbose -- print all commands verbose -- print all commands
""" """
wnettools.BaseWirelessInterface.__init__(self, iface, verbose, BaseWirelessInterface.__init__(self, iface, verbose,
wpa_driver) wpa_driver)
Interface.__init__(self, iface, verbose) Interface.__init__(self, iface, verbose)
self.scan_iface = None self.scan_iface = None
@@ -263,6 +274,10 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
A list containing available wireless networks. A list containing available wireless networks.
""" """
if not IWSCAN_AVAIL:
# Use the slow version if python-iwscan isn't available.
return BaseWirelessInterface.GetNetworks(self)
if not self.scan_iface: if not self.scan_iface:
try: try:
self.scan_iface = iwscan.WirelessInterface(self.iface) self.scan_iface = iwscan.WirelessInterface(self.iface)
@@ -361,8 +376,9 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
False otherwise. False otherwise.
""" """
error= "Unable to find ctrl_interface for wpa_supplicant. " + \ if not WPACTRL_AVAIL:
"Could not validate authentication." # If we don't have python-wpactrl, use the slow version.
return BaseWirelessInterface.ValidateAuthentication(self, auth_time)
# Right now there's no way to do this for ralink drivers # Right now there's no way to do this for ralink drivers
if self.wpa_driver == RALINK_DRIVER: if self.wpa_driver == RALINK_DRIVER:

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
""" Wicd Configuration Manager """ configmanager -- Wicd configuration file manager
Wrapper around ConfigParser for wicd, though it should be Wrapper around ConfigParser for wicd, though it should be
reusable for other purposes as well. reusable for other purposes as well.
@@ -8,8 +8,8 @@ reusable for other purposes as well.
""" """
# #
# Copyright (C) 2008 Adam Blackburn # Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2008 Dan O'Reilly # Copyright (C) 2008-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
""" Configure the scripts for a particular network. """ configscript -- Configure the scripts for a particular network.
Script for configuring the scripts for a network passed in as a Script for configuring the scripts for a network passed in as a
command line argument. This needs to run a separate process because command line argument. This needs to run a separate process because
@@ -10,8 +10,8 @@ run as the current user.
""" """
# #
# Copyright (C) 2007-2008 Adam Blackburn # Copyright (C) 2007-2009 Adam Blackburn
# Copyright (C) 2007-2008 Dan O'Reilly # Copyright (C) 2007-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -7,8 +7,8 @@ A module for managing wicd's dbus interfaces.
""" """
# #
# Copyright (C) 2008 Adam Blackburn # Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2008 Dan O'Reilly # Copyright (C) 2008-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -1,15 +1,14 @@
#!/usr/bin/python #!/usr/bin/python
""" Wicd GUI module. """ gui -- The main wicd GUI module.
Module containg all the code (other than the tray icon) related to the Module containing the code for the main wicd GUI.
Wicd user interface.
""" """
# #
# Copyright (C) 2007 Adam Blackburn # Copyright (C) 2007-2009 Adam Blackburn
# Copyright (C) 2007 Dan O'Reilly # Copyright (C) 2007-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -1,7 +1,7 @@
""" guiutil - A collection of commonly used gtk/gui functions and classes. """ """ guiutil - A collection of commonly used gtk/gui functions and classes. """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -2,7 +2,7 @@
# #
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com> # Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
# Copyright (C) 2008 Dan O'Reilly <oreilldf@gmail.com> # Copyright (C) 2008-2009 Dan O'Reilly <oreilldf@gmail.com>
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public

View File

@@ -1,8 +1,13 @@
""" Misc - miscellaneous functions for wicd """ """ misc - miscellaneous functions for wicd
This module contains a large variety of utility functions used
throughout wicd.
"""
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -8,8 +8,8 @@ when appropriate.
""" """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -1,6 +1,13 @@
""" netentry -- Network entry widgets for the GUI.
This module provides GUI widgets used to represent wired and wireless
entries in the GUI's network list, as well as any settings dialogs
contained within them.
"""
# #
# Copyright (C) 2007 Adam Blackburn # Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2007 Dan O'Reilly # Copyright (C) 2008-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -19,9 +19,9 @@ class WiredConnectThread() -- Connection thread for wired
""" """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# Copyright (C) 2007 - 2008 Byron Hillis # Copyright (C) 2007 - 2009 Byron Hillis
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
""" Wicd Preferences Dialog. """ prefs -- Wicd Preferences Dialog.
Displays the main settings dialog window for wicd and Displays the main settings dialog window for wicd and
handles recieving/sendings the settings from/to the daemon. handles recieving/sendings the settings from/to the daemon.
@@ -8,8 +8,8 @@ handles recieving/sendings the settings from/to the daemon.
""" """
# #
# Copyright (C) 2007 Adam Blackburn # Copyright (C) 2008-2009 Adam Blackburn
# Copyright (C) 2007 Dan O'Reilly # Copyright (C) 2008-2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -8,8 +8,8 @@ Used for when a laptop enters hibernation/suspension.
""" """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# -* coding: utf-8 -*- # -* coding: utf-8 -*-
""" translations -- module for handling the translation strings for wicd. """
# #
# Copyright (C) 2007 - 2009 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2009 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly

View File

@@ -14,14 +14,12 @@ class TrayIcon() -- Parent class of TrayIconGUI and IconConnectionInfo.
class StatusTrayIconGUI() -- Implements the tray icon using a class StatusTrayIconGUI() -- Implements the tray icon using a
gtk.StatusIcon. gtk.StatusIcon.
class EggTrayIconGUI() -- Implements the tray icon using egg.trayicon. class EggTrayIconGUI() -- Implements the tray icon using egg.trayicon.
def usage() -- Prints usage information.
def main() -- Runs the wicd frontend main loop.
""" """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as
@@ -464,29 +462,29 @@ class TrayIcon(object):
signal_img = 'signal-25.png' signal_img = 'signal-25.png'
return wpath.images + signal_img return wpath.images + signal_img
@catchdbus
def on_net_menu_activate(self, item): def on_net_menu_activate(self, item):
""" Trigger a background scan to populate the network menu. """ Trigger a background scan to populate the network menu.
Called when the network submenu is moused over. We Clear the network menu, and schedule a method to be
sleep briefly, clear pending gtk events, and if called in .8 seconds to trigger a scan if the menu
we're still being moused over we trigger a scan. is still being moused over.
This is to prevent scans when the user is just
mousing past the menu to select another menu item.
""" """
def dummy(x=None): pass
if self._is_scanning: if self._is_scanning:
return True return True
self.init_network_menu() self.init_network_menu()
time.sleep(.4) gobject.timeout_add(800, self._trigger_scan_if_needed, item)
@catchdbus
def _trigger_scan_if_needed(self, item):
""" Trigger a scan if the network menu is being hovered over. """
while gtk.events_pending(): while gtk.events_pending():
gtk.main_iteration() gtk.main_iteration()
if item.state != gtk.STATE_PRELIGHT: if item.state != gtk.STATE_PRELIGHT:
return True return False
wireless.Scan(False) wireless.Scan(False)
return False
@catchdbus @catchdbus
def populate_network_menu(self, data=None): def populate_network_menu(self, data=None):
@@ -535,7 +533,7 @@ class TrayIcon(object):
net_menuitem.show() net_menuitem.show()
def init_network_menu(self): def init_network_menu(self):
""" Set the right-click menu for to the scanning state. """ """ Set the right-click network menu to the scanning state. """
net_menuitem = self.manager.get_widget("/Menubar/Menu/Connect/") net_menuitem = self.manager.get_widget("/Menubar/Menu/Connect/")
submenu = net_menuitem.get_submenu() submenu = net_menuitem.get_submenu()
self._clear_menu(submenu) self._clear_menu(submenu)
@@ -592,6 +590,7 @@ class TrayIcon(object):
if event.button == 1: if event.button == 1:
self.toggle_wicd_gui() self.toggle_wicd_gui()
elif event.button == 3: elif event.button == 3:
self._menu_just_opened = True
self.init_network_menu() self.init_network_menu()
self.menu.popup(None, None, None, event.button, event.time) self.menu.popup(None, None, None, event.button, event.time)
@@ -629,6 +628,7 @@ class TrayIcon(object):
def on_popup_menu(self, status, button, timestamp): def on_popup_menu(self, status, button, timestamp):
""" Opens the right click menu for the tray icon. """ """ Opens the right click menu for the tray icon. """
self._menu_just_opened = True
self.init_network_menu() self.init_network_menu()
self.menu.popup(None, None, None, button, timestamp) self.menu.popup(None, None, None, button, timestamp)

View File

@@ -8,19 +8,16 @@ connection management, for both wireless and wired networks. The daemon
must be run as root to control the networks, however the user interface must be run as root to control the networks, however the user interface
components should be run as a normal user. components should be run as a normal user.
class LogWriter() -- Class to redirect stdout and stderr to a log file. class WicdDaemon() -- DBus interface to manage general wicd processes.
class ConnectionWizard() -- DBUS interface to manage the network. class WiredDaemon() -- DBus interface to managed the wired network.
class ConnectionStatus() -- Updates the current connection state class WirelessDaemon() -- DBus interface to managed the wireless network.
def usage() -- Print usage information.
def daemonize() -- Daemonize the current process with a double fork.
def main() -- The wicd daemon main loop.
""" """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# Copyright (C) 2007 - 2008 Byron Hillis # Copyright (C) 2007 - 2009 Byron Hillis
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as

View File

@@ -6,18 +6,16 @@
This module implements functions to control and obtain information from This module implements functions to control and obtain information from
network interfaces. network interfaces.
def SetDNS() -- Set the DNS servers of the system. class BaseInterface() -- Control a network interface.
def GetWirelessInterfaces() -- Get the wireless interfaces available. class BaseWiredInterface() -- Control a wired network interface.
class Interface() -- Control a network interface. class BaseWirelessInterface() -- Control a wireless network interface.
class WiredInterface() -- Control a wired network interface.
class WirelessInterface() -- Control a wireless network interface.
""" """
# #
# Copyright (C) 2007 - 2008 Adam Blackburn # Copyright (C) 2007 - 2009 Adam Blackburn
# Copyright (C) 2007 - 2008 Dan O'Reilly # Copyright (C) 2007 - 2009 Dan O'Reilly
# Copyright (C) 2007 - 2008 Byron Hillis # Copyright (C) 2007 - 2009 Byron Hillis
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as # it under the terms of the GNU General Public License Version 2 as
@@ -74,9 +72,6 @@ blacklist_strict = '!"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ '
blacklist_norm = ";`$!*|><&\\" blacklist_norm = ";`$!*|><&\\"
blank_trans = maketrans("", "") blank_trans = maketrans("", "")
__all__ = ["GetDefaultGateway", "GetWiredInterfaces",
"GetWirelessInterfaces", "IsValidWpaSuppDriver"]
def _sanitize_string(string): def _sanitize_string(string):
if string: if string:
return translate(str(string), blank_trans, blacklist_norm) return translate(str(string), blank_trans, blacklist_norm)