Another quick COM Object to close out the decade

Started by stanl, December 30, 2019, 12:38:44 PM

Previous topic - Next topic

stanl

Code (WINBATCH) Select


;Winbatch 2019B - Enumerate Plug and Play
;Stan Littlefield December 30,2019
;=============================================================================
Oupnp = CreateObject('UPnP.UPnPDeviceFinder')
BoxOpen("Please Wait","Enumerating Plug and Play Devices")
devices = oupnp.FindByType("upnp:rootdevice", 0)


output=""
ForEach d in devices
   output=output:d.ModelName:" ":d.FriendlyName:" ":d.PresentationUrl:@LF
Next


BoxText("Devices":@LF:output)
Oupnp=0
TimeDelay(5)


Exit

snowsnowsnow

Of course, a true pedant would point out that the 3rd decade of the 21st century doesn't start until a year from tomorrow.

stanl

Quote from: snowsnowsnow on December 31, 2019, 07:44:57 AM
Of course, a true pedant would point out that the 3rd decade of the 21st century doesn't start until a year from tomorrow.


But according to Barbara Walters..   "This is 20/20"


and according to Google UPnP should be disabled as it is a security risk and your script is worthless.  Having received an email from Wyze about their database being hacked I was curious if our house cameras would show up when the script was run. They didn't and neither did the Honeywell Thermostat.

stanl

I made a slight change FindByType("ssdp:all", 0) rather than FindByType("upnp:rootdevice", 0) and it appeared to duplicate 1 or 2 times the root devices. So, I further looked at the HasChildren property - my Router does, my Roku devices don't. Any suggestions how I might find out about the children
Code (WINBATCH) Select


;Winbatch 2019B - Enumerate Plug and Play
;Stan Littlefield December 30,2019
;=============================================================================
Oupnp = CreateObject('UPnP.UPnPDeviceFinder')
BoxOpen("Please Wait","Enumerating Plug and Play Devices")
;devices = oupnp.FindByType("upnp:rootdevice", 0)
devices = oupnp.FindByType("ssdp:all", 0)


output=""
ForEach d in devices
   ch=d.HasChildren
   If ch==-1
     ch="has children"
   Else
    ch="no children"
   Endif
   output=output:d.ModelName:" ":d.FriendlyName:" ":d.PresentationUrl:" ":ch:@LF
Next


BoxText("Devices":@LF:output)
Oupnp=0
TimeDelay(5)


Exit

td

Other than the usual paranoia about IoT devices and a predilection to avoid them when possible and neuter them when it is not, I am not all that familiar with MSFT's take on the implementation of a UPnP query protocol.   About the only thing I can suggest is a look at the API documentation if you haven't already. 

https://docs.microsoft.com/en-us/windows/win32/api/_upnp/
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

I believe I addressed the concerns/paranoia in an earlier post. I think if the Object has children and the children or services is System.__ComObject then the children are a COM array but you have to invoke another function FindByUDN()... and that is pointless. Finding the root devices is enough. Since my Wyze cameras are PlugnPlay but not recognized I feel a little better - even though my email and router type were part of the recent hack.










[/size]
[/size]

td

Not sure what previous post you are referring to.  I probably missed the obvious someplace along the way.  I guess my paranoia with regards to IoT is mostly related to things other than hacking although hacking is a legitimate concern.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade