0

I'm looking for how to recorgnize some server (windows in my case) network configuration (information we obtain using netstat dos command).

  I have the login and password of the target (server), and I developp with visual studio 2005 (c# or vB.NET doesn't matter).

  (Can I use WMI for that ???)

Regards,

bidak
  • 21
  • 7

2 Answers2

0

Have a look at this SO:

How can I access netstat-like Ethernet statistics from a Windows program

And of course ou can remotely access the WMI of a remote server; just make sure the corresponding services are not disabled and running on the target machine.

Community
  • 1
  • 1
Andreas
  • 3,929
  • 2
  • 25
  • 22
  • thanks Andreas, now I can connect to remote computer, but I'm lost in wmi, it's the first time I use wmi (withc script to display all existing connection ip + open port) thanks in advance – bidak Jun 28 '10 at 14:58
  • You will get data from WMI by executing queries against it. maybe you will find the following tool (done by Microsoft) useful: http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en Also have a look at the classes in the System.Management namespace. – Andreas Jun 28 '10 at 15:10
  • even with this tool, I don't find the solution yet , it will be greet if someone help, no example found on the internet ! – bidak Jun 29 '10 at 10:08
  • After a quick investigation, I cannot find any helpful WMI classes in your case. As it seems, they are useful to display performance statistics ans so on. But not for displaying the active connections, programs and all the stuff netstat does. So next approach would be to remotely invoke netstat and grab the output. – Andreas Jun 29 '10 at 15:14
  • thanks for your reply and help, apparently it's impossible (see : http://www.tek-tips.com/viewthread.cfm?qid=1220505) Like you said try to remotly invoke netstat and get the result : ManagementClass processClass = new ManagementClass("Win32_Process"); ManagementBaseObject inParams = processClass.GetMethodParameters("Create"); inParams["CommandLine"] = "netstat.exe"; ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams,null); string netstatResult = outParams["returnValue"].ToString(); but dosn't work – bidak Jun 29 '10 at 15:58
  • The problem is, that it is not the return value of netstat that you want to capture, but its output. I've searched through the web and all I could find were some approaches using a bat file redirecting the program's output. If you can manage file transfer, have a look here: http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx?msg=3046341 – Andreas Jun 29 '10 at 21:21
  • Hi Andreas, I tried this approach but also not working, right now I test with PsExec tool, it's working but very slow, I'm looking to optimize it or find an other similar tool more faster – bidak Jun 30 '10 at 13:29
  • Be aware of PsExec reported as a false positive trojan by some Virus Scanners. Besides, it seems that it is the only possibility for you at the moment. Hopefully WMI gets pimped with the necessary information some time. – Andreas Jun 30 '10 at 15:51
  • there is also another utility smaller and faster than PSExec : RemCom , but I still hope there is another approch using .NET framework – bidak Jul 01 '10 at 08:42
  • there is also another utility smaller and faster than PSExec : RemCom, but I still hope there is another approch using .NET framework – bidak Oct 07 '10 at 08:40
0

there is also another utility smaller and faster than PSExec : RemCom, but I still hope there is another approch using .NET framework

bidak
  • 21
  • 7