ciao...
no non funziona quel comando, ho provato anche a vedere la sezione 802.1x da telnet ma niente da fare (il device dovrebbe essere wl0 ma non riesco ad attivarlo a linea di comando),
però ho installato iMACRO su firefox (un addon per creare macro in firefox) e con questo stupendissimo script in vbs che ho scritto vado alla stra grande,
quindi ecco cosa fare
1. installare iMACRO su ff
https://addons.mozilla.org/it/firefox/addon/imacros-for-firefox/2. creare la macro
ATTIVA WIRELESS (cambiare
url del router e
LAMIAPASSWORD):
VERSION BUILD=7300701 RECORDER=FX
TAB T=1
URL GOTO=http://192.168.77.1/
FRAME F=1
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Avanti<SP>>
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:form_contents ATTR=NAME:password_* CONTENT=LAMIAPASSWORD
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Accedi
TAG POS=1 TYPE=IMG ATTR=ID:img55
FRAME F=1
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Attiva
FRAME F=0
TAG POS=1 TYPE=IMG ATTR=ID:img33
TAB CLOSEALLOTHERS
TAB CLOSE2. creare la macro
DISATTIVA WIRELESS (cambiare
url del router e
LAMIAPASSWORD):
VERSION BUILD=7300701 RECORDER=FX
URL GOTO=http://192.168.77.1/
FRAME F=1
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Avanti<SP>>
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:form_contents ATTR=NAME:password_* CONTENT=LAMIAPASSWORD
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Accedi
TAG POS=1 TYPE=IMG ATTR=ID:img55
FRAME F=1
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Configura<SP>Rete<SP>Wi-Fi
TAG POS=1 TYPE=INPUT:RADIO FORM=NAME:form_contents ATTR=ID:radio_interface_active_0
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Salva
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:form_contents ATTR=VALUE:Avanti<SP>>
FRAME F=0
TAG POS=1 TYPE=IMG ATTR=ID:img33
TAB CLOSEALLOTHERS
TAB CLOSE3. creare
wireless.vbs con questo contenuto (è adatto alle mie esigenze, ma dovrebbe andar bene a tutti: cambiare solamente le
url del router nella Sub
CheckRouterState):
'AliceWireless
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSystemEnv = WshShell.Environment( "SYSTEM" )
If WScript.Arguments.Count = 0 Then
ExecTime = "poweredon"
Else
ExecTime = WScript.Arguments(0)
End If
If wshSystemEnv( "WIRELESS" ) = "on" Then
'caso di wireless on
If ExecTime = "startup" Then
'startup: aspetta almeno 3 minuti
HaveYouWaited(2)
End If
If (ExecTime = "startup" or ExecTime = "poweredon") Then
'startup o durante il lavoro: chiede ed eventualmente spegne
CheckRouterState
Msg = MsgBox("Lasciare attivato il Wireless?",4,"WLan Control")
If Msg = 6 Then
Wscript.Quit(1)
Else
Wireless("Off")
End If
'altrimenti significa che ExecTime = "shutdown", quindi lasciamo acceso
End If
ElseIf wshSystemEnv( "WIRELESS" ) = "off" Then
'caso di wireless off
CheckRouterState
If ExecTime = "shutdown" Then
'in chiusura riaccende
Wireless("On")
Else
'altrimenti chiede ed eventualmente attiva
Msg = MsgBox("Attivare il Wireless?",4,"WLan Control")
If Msg = 6 Then
Wireless("On")
End If
End If
Else
'installazione: creo var d'ambiente WIRELESS se non esiste
Msg = MsgBox ("Il Wireless è attivo in questo momento?",4,"Installazione WLan Control")
If Msg = 6 Then
wshSystemEnv( "WIRELESS" ) = "on"
Else
wshSystemEnv( "WIRELESS" ) = "off"
End If
Msg = MsgBox ("Riavviare lo script per attivare il controllo Wireless",0,"Installazione WLan Control")
End If
Sub Wireless( ByVal switch )
'accende o spegne il wireless mediante FireFox iMACRO
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSystemEnv = WshShell.Environment( "SYSTEM" )
If switch = "Off" Then
WshShell.CurrentDirectory = "C:\Programmi\Mozilla Firefox"
command = "firefox.exe -new-window ""javascript:window.resizeTo(800,600)"""
WshShell.Run command, 1
WScript.Sleep 1000
command = "firefox.exe -new-tab http://run.imacros.net/?m=DISATTIVA%20WIRELESS.iim"
WshShell.Run command, 0
wshSystemEnv( "WIRELESS" ) = "off"
Else
'switch = On
WshShell.CurrentDirectory = "C:\Programmi\Mozilla Firefox"
command = "firefox.exe -new-window ""javascript:window.resizeTo(800,600)"""
WshShell.Run command, 0
WScript.Sleep 1000
command = "firefox.exe -new-tab http://run.imacros.net/?m=ATTIVA%20WIRELESS.iim"
WshShell.Run command, 0
wshSystemEnv( "WIRELESS" ) = "on"
End If
Set WshShell = Nothing
Set WshSystemEnv = Nothing
End Sub
Sub CheckRouterState
'controlla se il router è funzionante ed eventualmente aspetta la sua operatività
If PingSite("192.168.77.1") = False Then
Msg = MsgBox("Il Router è spento o in fase di accensione." & Chr(13) & Chr(10) & "Attendo operatività del router per controllo del Wireless?",4,"WLan Control")
If Msg = 6 Then
Do While PingSite("192.168.77.1") = False
WScript.sleep 1000
Loop
Else
Wscript.Quit(1)
End If
End If
End Sub
Sub HaveYouWaited( byVal minutes )
'guarda da quanto è acceso il pc ed eventualmente aspetta fino al numero di minuti dichiarato
Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
Set colItems = objWMIService.ExecQuery( "Select * from Win32_OperatingSystem", , 48 )
For Each objItem in colItems
numUptime = DateDiff( "s", _
ParseDat( objItem.LastBootUpTime ), _
ParseDat( objItem.LocalDateTime ) )
Next
If numUpTime < (minutes * 60) Then
Wscript.sleep ( ( (minutes * 60) - numUpTime ) * 1000 )
End If
End Sub
Function ParseDat( ByVal strDate )
'restituisce la data da oggetti di sistema
strYear = Left( strDate, 4 )
strMonth = Mid( strDate, 5, 2 )
strDay = Mid( strDate, 7, 2 )
strDat = strDay & "-" & strMonth & "-" & strYear
strHour = Mid( strDate, 9, 2 ) - strTimeShift
strMins = Mid( strDate, 11, 2 )
strTime = strHour & ":" & strMins
ParseDat = strDat & " " & strTime
End Function
Function PingSite( myWebsite )
' This function checks if a website is running by sending an HTTP request.
' If the website is up, the function returns True, otherwise it returns False.
' Argument: myWebsite [string] in "www.domain.tld" format, without the
' "http://" prefix.
'
' Written by Rob van der Woude
' http://www.robvanderwoude.com
Dim intStatus, objHTTP
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
objHTTP.Open "GET", "http://" & myWebsite & "/", False
objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"
On Error Resume Next
objHTTP.Send
intStatus = objHTTP.Status
On Error Goto 0
Set objHTTP = Nothing
If intStatus = 200 Then
PingSite = True
Else
PingSite = False
End If
End Function
(Testato su Xp / Firefox 5 / Agpf 452)
Con questa roba controllo il Wireless facendo doppio clic su
wireless.vbs rispondendo comodamente alle finestrelle "Vuoi attivare il Wireless?" o "Vuoi lasciarlo acceso?", ecc...
ciao