How do I remotely obtain a system's network shares and connections?

♀尐吖头ヾ 提交于 2019-12-12 09:45:58

问题


I'm looking for a way to obtain information similar to the following console applications, remotely:

  • net use
  • net share
  • netstat -ano

However, I need to be able to do this without running a 3rd party application on the system. This effectively rules out using psexec to execute the command remotely, because psexec would then be installed as a service.

I should add that I have administrative credentials on the remote system. I've considered using WMI's remote execution ability, but that requires me to write output to a file and then retrieve it. It's possible, but I'd like to know if anyone has a better way.

I am using Delphi 2010.


回答1:


there are a couple Delphi WMI components that allow remote access. I have not used the remote options personally though.

MagWmi - http://www.magsys.co.uk/delphi/magwmi.asp (Delphi 2010 support, and free with source)

WMISet/NTSet - http://www.online-admin.com/ntset.html (TNTShare Manages shared resources on a local computer and remote hosts. Using this component you can change list of shared devices, see files that have been opened by remote users, watch and terminate remote sessions opened to the destination computer, change list of mapped network drives. It is not free.)

GLibWMI - Found at Torry.net, home page not available. (Delphi 2010 support and Freeware with source). Not sure if its capable of remote access. I have not used it.

Hope this helps




回答2:


I think the same as Logman.
You can access this information using WMI.

GLibWMI components can be found on this website (http://neftali.clubdelphi.com) or sourceforge (http://sourceforge.net/projects/glibwmi/).
The current version is 1.8b and has a component called SharedInfo with which you can get that information.
The source code is available so you can expand it to access other WMI classes if necessary.

Regards.
P.D: Sorry for my mistakes with english.




回答3:


You can enumerate shares using the NetShareEnum function (headers are in the Jedi Apilib).

I assume there must be an api for the "net use" but I have never used it (check the WNet functions). Alternative is to use the EnumNetworkDrives method of the WshNetwork com object.

As for netstat I don't think it's possible to do that remotely (other than using some kind of method to spawn a process remotely).



来源:https://stackoverflow.com/questions/2700381/how-do-i-remotely-obtain-a-systems-network-shares-and-connections

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!