' Copyright Marius Milner 2004. ' Use with NetStumbler. Edit. Enjoy. 'Version 00:25 060704 - Laidback 'Includes option to not centre map on vehicle 'Version 00:24 230604 - Laidback 'Included routine to add APs already on default map into script 'Version 00:23 210604 - Laidbacka 'Corrected Aps not being placed at highest SNR 'Version 00:22 190604 - Laidback 'Add custom Icons 'If opening default map you can remove the last vehicle location 'If opening default map you can remove the last vehicle track 'version 00:21 310504 - Laidback 'if DropCrumbs set, pressing stopscan zooms to Crumbs else zooms to WiFi points found. 'Should plot all AP's in MapPoint 'Msgbox SSID, 16, nameScript 'Version 00:20 310504 - Laidback 'Added code to remove surplus toolbars 'Added code to change crumb gap 'Distance function code courtesy of RedRocket & TrackNS v2! 'Version 00:19 20040511 '20040426 Marks changes made to use speech, when you are not lucky enough to have ' Mappoint. Also adds ability to turn off signal strength playing - TPEER '20040429a Marks changes made to allow setting of voice - find \HKEY_LOCAL_MACHINE\SOFTWARE\ ' Microsoft\Speech\Voices\Tokens - that should give you a list of voices you can set ' it starts at 0, not 1. Change the line "Set TTS.voice = TTS.getvoices().item(X)" where X ' equals the number of the voice you want - TPEER '20040429b Marks changes made to store the WEP status with the SSID, so the 'Stumbler Lady' will ' add "is Open" or "is Closed" - TPEER ' Start of by Laidback 030504 ' Start of by Laidback - Start of Changes made by Laidback ' End of by Laidback - End of Changes made by Laidback ' Code thanks to TrackNS & rogerRabbit! ' End of by Laidback 030504 ' '20040504 Marks change to allow override of default voice by this script ' Also set VoiceNum to the number of the voice you want to use ' Will say the name of the voice IF you override the default - TPEER '20040506 Changes to Voice stuff. If VoiceNum = Empty, the default voice will used ' Modified the hello world message to be the name of the voice used ' organized the user changeable switches/variables a little ' Changed all mappoint stuff to not be checked unless UseMAppoint = True - TPEER ' '20040509 Version 00:18 - Removed everything to do with zoomcontrol.txt! - Laidback ' '20040511 Version 00:19 - Added message boxes if unable to initialize voice or mappoint ' Added variable for what to add to WEP and NOWEP SSIDs ' Fixed bug with UseSpeech - TPEER ' '20040609 Split pushpin group into two: open/closed ' Created user-configurable icons for open/closed APs ' - smt ' '20040611 Added track lines colored by signal strength ' '20040618 Added default map functionality Dim ActiveMap Dim LastLocation Dim MapPointApp Dim HistoryPushpins Dim MotionPushpins 'smt 090604 'Dim WLANPushpins Dim WEPPushpins Dim NonWEPPushpins 'end smt 090604 Dim Vehicle Dim Initialized Dim BSSID_Dictionary, Spoken_BSSIDs, New_SSIDs Dim IsScanning Dim HadGPSData Dim LastLatitude, LastLongitude, LastAltitude Dim DropCrumbs, TrackVehicle, UseSpeech, UseAudio Dim LastHighlighted Dim UseMappoint ' 20040426 Dim UseSignalStr ' 20040426 Dim AddWEP ' 20040429b Dim strNoWEP '20040511 Dim strWEP '20040511 Dim VoiceNum '20040504 ' Start of by Laidback 030504 Dim CL, nameDir nameScript = "ns04mappoint_v00:25" ' Laidback 060704 ' end of by Laidback 030504 ' Start of by Laidback 050504 Dim place Dim zoomToStartLoc ' End of by Laidback 050504 ' Start of by Laidback 090504 Dim RadiusEarth Dim lastLat, lastLon, CrumbGap RadiusEarth = 6378000 'meters ' End of by Laidback 090504 ' Start of SMT 090604 Dim WEPIcon Dim NonWEPIcon Dim WEPPushpinSet Dim NonWEPPushpinSet ' End of SMT 090604 'smt 110604 Dim WriteTrack,HaveMoved,TrackColor(7),Strength,TrackWidth 'end smt 110604 Dim UseDefaultMap,DefaultMapLocation '20040618 ' Start of by Laidback 190604 Dim pWEPPushpinSet Dim pNonWEPPushpinSet Dim pWEPPushpins Dim pNonWEPPushpins Dim cSymbols Dim cSymbol1 Dim cSymbol2 Dim cSymbol3 Dim cSymbol4 Dim oFS Dim oWSH Dim delLastLoc Dim delLasttrack Set oFS = CreateObject("Scripting.FileSystemObject") If Err.Number <> 0 Then MsgBox "FSO initialisation failed!", 16, nameScript End If Set oWSH = CreateObject("WScript.Shell") If Err.Number <> 0 Then MsgBox "WSH Shell initialisation failed!", 16, nameScript End If nameDir = oWSH.RegRead("HKCU\Software\Bogosoft\NetStumbler\Settings\Script Name") Set oWSH = Nothing nameDir = oFS.GetParentFolderName(nameDir) 'nameDir = "d:\program files\network Stumbler\TrackNS\" If Not oFS.FolderExists(nameDir) Then MsgBox "Netstumbler Folder Not Found!", 16, nameScript Else nameDir = nameDir & "\" End If ' End of by Laidback 190604 ' Start of by Laidback 210604 Dim BSSID_Signal, lSNR ' End of by Laidback 210604 '*************** User Configurable Switches **************** '*********************************************************** '***** Mappoint UseMappoint = True '20040426 - True if you want to use Mappoint - this overrides DropCrumbs and TrackVehicle UseDefaultMap = True 'Do you want to use a default map? 20040618 DefaultMapLocation = "D:\Programme\Microsoft MapPoint Europe\wardrive\wardrive.ptm" 'self explanatory - only used if UseDefaultMap is True 20040618 ' Start of by Laidback 190604 delLastLoc = True 'True to delete the last vehicle location - only if using default map delLasttrack = True 'True to delete last track - only if using default map ' End of by Laidback 190604 place = "marschstr, 25704 meldorf, germany" 'Enter your starting location (street,#, city, country) zoomToStartLoc = True ' True if you want MapPoint to zoom to start location entered in 'place' above DropCrumbs = True ' True to put black dots everywhere we go, False otherwise 'smt 110604 WriteTrack = False ' Create a track line? TrackWidth = 3 'number of pixels wide the track line will be 'FYI - CrumbGap is also used for tracks 'end smt 110604 CrumbGap = 10 ' Use 0, 50, 100 etc. TrackVehicle = True ' True to follow your location while scanning CentreVehicle = True ' True to centre map on vehicle - Laidback 060704 hideStan = True ' True to hide standard toolbar hidedraw = True ' True to hide drawing toolbar ' SMT 090604 ' Icons to use for WEP/Non-WEP APs ' See http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/mappoint2004/BIZOMPSymbol.asp WEPIcon = 70 NonWEPIcon = 30 ' Pushpin set names for WEP/Non-WEP APs WEPPushpinSet = "Closed APs" NonWEPPushpinSet = "Open APs" ' End SMT 090604 ' Start of by Laidback 190604 ' Pushpin set names for WEP/Non-WEP Peers pWEPPushpinSet = "Closed Peer to Peer" pNonWEPPushpinSet = "Open Peer to Peer" useCustIcon = True ' True to use custom icons cSymbol1 = nameDir & "Cicons\$lwfw.ico" 'Icon file name of wep'd AP cSymbol2 = nameDir & "Cicons\$lwfnw.ico" 'Icon file name of Open AP cSymbol3 = nameDir & "Cicons\$lwfaw.ico" 'Icon file name of wep'd Peer cSymbol4 = nameDir & "Cicons\$lwfanw.ico" 'Icon file name of Open Peer ' End of by Laidback 190604 '***** Speech UseSpeech = True ' Speak names of networks in view AddWEP = True '20040429b - True if you want voice to add WEP status "is Open" or "is Closed" to the SSID strNoWep = " is Open" ' Set to what you want added to SSID for NonWEP strWEP = " is Closed" ' Set to what you want added to SSID for WEP VoiceNum = Empty ' 20040504 set this to the number of the voice you want to use - Setting to Empty will use the default voice '***** Sounds UseAudio = False ' Traditional script audio - if you are using speech this will only trigger if there are no ' new ssids to say UseSignalStr = False '20040426 - True if you want the varying signal strength sounds - if you are using speech 'this will only trigger if there are no new ssids to say, and UseAudio = True '*********************************************************** '*********************End of switches*********************** If UseMappoint Then '20040426 AddItemContextMenu "HighlightOnMap", "Highlight on map" 'AddItemContextMenu "AddToDefaultMap", "Add to map" 'Just Testing End If '20040426 Set LastHighlighted = Nothing 'smt 090604 'Set WLANPushpins = Nothing Set WEPPushpins = Nothing Set NonWEPPushpins = Nothing 'end smt 090604 'smt 110604 HaveMoved = False Trackcolor(0) = RGB(0,0,0) 'black - not picking up anything TrackColor(1) = RGB(255,0,0) 'snr level 1 TrackColor(2) = RGB(128,0,128) 'ect.. TrackColor(3) = RGB(64,0,192) TrackColor(4) = RGB(0,0,255) TrackColor(5) = RGB(0,128,128) TrackColor(6) = RGB(0,192,64) TrackColor(7) = RGB(0,255,0) 'damn! I can hear it in my head!! 'end smt 110604 Dim TTS On Error Resume Next ' 20040511 If UseSpeech Then Set TTS = CreateObject("Sapi.SpVoice") If Err <> 0 then ' 20040511 UseSpeech = False ' 20040511 MsgBox "Unable to wake up Stumbler Lady", 16, nameScript '20040511 End If ' 20040511 End If If UseSpeech then ' 20040511 If TTS Is Nothing Then UseSpeech = False else ' 20040429a Set TTS.voice = TTS.getvoices().item(VoiceNum) ' 20040429a End If End If If UseSpeech Then TTS.Speak TTS.getvoices().item(VoiceNum).getdescription ' 20040505 'TTS.Speak "Hello Ian!" ' commented out 20040505 Set Spoken_BSSIDs = CreateObject("Scripting.Dictionary") Set New_SSIDs = CreateObject("Scripting.Dictionary") End If Initialize Sub Initialize() On Error Resume Next HadGPSData = False Set BSSID_Dictionary = CreateObject("Scripting.Dictionary") ' Start of by Laidback 210604 Set BSSID_Signal = CreateObject("Scripting.Dictionary") ' End of by Laidback 210604 If UseMappoint Then '20040426 ' begin 20040618 ' Are we using a default map? If UseDefaultMap Then Set MapPointApp = CreateObject("MapPoint.Application") MapPointApp.Visible = True MapPointApp.UserControl = False MapPointApp.OpenMap(DefaultMapLocation) If Err <> 0 Then Msgbox "Unable to open default map!", 16, "Critical Error!" Err.Clear UseMapPoint = False ZoomToStartLoc = False DropCrumbs = False TrackVehicle = False Place = "" MapPointApp.ActiveMap.Saved = True MapPointApp.Quit End If Else ' end 20040618 ' Try to get a handle to an existing instance of MapPoint Set MapPointApp = GetObject(, "MapPoint.Application") ' No instance found, create one. If Err <> 0 Then Err.Clear Set MapPointApp = CreateObject("MapPoint.Application") If Err = 0 then ' 20040505 MapPointApp.Visible = True MapPointApp.UserControl = False MapPointApp.Activate else '20040505 Msgbox "Unable to initialize Mappoint", 16, nameScript '20040511 Err.Clear ' 20040505 UseMappoint = False ' 20040505 place = "" ' 20040505 zoomToStartLoc = False ' 20040505 DropCrumbs = False ' 20040505 TrackVehicle = False ' 20040505 End If ' 20040505 End If End If ' 20040618 End If ' 20040505 If UseMappoint Then '20040505 Set ActiveMap = MapPointApp.ActiveMap ' Start of by Laidback 090504 if hideStan = True then MapPointApp.Toolbars.Item("Standard").Visible = False 'Hide surplus Toolbars if hideDraw = True then MapPointApp.Toolbars.Item("Drawing").Visible = False 'Hide surplus Toolbars ' End of by Laidback 090504 ' Start of by Laidback 190604 Set cSymbols = ActiveMap.Symbols cSymbol1 = cSymbols.Add(cSymbol1) cSymbol2 = cSymbols.Add(cSymbol2) cSymbol3 = cSymbols.Add(cSymbol3) cSymbol4 = cSymbols.Add(cSymbol4) If UseDefaultMap AND delLastLoc Then ActiveMap.Datasets("Last Location").delete If UseDefaultMap AND delLastTrack Then ActiveMap.Datasets("Location History").delete ' End of by Laidback 190604 Dim StartLoc Set StartLoc = ActiveMap.FindResults(place)(1) ' Middle of, uh, somewhere If DropCrumbs Then Set HistoryPushpins = ActiveMap.Datasets.AddPushpinSet("Location History") If Err <> 0 Then Err.Clear Set HistoryPushpins = ActiveMap.Datasets("Location History") End If End If ' SMT 090604 'Set WLANPushpins = ActiveMap.Datasets.AddPushpinSet("Wireless LAN data") 'If Err <> 0 Then ' Err.Clear ' ' Set WLANPushpins = ActiveMap.Datasets("Wireless LAN data") 'End If Set WEPPushpins = ActiveMap.Datasets.AddPushpinSet(WEPPushpinSet) If Err <> 0 Then Err.Clear Set WEPPushpins = ActiveMap.Datasets(WEPPushpinSet) End If Set NonWEPPushpins = ActiveMap.Datasets.AddPushpinSet(NonWEPPushpinSet) If Err <> 0 Then Err.Clear Set NonWEPPushpins = ActiveMap.Datasets(NonWEPPushpinSet) End If 'end smt 090604 ' Start of by Laidback 190604 Set pWEPPushpins = ActiveMap.Datasets.AddPushpinSet(pWEPPushpinSet) If Err <> 0 Then Err.Clear Set pWEPPushpins = ActiveMap.Datasets(pWEPPushpinSet) End If Set pNonWEPPushpins = ActiveMap.Datasets.AddPushpinSet(pNonWEPPushpinSet) If Err <> 0 Then Err.Clear Set pNonWEPPushpins = ActiveMap.Datasets(pNonWEPPushpinSet) End If ' End of by Laidback 190604 ' Start of by Laidback 230604 If UseDefaultMap then 'Put the old datasets into the dictionary Dim objRecords, objDataSet, objName Set objRecords = ActiveMap.RecordSet Set objDataSet = ActiveMap.Dataset For Each objDataSet In Activemap.DataSets If InStr(objDataSet.Name, "Open APs") OR InStr(objDataSet.Name, "Closed APs") OR _ InStr(objDataSet.Name, "Open Peer to Peer") OR InStr(objDataSet.Name, "Closed Peer to Peer") OR _ InStr(objDataSet.Name, "Wireless LAN data") OR InStr(objDataSet.Name, "My Pushpins")Then Set objRecords = objDataSet.QueryAllRecords Do Until objRecords.EOF 'objRecords.Pushpin.Highlight = True objName = objRecords.Pushpin.Name FindOrAddPushpin Loc, objName, True objRecords.MoveNext Loop End if Next TTS.Speak BSSID_Dictionary.Count & "Records imported", SVSFlagsAsync End if ' End of by Laidback 230604 If TrackVehicle Then Set MotionPushpins = ActiveMap.Datasets.AddPushpinSet("Last Location") If Err <> 0 Then Err.Clear Set MotionPushpins = ActiveMap.Datasets("Last Location") End If Set Vehicle = MotionPushpins("Last Location") If Err <> 0 Then Err.Clear Set Vehicle = FindOrAddPushpin(StartLoc, "Last Location", False) End If Vehicle.Symbol = 82 ' red car, just like the stumblemobile Vehicle.Highlight = True Vehicle.MoveTo (MotionPushpins) ' Start of by Laidback 050504 if zoomToStartLoc = True then MotionPushpins.ZoomTo End if ' End of by Laidback 050504 End If End If '20040426 Initialized = True ' Start of by Laidback 030504 IsScanning = True End Sub 'smt 090604 'Function SSIDIcon(SSID) ' Dim i, s ' s = 0 ' For i = 1 To Len(SSID) ' s = s + Asc(Mid(SSID, i, 1)) ' Next ' SSIDIcon = 17 + (s Mod 47) 'End Function 'end smt 090604 Sub HighlightOnMap(BSSID, SSID) If Not LastHighlighted Is Nothing Then LastHighlighted.Highlight = False LastHighlighted.BalloonState = 0 End If If BSSID_Dictionary.Exists(BSSID) Then Set LastHighlighted = BSSID_Dictionary.Item(BSSID) LastHighlighted.Highlight = True LastHighlighted.BalloonState = 2 LastHighlighted.GoTo Else Msgbox SSID & " not found on map!", 16, nameScript End If End Sub Function FindOrAddPushpin(Loc, Title, InDict) On Error Resume Next Dim pp Set pp = Nothing Set pp = ActiveMap.AddPushpin(Loc, Title) If pp Is Nothing Then Set pp = ActiveMap.FindPushpin(Title) If InDict Then Set BSSID_Dictionary.Item(Title) = pp Set FindOrAddPushpin = pp End Function 'Sub AddToDefaultMap(BSSID, SSID) Just Testing 'MapPointApp.OpenMap "d:\program files\network stumbler\map.ptm" 'End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub OnGPSPosition(Lat, Lon, Alt) ' Lat : double : Latitude, degrees east ' Lon : double : Longitude, degrees north ' Alt : double : Altitude above sea level, meters If Not Initialized Then Initialize End If If UseMappoint Then '20040426 ' Start of by Laidback 030504 on error resume next ' End of by Laidback 030504 If HadGPSData Then ' If we haven't moved, do nothing. If LastLatitude = Lat And LastLongitude = Lon And LastAltitude = Alt Then Exit Sub End If LastLatitude = Lat LastLongitude = Lon LastAltitude = Alt Set LastLocation = ActiveMap.GetLocation(Lat, Lon, Alt) ' Start of by Laidback 090504 'If DropCrumbs Then ' Dim Crumb ' Set Crumb = FindOrAddPushpin(LastLocation, Lat & " " & Lon & " " & Alt, False) ' Crumb.Symbol = 16 '16 Small black circle ' Crumb.MoveTo (HistoryPushpins) 'End If 'smt 110604 If Distance(lastLat, lastLon, Lat, Lon) > CrumbGap Then HaveMoved = True End If If DropCrumbs AND HaveMoved Then 'end smt 110604 Dim Crumb Set Crumb = FindOrAddPushpin(LastLocation, Lat & " " & Lon & " " & Alt, False) Crumb.Symbol = 16 ' Small black circle, 16=Black, 17=Red 'Crumb = ActiveMap.Shapes.AddRadius(20) Crumb.MoveTo (HistoryPushpins) 'smt 110604 End If If WriteTrack AND HaveMoved Then TrackDraw Lat, Lon End If If HaveMoved Then lastLat = Lat lastLon = Lon HaveMoved = False End If 'end smt 110604 ' End of by Laidback 090504 If TrackVehicle Then ' Move the visual indicator to the new location. Set Vehicle.Location = LastLocation If IsScanning Or Not HadGPSData Then ' If scanning or first position, center the map on the new location ' Start of by Laidback 030504 UpdateCurrentLocation Lat, Lon ' End of by Laidback 030504 End If End If End If '20040426 HadGPSData = True End Sub ' Called when user requests that scanning start, or when scanning is started automatically. Sub OnEnableScan() If Not HadGPSData Then Exit Sub ' Discard while no GPS If Not Initialized Then Initialize End If IsScanning = True End Sub ' Called when user requests that scanning stop. Sub OnDisableScan() ' Start of by Laidback 030504 on error resume next ' End of by Laidback 030504 'smt 090604 'If WLANPushpins Is Nothing Then If WEPPushpins Is Nothing AND NonWEPPushpins Is Nothing Then 'end smt 090604 ' Blah Else If UseMappoint Then '20040426 ' Start of by Laidback 310504 ' WLANPushpins.ZoomTo If DropCrumbs Then HistoryPushpins.ZoomTo Else 'smt 090604 'WLANPushpins.ZoomTo NonWEPPushpins.ZoomTo 'end smt 090604 End if ' End of by Laidback 310504 End If '20040426 End If IsScanning = False End Sub Sub OnScanResult(SSID, BSSID, CapFlags, Signal, Noise, LastSeen) ' SSID : String : SSID (Network name) ' BSSID : String : BSSID (MAC address) ' CapFlags : Integer : 802.11 capability flags ' Signal : Integer : signal level (dBm) ' Noise : Integer : noise level(dBm) ' LastSeen : Time Dim ComboSSID '20040429 ' Start of by Laidback 310504 If UseMappoint Then '20040426 Dim foundBSS, newLocation Set newLocation = ActiveMap.GetLocation(LastLatitude, LastLongitude, LastAltitude) If BSSID_Dictionary.Exists(BSSID) Then ' Start of by Laidback 210604 'Set foundBSS = BSSID_Dictionary.Item(BSSID) 'Set foundBSS.Location = newLocation lMove = False lSNR = (-Noise - -Signal) if BSSID_Signal(BSSID) < lSNR then 'only move if SNR is stronger lMove = True Set foundBSS = BSSID_Dictionary.Item(BSSID) Set foundBSS.Location = newLocation BSSID_Signal.item(BSSID) = lSNR End if ' End of by Laidback 210604 Else Set foundBSS = FindOrAddPushpin(newLocation, BSSID, True) 'smt 090604 'foundBSS.MoveTo (WLANPushpins) 'foundBSS.Symbol = SSIDIcon(SSID) 'end smt 090604 ' Start of by Laidback 210604 lMove = True lSNR = (-Noise - -Signal) ' Get the SNR for next time Set BSSID_Signal.item(BSSID) = newLocation BSSID_Signal.item(BSSID) = lSNR ' End of by Laidback 210604 ' Start of by Laidback 190604 'If ((CapFlags / 16) Mod 2) = 1 Then ' foundBSS.Symbol = WEPIcon ' foundBSS.MoveTo(WEPPushpins) 'Else ' foundBSS.Symbol = NonWEPIcon ' foundBSS.MoveTo(NonWEPPushpins) 'End if If useCustIcon then If (CapFlags Mod 2) = 1 Then if ((CapFlags / 16) Mod 2) = 1 Then foundBSS.Symbol = cSymbol1 foundBSS.MoveTo(WEPPushpins) Else foundBSS.Symbol = cSymbol2 foundBSS.MoveTo(NonWEPPushpins) end if Else if ((CapFlags / 2) Mod 2) = 1 Then if ((CapFlags / 16) Mod 2) = 1 Then foundBSS.Symbol = cSymbol3 foundBSS.MoveTo(pWEPPushpins) Else foundBSS.Symbol = cSymbol4 foundBSS.MoveTo(pNonWEPPushpins) End if End if End if Else If ((CapFlags / 16) Mod 2) = 1 Then foundBSS.Symbol = WEPIcon foundBSS.MoveTo(WEPPushpins) Else foundBSS.Symbol = NonWEPIcon foundBSS.MoveTo(NonWEPPushpins) End if End if End If ' End of by Laidback 190604 If Lmove = True then Dim Flags Flags = "" If (CapFlags Mod 2) = 1 Then Flags = Flags & "ESS " If ((CapFlags / 2) Mod 2) = 1 Then Flags = Flags & "IBSS " If ((CapFlags / 16) Mod 2) = 1 Then Flags = Flags & "WEP " foundBSS.Note = "SSID: " & SSID & vbCrLf & _ "BSSID: " & BSSID & vbCrLf & _ "CapFlags: " & Flags & " (" & Hex(CapFlags) & ")" & _ "SNR: " & lSNR Set newLocation = Nothing End if End If '20040426 ' End of by Laidback 310504 ' If UseSpeech And Not Spoken_BSSIDs.Exists(BSSID) Then 20040511 If UseSpeech Then '20040511 If Not Spoken_BSSIDs.Exists(BSSID) Then '20040511 ' TTS.Speak SSID, SVSFlagsAsync ' New_SSIDs.Item(SSID) = 1 ' 20040429b ComboSSID = SSID ' 20040429 If AddWEP then '20040429b If ((CapFlags / 16) Mod 2) = 1 Then '20040429b ComboSSID = SSID & strWEP '20040429b Else '20040429b ComboSSID = SSID & strNoWEP '20040429b End If ' 20040429b End If '20040429b New_SSIDs.Item(ComboSSID) = 1 ' 20040429b Spoken_BSSIDs.Item(BSSID) = LastSeen ' Could check and see if it's been a long time, play again End If End If End Sub ' Called to indicate that NetStumbler has changed its location information ' for a BSSID. The new location may not necessarily be the place where you ' are right now. ' History: New in 0.4. Sub OnPositionChange(SSID, BSSID, CapFlags, MaxSNR, Lat, Lon, Alt, FixType) ' SSID : String : SSID (Network name) ' BSSID : String : BSSID (MAC address) ' CapFlags : Integer : 802.11 capability flags ' MaxSNR: Integer : highest seen signal-to-noise ratio (dB) that had a position fix associated with it ' Lat : Double : Newly calculated latitude, degrees ' Lon : Double : Newly calculated longitude, degrees ' Alt : Double : Newly calculated altitude (currently not calculated) ' FixType : Integer : Reserved for future use. ' TTS.Speak SSID, SVSFlagsAsync If Not Initialized Then ' To get here, start with no script, start scan, then enable script Initialize IsScanning = True End If If UseMappoint Then '20040426 Dim foundBSS, newLocation Set newLocation = ActiveMap.GetLocation(Lat, Lon, Alt) If BSSID_Dictionary.Exists(BSSID) Then Set foundBSS = BSSID_Dictionary.Item(BSSID) Set foundBSS.Location = newLocation Else Set foundBSS = FindOrAddPushpin(newLocation, BSSID, True) 'smt 090604 'foundBSS.MoveTo (WLANPushpins) ' Start of by Laidback 190604 'If ((CapFlags / 16) Mod 2) = 1 Then ' foundBSS.Symbol = WEPIcon ' foundBSS.MoveTo(WEPPushpins) 'Else ' foundBSS.Symbol = NonWEPIcon ' foundBSS.MoveTo(NonWEPPushpins) 'End if If useCustIcon then If (CapFlags Mod 2) = 1 Then if ((CapFlags / 16) Mod 2) = 1 Then foundBSS.Symbol = cSymbol1 foundBSS.MoveTo(WEPPushpins) Else foundBSS.Symbol = cSymbol2 foundBSS.MoveTo(NonWEPPushpins) end if Else if ((CapFlags / 2) Mod 2) = 1 Then if ((CapFlags / 16) Mod 2) = 1 Then foundBSS.Symbol = cSymbol3 foundBSS.MoveTo(pWEPPushpins) Else foundBSS.Symbol = cSymbol4 foundBSS.MoveTo(pNonWEPPushpins) End if End if End if Else If ((CapFlags / 16) Mod 2) = 1 Then foundBSS.Symbol = WEPIcon foundBSS.MoveTo(WEPPushpins) Else foundBSS.Symbol = NonWEPIcon foundBSS.MoveTo(NonWEPPushpins) End if End if End If ' End of by Laidback 190604 Dim Flags Flags = "" If (CapFlags Mod 2) = 1 Then Flags = Flags & "ESS " If ((CapFlags / 2) Mod 2) = 1 Then Flags = Flags & "IBSS " If ((CapFlags / 16) Mod 2) = 1 Then Flags = Flags & "WEP " foundBSS.Note = "SSID: " & SSID & vbCrLf & _ "BSSID: " & BSSID & vbCrLf & _ "CapFlags: " & Flags & " (" & Hex(CapFlags) & ")" & _ "SNR: " & MaxSNR Set newLocation = Nothing End If '20040426 End Sub ' Called when a scan cycle has completed (typically right before a new one starts). Sub OnScanComplete(FoundNew, SeenBefore, LostContact, BestSNR) ' FoundNew : Integer : Count of new BSSIDs ' SeenBefore : Integer : Count of not-new BSSIDs ' LostContact : Integer : Count of BSSIDs missed since last scan ' BestSNR : Integer : SNR of strongest signal (dBm) 'If UseSpeech And (New_SSIDs.Count > 0) Then 20040511 'smt 110604 If WriteTrack or dropCrumbs Then Strength = Fix(BestSNR / 10) End If 'end smt 110604 If UseSpeech Then '20040511 If (New_SSIDs.Count > 0) Then '20040511 Dim n, a n = New_SSIDs.Count a = New_SSIDs.Keys For i = 0 To n - 1 TTS.Speak a(i), SVSFlagsAsync Next New_SSIDs.RemoveAll ElseIf UseAudio Then If FoundNew > 0 Then PlaySound "ns-aos-new.WAV" ElseIf LostContact > 0 Then PlaySound "ns-los.WAV" ElseIf SeenBefore > 0 Then If UseSignalStr Then '20040426 ' Still seeing some If BestSNR >= 60 Then PlaySound "ns-signal-6.WAV" ElseIf BestSNR >= 50 Then PlaySound "ns-signal-5.WAV" ElseIf BestSNR >= 40 Then PlaySound "ns-signal-4.WAV" ElseIf BestSNR >= 30 Then PlaySound "ns-signal-3.WAV" ElseIf BestSNR >= 20 Then PlaySound "ns-signal-2.WAV" ElseIf BestSNR >= 10 Then PlaySound "ns-signal-1.WAV" Else PlaySound "ns-signal-0.WAV" End If End If '20040426 Else ' Nothing seen ' PlaySound "ns-tick.WAV" End If End If End If End Sub ' Start of by Laidback 030504 Sub UpdateCurrentLocation (thisLat, thisLon) lastLatTrack = FormatMP(thisLat) lastLonTrack = FormatMP(thisLon) On Error Resume Next Set CL = ActiveMap.GetLocation(FormatMP(thisLat), FormatMP(thisLon)) If Err.Number <> 0 Then Exit Sub ' Start of by Laidback 060704 If CentreVehicle then CL.GoTo() end if ' End of by Laidback 060704 End Sub 'smt 110604 Sub TrackDraw (thisLat, thisLon) Dim LL, NL, Track On Error Resume Next ' Bail out if we haven't moved. If thisLat = lastLat AND thisLon = lastLon Then Exit Sub ' Start of by Laidback 190604 If lastLat = "" AND lastLon = "" Then Exit Sub ' End of by Laidback 190604 ' Set NL to our current location Set NL = ActiveMap.GetLocation(FormatMP(thisLat), FormatMP(thisLon)) If Err.Number <> 0 Then Exit Sub ' Set LL to our last location Set LL = ActiveMap.GetLocation(FormatMP(lastLat), FormatMP(lastLon)) If Err.Number <> 0 Then Exit Sub ' draw a line between the two Set Track = ActiveMap.Shapes.AddLine(NL, LL) ' Set the properties of the line Track.Line.ForeColor = TrackColor(Strength) 'plot the trail in a color according to snr levels Track.Line.Weight = TrackWidth NL.GoTo If Err.Number <> 0 Then Exit Sub Set NL = Nothing Set LL = Nothing End Sub 'end smt 110604 Function FormatMP (thisCoord) FormatMP = FormatNumber(thisCoord, 5) End Function ' End of by Laidback 030504 ' Start of by Laidback 090504 Function Distance (Lat1, Lon1, Lat2, Lon2) Dim RLat1, RLon1, RLat2, RLon2, RDist, x if Lat1=Lat2 and Lon1=Lon2 then Distance = 0 exit function end if RLat1 = Radians(Lat1) RLon1 = Radians(Lon1) RLat2 = Radians(Lat2) RLon2 = Radians(Lon2) ' Distance = Sqr((Lat1 - Lat2) ^ 2 + ((Lon1 - Lon2) * 1.6172) ^ 2 ) * 225282 x = sin(RLat1) * sin(RLat2) + cos(RLat1) * cos(RLat2) * cos(RLon2 - RLon1) if (x = 0) then Rdist = 2 * atan(1) else Rdist = atn(sqr(1-x^2)/x) end if Distance = ABS(RadiusEarth * RDist) End Function Function Radians (Degrees) Radians = Degrees / 57.2958 End Function ' End of by Laidback 090504