help for sw in Visual basic

Take a script, leave a script - Like the penny tray only different

help for sw in Visual basic

Postby Zanardi » Tue Jul 18, 2006 8:40 am

Hi,
sorry for my english.
I write a software in Visual Basic and I need to have this information:
- SSID, (network name)
- BSSID, (MAC address)
- MaxSNR, (signal to noise ratio)

How can Netstumbler give these informations to my software?

I try to write a VBScript with AddItemContextMenu (as in the NetstumblerScriptingGuide) but I don't have success. Is this the right way?

I thank you in advance.
Zanardi
Mini Stumbler
 
Posts: 3
Joined: Wed Jul 05, 2006 1:10 am

Postby goldfndr » Tue Jul 18, 2006 7:02 pm

Zanardi wrote:Hi,
sorry for my english.
I write a software in Visual Basic and I need to have this information:
- SSID, (network name)
- BSSID, (MAC address)
- MaxSNR, (signal to noise ratio)

How can Netstumbler give these informations to my software?

I try to write a VBScript with AddItemContextMenu (as in the NetstumblerScriptingGuide) but I don't have success. Is this the right way?


Some questions for you.
  • Does an existing script serve your needs?
    The [thread=12512]Master script[/thread] tries to be the be-all, end-all of NetStumbler scripts and has several examples of how to use the events/data. Possibly a minor change would meet your needs]send a donation to the author[/url]) or a school project or otherwise need some different licensing.
  • What approaches have you tried so far?
    NetStumbler uses an event-driven model. In other words, when something happens in it, it calls your code. Your code doesn't call it. "Don't call us, we'll call you." So, to get the SSID/BSSID/MaxSNR, you'd probably use the OnScanResult function most of the time. And then there are questions like:
    • Are you only wanting information on a subset of SSIDs/BSSIDs, or all?
    • Did you want a maximum/minimum SNR, or a log/table of values?
    The AddItemContextMenu function only acts on a given network, it does act on the SSID/BSSID but you'd need to record the SNR using a different event.
And it probably goes without saying that a non-Hermes chipset, while it may give you interesting RSSI readings, won't give you reliable SNR readings.
I thank you in advance.

I hope you won't make me live up to my title. :D
goldfndr
 
Posts: 181
Joined: Sat Aug 28, 2004 3:30 am
Location: Bellevue, WA, USA

Postby Zanardi » Mon Jul 24, 2006 4:51 am

goldfndr wrote:Some questions for you.
  • Does an existing script serve your needs?
    The [thread=12512]Master script[/thread] tries to be the be-all, end-all of NetStumbler scripts and has several examples of how to use the events/data. Possibly a minor change would meet your needs]send a donation to the author[/url]) or a school project or otherwise need some different licensing.
  • What approaches have you tried so far?
    NetStumbler uses an event-driven model. In other words, when something happens in it, it calls your code. Your code doesn't call it. "Don't call us, we'll call you." So, to get the SSID/BSSID/MaxSNR, you'd probably use the OnScanResult function most of the time. And then there are questions like:
    • Are you only wanting information on a subset of SSIDs/BSSIDs, or all?
    • Did you want a maximum/minimum SNR, or a log/table of values?
    The AddItemContextMenu function only acts on a given network, it does act on the SSID/BSSID but you'd need to record the SNR using a different event.
And it probably goes without saying that a non-Hermes chipset, while it may give you interesting RSSI readings, won't give you reliable SNR readings.

I hope you won't make me live up to my title. :D



Ok :cool: , I download your Master script.
[My software is not commercial is only a personal project, bat if a day I’ll become millionaire I make you a big donation ;) ].

The approaches event-driven is for me ok:
If NetStumbler detect a new access point -> give the information of SSID/BSSID/MaxSNR to my Vbproject

If possible I wont ALL the SSIDs/BSSIDs that are connecting to the pc at the moment.

I think that is sufficient that the script write the information in a text file (I download and modify your first version of Master Script):
****************************************

'create file:

Dim OggFile, origine, OggTextStream
origine="G:\Programmi\…\…\Test.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile (origine)
Set OggFile = fso.GetFile (origine)
Set OggTextStream = OggFile.OpenAsTextStream(2)


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

' write information:
OggTextStream.WriteLine "File with the information"
OggTextStream.WriteLine
OggTextStream.WriteLine SSID


If UseSpeech And Not Spoken_BSSIDs.Exists(BSSID) Then
' TTS.Speak SSID, SVSFlagsAsync
New_SSIDs.Item(SSID) = 1
Spoken_BSSIDs.Item(BSSID) = LastSeen ' Could check and see if it's been a long
time, play again
End If
End Sub


OggTextStream.close

****************************************

There is an alternative method to have all the Access Points (currently connected) informations?

Thanks for the time :)
Zanardi
Mini Stumbler
 
Posts: 3
Joined: Wed Jul 05, 2006 1:10 am

Postby goldfndr » Mon Jul 24, 2006 6:07 pm

Your code looks mostly valid (except that "OggTextStream.Close" at the end - anything not in a subroutine/function is executed immediately). It raises some questions for me:
  • What is "Ogg" in front of your variables? I'm guessing nothing to do with Xiph. Just curious...
  • Were you pleased with the results of your code?

[Quote=Zanardi]If NetStumbler detect a new access point -> give the information of SSID/BSSID/MaxSNR[/quote]Of course, one can only get MaxSNR by gathering samples and either rewriting or post-processing - the first sample might not be the Max. I'm guessing you're trying to use the New_SSIDs/Spoken_SSIDs dictionary to track what's been captured, but you'll need a lot more code than that.

And you'd be wise to state your plan for MaxSNR in your next reply, otherwise the moderators might get tired of toothpulling and close this thread - the core issue is whether you want a bunch of different SNR values for each SSID (i.e. postprocess) or just one calculated value for each SSID (cache and rewrite).

to my Vbproject

From what you've described, there isn't yet a need to go to "Visual Basic" - all can be done in VBscript.

[Quote=Zanardi]If possible I wont ALL the SSIDs/BSSIDs that are connecting to the pc at the moment[/Quote]
NetStumbler is not a connection manager, it is a wireless auditing tool. If you are trying to simultaneously connect AND monitor, you will get bad results. Maybe instead of "connecting to" you meant "observed by"?

[Quote=Zanardi]if a day I’ll become millionaire I make you a big donation ;)[/Quote]
Any donations pertaining to NetStumbler go to Marius. I do scripting/programming/wardriving as fun hobbies.
goldfndr
 
Posts: 181
Joined: Sat Aug 28, 2004 3:30 am
Location: Bellevue, WA, USA

errata

Postby Zanardi » Fri Aug 04, 2006 3:20 am

goldfndr wrote:Your code looks mostly valid (except that "OggTextStream.Close" at the end - anything not in a subroutine/function is executed immediately). It raises some questions for me:
  • What is "Ogg" in front of your variables? I'm guessing nothing to do with Xiph. Just curious...
  • Were you pleased with the results of your code?



  • Is only a name, nothing to do whith Xiph
  • In effect no. The code run, bat when i open in my Visual Basic program the file I have a problem because I don't close the file in my VBScript, the right code is:

    ...
    ...
    ...
    'create file, open file, write first line, close file
    Dim OggFile, origine, OggTextStream
    origine="D:\...\...\Test.txt"
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.CreateTextFile (origine)
    Set OggFile = fso.GetFile (origine)
    Set OggTextStream = OggFile.OpenAsTextStream(2)
    OggTextStream.WriteLine "Information about AP:"
    OggTextStream.close
    ...
    ...
    ...
    Sub OnScanResult(SSID, BSSID, CapFlags, Signal, Noise, LastSeen)
    'open file, write information, close file
    Set OggTextStream = OggFile.OpenAsTextStream(8)
    OggTextStream.WriteLine "SSID:" & SSID & " BSSID:" & BSSID & " CapFlags:" & CapFlags & "

    Signal:" & Signal & " Noise:" & Noise
    OggTextStream.close
    End Sub
    ...
    ...
    ...
    Sub OnScanComplete(FoundNew, SeenBefore, LostContact, BestSNR)
    'open file, write other information, close file
    Set OggTextStream = OggFile.OpenAsTextStream(8)
    OggTextStream.WriteLine "OnScanCompelte:" & FoundNew & "," & SeenBefore & "," & LostContact &

    "," & BestSNR
    OggTextStream.close
    End Sub
    ...
    ...
    ...

    You have got reason, there was an error whith 'OggTextStream.Close' :rolleyes:


NetStumbler is not a connection manager, it is a wireless auditing tool. If you are trying to simultaneously connect AND monitor, you will get bad results. Maybe instead of "connecting to" you meant "observed by"?


Thank you for the precisation.
Zanardi
Mini Stumbler
 
Posts: 3
Joined: Wed Jul 05, 2006 1:10 am


Return to Scripts

Who is online

Users browsing this forum: No registered users and 9 guests