Skip to content

client.CreateShell() does not detect any errors returned by windows #176

@anurag5sh

Description

@anurag5sh

This is an example response when CreateShell() is called, here no Shell Id is in the message.

<s:Envelope xml:lang="en-US"
	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">
	<s:Header>
		<a:Action>http://schemas.dmtf.org/wbem/wsman/1/wsman/fault
		</a:Ac
tion>
		<a:MessageID>uuid:0A888267-33ED-4F08-98E6-DDEBDE2067DE</a:MessageID>
		<a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
		<a:RelatesTo>uuid:1893210b-91a7-45dc-aa90-b0c42e0dd740</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">Illegal operation attempted on a registry key that has been marked for deletion. </s:Text>
			</s:Reason>
			<s:Detail>
				<f:WSManFault
					xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2147943418" Machine="34.134.189.249">
					<f:Message>
						<f:ProviderFault provider="Shell cmd plugin" path="%!s(MISSING)ystemroot%!\(MISSING)system32\winrscmd.dll">Illegal operation attempted on a registry key that has been marked for deletion. </f:ProviderFault>
					</f:Message>
				</f:WSManFault>
			</s:Detail>
		</s:Fault>
	</s:Body>
</s:Envelope>

CreateShell doesn’t parse the error in the response returned by Windows. This can be misleading and can cause issues assuming the shell got created. In my code I use client.CreateShell() to get an instance of shell and then run Execute(). This doesn’t really return any sort of error which is causing issues in the workflow.
Ideally the error should be caught when CreateShell is called. I think this can be improved.

Although in Execute() there's checks to see if shell id is empty, but this error is not really returned. Instead its assigned to err in Command struct (command.go) which is a private field and there's no way currently to access it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions