-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to send stdin to running process. #72
Comments
Can you be more specific? What is the "running process"? A process triggered by winrm on the Maybe a specific use case would help. Thanks rustyscottweber wrote:
|
Specifically, I would like to send stdin to a process that was generated by win rm so that I can provide answers to the running process. |
I've specially been looking at the protocol object's _raw_get_command_output method to see if there was something there that would allow a string be sent to a process given a cmd id and console id. However, my knowledge of what is going on is quite limited. |
@rustyscottweber Looks like you are talking about Agree, it's nice to manage stdin/sdout remotely but this should be implemented in another library on top of pywinrm. IMO it's not in scope of pywinrm. ...but if someone would take this challenge and will ask for some changes in pywinrm - I would be happy to discuss. Closing for now. Feel free to re-open. |
I think you misunderstand. Currently, I am not attempting mirror the functionality of expect and pexpect in pywinrm. I am merely attempting to send input, preferably as a string, to a process that I am already managing remotely through pywinrm.
|
@rustyscottweber Oh. I see. Basically you just want to send predefined stdin to a process without any conditions and smart interactions, correct? I'm re-opening this issue since functionaliy is not yet present in pywinrm. Need to think about implementation. |
Yes. That is exactly what I would like to accomplish. However, my knowledge of Windows rpc xml is limited. It would make sense that the _raw_get_command_output's stream variable would also take a stdin parameter to send to the process, but this is Windows and being that easy is against the rules. |
http://www.rubydoc.info/github/WinRb/WinRM/WinRM/WinRMWebService#write_stdin-instance_method
How this translates in python is not yet clear to me however. |
For reference. |
What I currently have. However, this gives me
However, I get the following message returned and I'm confused as to it's meaning. <?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xml:lang="en-US">
<s:Header>
<a:Action>http://schemas.dmtf.org/wbem/wsman/1/wsman/fault</a:Action>
<a:MessageID>uuid:A49FC78A-BAFD-46CE-A0FC-706A7223A4E4</a:MessageID>
<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
<a:RelatesTo>uuid:880fc38b-d48b-4482-a841-6ba8b65b6164</a:RelatesTo>
</s:Header>
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Receiver</s:Value>
<s:Subcode>
<s:Value>w:InternalError</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">The data is invalid. </s:Text>
</s:Reason>
<s:Detail>
<f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="13" Machine="windows-host">
<f:Message>The data is invalid. </f:Message>
</f:WSManFault>
</s:Detail>
</s:Fault>
</s:Body>
</s:Envelope> |
well.. I have been stuck for a while on this and I'm still not sure on how to make stdin work... Any thoughts on implementation? |
@rustyscottweber Any update on this item? |
I got stuck on how exactly to format the XML.. Since there is no wsdl file to work from. I wasn't able to send a packet to winrm without it returning an XML error. |
Thanks for checking in. I was hoping there might be a way to do it as I needed it too. I'll post back if I can get it to work. This is definitely the most painful protocol I have ever seen. |
+1 |
Hey guys, This is what I currently have (inside protocol.py):
Most of the code is inspired by pywinrm's open_shell() and run_command() methods and https://msdn.microsoft.com/en-us/library/cc251742.aspx I have abused |
While digging around a bit further I found the following in Ansible's
|
Sorry for spamming this thread, but I discovered something. EDIT |
I don't speak for every one, but I for one don't mind spamming a thread so long as it is full of useful information. Let me take a look at what ansible has. Thank you for digging that up. |
Implemented with #271 |
I love what is here and would like to know more about this project to expand the capability of what pywinrm can do. Most importantly, I want to add the capability to send stdin to the running process. Can this be easily done? or is this impossible?
The text was updated successfully, but these errors were encountered: