viewpoint-particle

Author Topic: Another quick COM Object to close out the decade  (Read 135 times)

stanl

  • Pundit
  • *****
  • Posts: 970
Another quick COM Object to close out the decade
« on: December 30, 2019, 12:38:44 pm »
Code: Winbatch

;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

  • Sr. Member
  • ****
  • Posts: 284
Re: Another quick COM Object to close out the decade
« Reply #1 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.

stanl

  • Pundit
  • *****
  • Posts: 970
Re: Another quick COM Object to close out the decade
« Reply #2 on: December 31, 2019, 12:27:56 pm »
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

  • Pundit
  • *****
  • Posts: 970
Re: Another quick COM Object to close out the decade
« Reply #3 on: January 04, 2020, 09:21:21 am »
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

;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

  • Tech Support
  • *****
  • Posts: 3150
    • WinBatch
Re: Another quick COM Object to close out the decade
« Reply #4 on: January 04, 2020, 10:41:03 am »
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

  • Pundit
  • *****
  • Posts: 970
Re: Another quick COM Object to close out the decade
« Reply #5 on: January 04, 2020, 11:06:19 am »
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][/color]
[/size][/color]

td

  • Tech Support
  • *****
  • Posts: 3150
    • WinBatch
Re: Another quick COM Object to close out the decade
« Reply #6 on: January 05, 2020, 09:23:08 am »
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