1

使用 python pywinos 包,同时使用下面的代码得到错误

from pywinos import WinOSClient
tool = WinOSClient( logger_enabled=False)
response = tool.run_cmd(command='whoami')

错误:

     File "C:\Workspace\GOVScript\envgovscript\lib\site-packages\winrm\__init__.py", line 33, 
     in __init__
           match = re.match(
           File "C:\ProgramFiles\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2288.0_x64__qbz5n2kfra8p0\lib\re.py", line 191, in match
     return _compile(pattern, flags).match(string)
     TypeError: expected string or bytes-like object

和:

tool = WinOSClient(host='127.0.0.1', logger_enabled=False)
response = tool.run_cmd(command='whoami')

错误:

    self.transport = Transport(
  File "C:\Workspace\GOVScript\envgovscript\lib\site-packages\winrm\transport.py", line 154, in __init__       
    raise InvalidCredentialsError("auth method %s requires a username" % self.auth_method)
winrm.exceptions.InvalidCredentialsError: auth method plaintext requires a username
4

0 回答 0