Sign in to follow this  
Followers 0
Before

Wireless networks in range

8 posts in this topic

Hey Guys,

I am wondering how I can see the wireless networks in range, or at least the connected network.

This is because I want to run different scripts when I am at home than when I'm at school or in the train.

Anyone any idea?

Share this post


Link to post
Share on other sites



What software are you using to detect networks in range (windows default or software provided by wireless card?) what can AutoIt's windows info tool get from the detect networks box?


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

What software are you using to detect networks in range (windows default or software provided by wireless card?) what can AutoIt's windows info tool get from the detect networks box?

I am using Windows 7's default software for Wireless networks. It works as a tray menu. I used the Window Info tool and I found this:

>>>> ToolsBar <<<<
1:  3   Solve PC issues: 1 important message
2:  0   3 hr 52 min (68%) remaining
3:  2   SpeedTouchA56B3E Internet access
4:  1   Speakers: 0%

The network name is in the window info. I'm sure I can filter the name out in some sort of way.

I got it, Thanks!

Share this post


Link to post
Share on other sites

Well I got a little problem;

How can I get the info in the [ToolBar] menu from Window Info from my script?

Share this post


Link to post
Share on other sites

There should be some class, wintitle or some other identifier you can use to use one of the gettext commands.

Once you are able to read the text to a variable you can use StringInStr to search the text for one of the 2 networks.

Then it is simply doing an

If variable <>0 Then

do this code

elseif variable=0 then

do other code

endif


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Well the proper way would be to use an API call, such as WlanGetAvailableNetworkList (http://msdn.microsoft.com/en-us/library/ms706749%28VS.85%29.aspx).

Thank you for the correction. I have not gotten that far in my studies so I find a way with what I know.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

I once translated some code to autoit.

Maybe this could be usefull:

$strComputer = "." ; THIS computer
$objSWbemServices = ObjGet("winmgmts:\\" & $strComputer & "\root\wmi")

$colInstances = $objSWbemServices.ExecQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength WHERE Active = True")
If $cmdline[0] = 0 Then ; spit out usage and cards if no args
 Local $card_no = 1, $InstanceName
 For $objInstance In $colInstances ; more than one instance per card may show up, btw
  $InstanceName &= $card_no & " = " & $objInstance.InstanceName & @CR
  $card_no += 1
 Next
 MsgBox(0, "", $InstanceName)
;~  Exit
EndIf


$card_no = 1;$cmdline[1]
$x = 1
For $objInstance In $colInstances
 If $x = $card_no Then
  $wifiAdapter = $objInstance.InstanceName
  $x += 1
 EndIf
Next
MsgBox(0, "WifiAdapter", $wifiAdapter)

$last_signal = 0 ; we need to initialize this, but I'm not sure if -90 would be   a better val to start with


; get bssid
$bssid = ""
$colInstances = $objSWbemServices.ExecQuery("SELECT * FROM MSNdis_80211_BaseServiceSetIdentifier WHERE Active = True AND InstanceName = '" & $wifiAdapter & "'")

For $objInstance In $colInstances
 $macbyte = 0
 ; convert decimals to hex.  pad zeros & slip in colons where needed
 For $decval In $objInstance.Ndis80211MacAddress
  If $decval < 17 Then
   $bssid &= "0"
  EndIf
  $bssid &= Hex($decval)
  If $macbyte < 5 Then
   $bssid &= ":"
   $macbyte += 1
  EndIf
 Next
Next

; get ssid
$ssid = ""
$colInstances = $objSWbemServices.ExecQuery("SELECT * FROM MSNdis_80211_ServiceSetIdentifier WHERE Active = True AND InstanceName = '" & $wifiAdapter & "'")
For $objInstance In $colInstances
 ; convert decimals to chars and avoid non-alphanumerics
 For $decval In $objInstance.Ndis80211SsId
  If ($decval > 31 And $decval < 127) Then
   $ssid &= Chr($decval)
  EndIf
 Next
Next

; this could be tricky, as I've read signal strength is reported in different   ways per card.  YMMV.
$colInstances = $objSWbemServices.ExecQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength WHERE Active = True AND InstanceName ='" & $wifiAdapter & "'")
For $objInstance In $colInstances
 $sigraw = $objInstance.Ndis80211ReceivedSignalStrength ; raw number for later comparison
 $signal = $sigraw & "dB" ; make it a string that says dB
Next

$last_signal = $sigraw
MsgBox(0, "", "BSSID: " & $bssid & @CR &"SSID: " & $ssid & @CR & "RSSI: " & $signal)

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0