Esempio n. 1
0
def addProfile(strPath):
    '''
    adds a profile to the saved configurations. Configuration has to be an exported .xml file
    '''
    strCorrPath = os.path.normpath(strPath)
    strCmd = 'netsh wlan add profile filename="' + strCorrPath + '"'
    executeNonQuery(strCmd)
Esempio n. 2
0
def setConnectionMode(strProfile, setToAuto=True):
    '''
    updates the connection mode of the specified profile
    '''
    strMode = "auto" if setToAuto else "manual"
    strCmd = 'netsh wlan set profileparameter name="' + strProfile + '" connectionmode=' + strMode
    executeNonQuery(strCmd)
Esempio n. 3
0
def exportProfile(strProfile, strPath, clearKey=True):
    '''
    exports a profile to a xml-file
    '''
    strKey = "key=clear " if clearKey else ""
    strCorrPath = os.path.normpath(strPath)
    strCmd = 'netsh wlan export profile name="' + strProfile + '" ' + strKey + 'folder="' + strCorrPath + '"'
    executeNonQuery(strCmd)
Esempio n. 4
0
def enableInterface(strInterface, setEnabled=True):
    '''
    enables or disables specified interface
    '''
    if not isAdmin(): raise NotAdminException()
    else:
        strEnabled = "ENABLED" if setEnabled else "DISABLED"
        strCmd = 'netsh interface set interface name="' + strInterface + '" admin=' + strEnabled
        executeNonQuery(strCmd)
Esempio n. 5
0
def disconnect():
    '''
    shuts down the WLAN-Connection
    '''
    executeNonQuery("netsh wlan disconnect")
Esempio n. 6
0
def deleteProfile(strProfile):
    '''
    CAREFULL!!!! This function permanently deletes a profile
    '''
    strCmd = 'netsh wlan delete profile name="' + strProfile + '"'
    executeNonQuery(strCmd)
Esempio n. 7
0
def connectTo(strProfile):
    '''
    tries to establish a WLAN-Connection to the specified Profile
    '''
    executeNonQuery("netsh wlan connect " + strProfile)