Announcement

Collapse
No announcement yet.

Getting stats from wireless card

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting stats from wireless card

    I didn't see this covered in any depth so far, so here goes...

    What I'm looking to do is get a list of detected access points from the wireless card and then attempt connection to the ones that are not encrypted. If an ip address is assigned by that AP then do an event. Such as play a sound, popup a box, etc.

    I haven't found anything on this specifically from searching google. I'm thinking it may come down to trying to get objects from the cards drivers and approach it that way.

    Anyone have any thoughts on doing that?

    Thanks,
    James

  • #2
    I'm currently on the same hunt...

    I'll let you know if I come up with anything clever.

    Comment


    • #3
      Language?
      --------------------------
      Software Developed:
      DS-ATX Controller Interface
      Laptop Shutdown Controller

      Considered Projects:
      TPMS Interface
      Bluetooth Handsfree Interface (WIDCOMM/BROADCOMM)

      Comment


      • #4
        The app is written in VB6, but I'm porting it to .NET, so either is fine with me if you have any info

        Comment


        • #5
          Here is a little bit of VB.NET code I wrote a while ago to list the available SSID's. This only worked once Windows Wireless Config had picked up the list of networks though, so not sure how much help it will be.

          Code:
          Imports System.Management
          Imports System.Text
          Imports System.IO
          
          
          Public Class Form1
              Inherits System.Windows.Forms.Form
          
          #Region " Windows Form Designer generated code "
          
              Public Sub New()
                  MyBase.New()
          
                  'This call is required by the Windows Form Designer.
                  InitializeComponent()
          
                  'Add any initialization after the InitializeComponent() call
          
              End Sub
          
              'Form overrides dispose to clean up the component list.
              Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
                  If disposing Then
                      If Not (components Is Nothing) Then
                          components.Dispose()
                      End If
                  End If
                  MyBase.Dispose(disposing)
              End Sub
          
              'Required by the Windows Form Designer
              Private components As System.ComponentModel.IContainer
          
              'NOTE: The following procedure is required by the Windows Form Designer
              'It can be modified using the Windows Form Designer.  
              'Do not modify it using the code editor.
              Friend WithEvents lblHomeNetwork As System.Windows.Forms.Label
              Friend WithEvents lblAvailable As System.Windows.Forms.Label
              Friend WithEvents btnSearch As System.Windows.Forms.Button
              Friend WithEvents lstAvailable As System.Windows.Forms.ListBox
              Friend WithEvents txtHome As System.Windows.Forms.TextBox
              Friend WithEvents statusBar As System.Windows.Forms.StatusBar
              <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
                  Me.lstAvailable = New System.Windows.Forms.ListBox
                  Me.txtHome = New System.Windows.Forms.TextBox
                  Me.lblHomeNetwork = New System.Windows.Forms.Label
                  Me.lblAvailable = New System.Windows.Forms.Label
                  Me.btnSearch = New System.Windows.Forms.Button
                  Me.statusBar = New System.Windows.Forms.StatusBar
                  Me.SuspendLayout()
                  '
                  'lstAvailable
                  '
                  Me.lstAvailable.ItemHeight = 16
                  Me.lstAvailable.Location = New System.Drawing.Point(12, 88)
                  Me.lstAvailable.Name = "lstAvailable"
                  Me.lstAvailable.Size = New System.Drawing.Size(219, 100)
                  Me.lstAvailable.TabIndex = 0
                  '
                  'txtHome
                  '
                  Me.txtHome.Location = New System.Drawing.Point(12, 40)
                  Me.txtHome.Name = "txtHome"
                  Me.txtHome.Size = New System.Drawing.Size(219, 22)
                  Me.txtHome.TabIndex = 1
                  Me.txtHome.Text = ""
                  '
                  'lblHomeNetwork
                  '
                  Me.lblHomeNetwork.Location = New System.Drawing.Point(12, 19)
                  Me.lblHomeNetwork.Name = "lblHomeNetwork"
                  Me.lblHomeNetwork.Size = New System.Drawing.Size(219, 19)
                  Me.lblHomeNetwork.TabIndex = 2
                  Me.lblHomeNetwork.Text = "Home Network:"
                  '
                  'lblAvailable
                  '
                  Me.lblAvailable.Location = New System.Drawing.Point(12, 68)
                  Me.lblAvailable.Name = "lblAvailable"
                  Me.lblAvailable.Size = New System.Drawing.Size(219, 19)
                  Me.lblAvailable.TabIndex = 3
                  Me.lblAvailable.Text = "Available Networks:"
                  '
                  'btnSearch
                  '
                  Me.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.System
                  Me.btnSearch.Location = New System.Drawing.Point(68, 196)
                  Me.btnSearch.Name = "btnSearch"
                  Me.btnSearch.Size = New System.Drawing.Size(107, 31)
                  Me.btnSearch.TabIndex = 4
                  Me.btnSearch.Text = "Search"
                  '
                  'statusBar
                  '
                  Me.statusBar.Location = New System.Drawing.Point(0, 244)
                  Me.statusBar.Name = "statusBar"
                  Me.statusBar.Size = New System.Drawing.Size(245, 22)
                  Me.statusBar.TabIndex = 5
                  '
                  'Form1
                  '
                  Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
                  Me.ClientSize = New System.Drawing.Size(245, 266)
                  Me.Controls.Add(Me.statusBar)
                  Me.Controls.Add(Me.btnSearch)
                  Me.Controls.Add(Me.lblAvailable)
                  Me.Controls.Add(Me.lblHomeNetwork)
                  Me.Controls.Add(Me.txtHome)
                  Me.Controls.Add(Me.lstAvailable)
                  Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
                  Me.MaximizeBox = False
                  Me.Name = "Form1"
                  Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide
                  Me.Text = "WirelessMan"
                  Me.ResumeLayout(False)
          
              End Sub
          
          #End Region
          
              Dim bFoundNetworks As Boolean = False
          
              Private Sub SearchNetworks()
                  lstAvailable.Items.Clear()
                  lstAvailable.Items.Add("Searching...")
          
                  Try
                      Dim query As String = "SELECT * FROM MSNDis_80211_BSSIList WHERE Active='True'"
                      Dim searcher As ManagementObjectSearcher = _
                           New ManagementObjectSearcher("root/WMI", query)
                      Dim moc As ManagementObjectCollection = searcher.Get()
          
                      Dim moe As ManagementObjectCollection.ManagementObjectEnumerator = moc.GetEnumerator()
                      moe.MoveNext()
                      Dim objarr() As ManagementBaseObject = CType(moe.Current.Properties("Ndis80211BSSIList").Value, ManagementBaseObject())
          
                      lstAvailable.Items.Clear()
                      For Each obj As ManagementBaseObject In objarr
                          bFoundNetworks = True
                          Dim ssid() As Char = Encoding.ASCII.GetChars(CType(obj("Ndis80211Ssid"), Byte()))
                          lstAvailable.Items.Add(New String(ssid))
                      Next
                      If lstAvailable.Items.Count = 0 Then
                          lstAvailable.Items.Add("No networks found!")
                      End If
                  Catch ex As ManagementException
                      ' Wireless device disabled
                      lstAvailable.Items.Clear()
                      lstAvailable.Items.Add("Wireless device disabled!")
                  Catch ex As System.NullReferenceException
                      ' Windows hasnt searched for wireless networks yet
                      bFoundNetworks = False
                      lstAvailable.Items.Add("Windows must search...")
                  End Try
          
              End Sub
          
              Private Sub CheckShare(ByVal strPath As String)
          
                  'Inherits System.IO.FileSystemInfo
          
                  Dim mobjFileInfo As FileInfo
                  Dim mobjDirectoryInfo As DirectoryInfo
                  Dim mblnIsDirectory As Boolean = True
                  Try
                      mobjDirectoryInfo = New DirectoryInfo(strPath)
          
                  Catch ex As Exception
                      Console.WriteLine(ex.ToString())
                  End Try
          
                  If mobjDirectoryInfo.Exists Then
                      MsgBox("share exists!")
                  Else
                      MsgBox("share doesnt exist!")
                  End If
          
          
          
              End Sub
          
              Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                  txtHome.Text = "Please select a network..."
                  'SearchNetworks()
                  CheckShare("c:\Mp3")
                  CheckShare("\\Terabyte\200gb (c)\MP3")
              End Sub
          
              Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
                  SearchNetworks()
              End Sub
          
              Private Sub lstAvailable_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstAvailable.SelectedIndexChanged
                  If (bFoundNetworks) Then
                      txtHome.Text = lstAvailable.Items.Item(lstAvailable.SelectedIndex)
                  End If
              End Sub
          End Class
          Jarrod - Holden VX S!

          Comment


          • #6
            I found this control for .NET to detect wireless networks, but it was designed for the compact framework. You might want to look into it.

            http://www.pocketpcdn.com/libraries/...perceptor.html
            --------------------------
            Software Developed:
            DS-ATX Controller Interface
            Laptop Shutdown Controller

            Considered Projects:
            TPMS Interface
            Bluetooth Handsfree Interface (WIDCOMM/BROADCOMM)

            Comment

            Working...
            X