DylanPiercey / local-devices

🔮 Find devices connected to the current local network.
MIT License
139 stars 27 forks source link

Get device's name #21

Open fishfitz opened 4 years ago

fishfitz commented 4 years ago

My use case is the following: I'm trying to auto-detect my camera when it is connected to the local network. Working from a w10 computer.

In my physical router interface, I can see it displayed over the name of LUMIX, which is something I could definitely work with.

But when I run the package, the only name I get is "?". Actually in none of the examples I can find in this repository's issues a device name is ever shown. Why?

Is there a way to retrieve the LUMIX name somehow, so I can auto-select it? Any suggestion about that?

Thanks you very much,

natterstefan commented 4 years ago

Hi @cobaltway, I am sorry I haven't helped you yet. Have you figured it out in the meantime?

Miosame commented 4 years ago

@cobaltway just note down your camera mac-address instead and search for it.

fishfitz commented 4 years ago

I was not able to find anything for now.

@Miosame Sure your solution may work for my precise device. It is far from ideal to automatically detect a new camera on the network by the way. But it may be not possible.

Miosame commented 4 years ago

@cobaltway the issue is that a lot of devices don't report a host name to others, besides to the router via dhcp.

I've tried plenty of solutions like arp, nmap, smb-tools,.. all couldn't get a host name most of the time.

A hacky solution but which would work is to write a wrapper for your router dashboard and read out the host names there.

Another could be to run your own dhcp server similar to how pihole handles it.

And the final would be to just discover all devices that are available via this module and then go through those detecting which of them gives a webcam feed (assuming your webcams are IPcams).

fishfitz commented 4 years ago

I'll probably go for the last solution. My cams have a very specific API that could be used to detect wether or not the device is compatible. Nice idea.

natterstefan commented 4 years ago

Hi @cobaltway, hi @Miosame,

thanks for supporting each other and I want to apologize for the delayed response.

Does the solution work for you @cobaltway?

jpolstre commented 4 years ago

I found this package in npm: https://www.npmjs.com/package/network-list It seems to do what you need (it shows the names of the computers too), but it also shows an error which does not affect the result. Test and write if it gave you the desired result

doc-han commented 3 years ago

Device names can be retrieved using an NSLOOKUP. So when you have a list of ip addresses for the local devices. The command nslookup IP_HERE will return the name of the connected device. example below


C:\Users\Han\Desktop\file-sharer\server>nslookup 192.168.43.84
Server:  UnKnown
Address:  192.168.43.1

Name:    DESKTOP-K5ENA7C
Address:  192.168.43.84

C:\Users\Han\Desktop\file-sharer\server>
fukemy commented 10 months ago

any solution please