Click here to Skip to main content
15,903,684 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm writing an Local Network Scanner where I'm resolving the Hostname, Mac - Address and wether it supports a web interface. Now I want to check from which manufacturer the device was made, using the Mac - Address and a webdatabase...

The web database is: https://gitlab.com/wireshark/wireshark/raw/master/manuf

For this case I want to download the File and create a DataTable with two columns: Mac Address - Manufacturer

But I'm not able to find the right code to do this

Can anyone help me?

P.S. Sry for my bad english xD

What I have tried:

I searched on the Internet but only found ways to find for specific strings and use them from an website
Posted
Updated 11-Dec-20 4:34am

Seems fairly simple:
VB.NET
Shared Async Function LoadMap() As Task(Of DataTable)
    Const url As String = "https://gitlab.com/wireshark/wireshark/raw/master/manuf"
    
    Dim result As New DataTable()
    result.Columns.Add("MacAddress", GetType(String))
    result.Columns.Add("Manufacturer", GetType(String))
    
    Dim http As New HttpClient()
    Using response As HttpResponseMessage = Await http.GetAsync(url)
        response.EnsureSuccessStatusCode()
        
        Using stream As Stream = Await response.Content.ReadAsStreamAsync()
            Using reader As New StreamReader(stream)
                Dim line As String = reader.ReadLine()
                While line IsNot Nothing
                    If line.Length <> 0 AndAlso line(0) <> "#"c Then
                        Dim parts As String() = line.Split(Microsoft.VisualBasic.Constants.vbTab)
                        result.Rows.Add(parts(0), parts(1))
                    End If
                    
                    line = reader.ReadLine()
                End While
            End Using
        End Using
    End Using
    
    Return result
End Function
 
Share this answer
 
Comments
Richard Deeming 11-Dec-20 12:05pm    
Electro_Attacks 11-Dec-20 12:06pm    
Yeah, I got it, Thx a lot :)
Electro_Attacks 11-Dec-20 14:00pm    
You don't happen to have an idea how I can test whether the IP address has shared folders and what their names are, do you?
Richard Deeming 14-Dec-20 3:25am    
That doesn't sound like it's anything to do with this question?
Electro_Attacks 25-Dec-20 14:12pm    
Kindof, it would be in the same process of collecting data from an IP Address... But I don't have anything for it either...
So do: download the file an look at the content.
It seems pretty simple: line based, with a "#" indicatign a comment line.
Data lines are simple as well: MAC range, whitespace, short name, whitespace long name.

So read the file line by line, discard blank and comment lines, and use string.Split to break the rest up.

This isn't complicated, so stop looking for unlikely ready-made solutions, and write your own code - it's unlikely to be more than a dozen lines, even in VB ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900