cloudsoft / winrm4j

Apache License 2.0
94 stars 53 forks source link

Add support for enumeration (WQL)? #146

Open knalli opened 3 years ago

knalli commented 3 years ago

Hi,

as fas as I understand the used techniques correctly, the service interface WinRm is the central location for binding the entities respective service endpoints.

I'm unsure how easy it would be adding support for enumeration which is useful for executing WQL queries. Currently, the workaround via a PS command works. However, this requires the startup/instance of a (running) shell which is expensive (both runtime duration and actual cpu performance on the host). Am I too naive and there are some hidden difficulties except for the given five commands?

I've already started experimenting with this but struggling to gather the different api/soap/tokens correctly.

Sidenote: For an actual high-level/end-user solution, there should be a wrapper which merges the result. See also in WinRb/WinRM.

Do you think this a useful addition?

knalli commented 3 years ago

So far, I have a solution and testing it at the moment. Would like to make add this as a contribution, but maybe we should discuss some details. Preview here: https://github.com/hlsolutions/winrm4j/tree/feature/add_enumerate

AndrewDodd42 commented 2 years ago

@knalli I would like to use your work on WQL support and add it into my fork of winrm4j. Would you object to me preparing PRs from your code and submitting them to the origin project?

knalli commented 2 years ago

@AndrewDodd42 No, of course not. I'd wished more attention here, actually. :) I have waited for some feedback, but feel free. If you have some questions, feel free to come up.

We have this running for some time and are quite happy with it. The instrumentation of the underlaying CXF may need some improvements..

AndrewDodd42 commented 2 years ago

@knalli Great and it's good to know that the WQL code is working well. I'll get started with creating PRs for the smaller fixes that are in your fork and then look at the WQL changes.

I'll probably be back to ask more questions as I'm pretty new to GitHub. What is the best way to collaborate on these changes? Adding comments to this PR?

AndrewDodd42 commented 2 years ago

@knalli I've created a series of PRs that package up your smaller changes and modify them slightly to get them working against the latest upstream. I've also created a draft PR for the enumeration feature; this appears to work but I want to test it some more tomorrow.

The next stage after that is to attempt to create a PR that depends on both the enumeration and codepage changes and changes buildClient() to work with both of them.

knalli commented 2 years ago

Nice to hear. Just ping me.

chinaxushi commented 1 year ago

Has it been merged?

AndrewDodd42 commented 1 year ago

Has it been merged?

No, I'm not sure the original maintainers are active any longer.

I've put together the WQL changes that knalli made and a few other fixes and improvements in my fork at:- https://github.com/AndrewDodd42/winrm4j

knalli commented 1 year ago

Yeah, having also waiting for this. Besides this one, there is also an outstanding review/rework for a compatibility with Jakarta EE (at least since releases of Spring Boot v3 and Apache CXF v4). However, I'm not so in the CXF stuff and I must stopped end of last year. Do you have already progress in this topic?

Maybe we should think about a fork of the additional features?

chinaxushi commented 1 year ago

Has it been merged?

No, I'm not sure the original maintainers are active any longer.

I've put together the WQL changes that knalli made and a few other fixes and improvements in my fork at:- https://github.com/AndrewDodd42/winrm4j

Is it normal when I do the WQL query? The data here seems to return null, but according to the log, the number of returned items seems to be correct