The cross-platform tool to execute PowerShell and command line remotely.
Project description
PyWinOS
The cross-platform tool to work with remote Windows OS.
PyWinOS uses the Windows Remote Manager (WinRM) service. It can establish connection to a remote server based on Windows OS and execute commands:
- PowerShell
- Command line
- WMI.
For more information on WinRM, please visit Microsoft’s WinRM site It based on pywinrm.
PyWinOS returns object with exit code, sent command, stdout/sdtderr response.
Installation
For most users, the recommended method to install is via pip:
pip install PyWinOS
Import
from pywinos import WinOSClient
Usage
PowerShell:
from pywinos import WinOSClient
tool = WinOSClient('172.16.0.126', 'administrator', 'P@ssw0rd')
response = tool.run_cmd('$PSVersionTable.PSVersion')
print(response)
# ResponseParser(response=(0, 'Major Minor Build Revision\r\n----- ----- ----- --------\r\n5 1 17763 592', None, '$PSVersionTable.PSVersion'))
print(response.exited) # 0
print(response.stdout)
# Major Minor Build Revision
# ----- ----- ----- --------
# 5 1 17763 592
print(response.stderr) # None
print(response.ok) # True
Command line:
from pywinos import WinOSClient
tool = WinOSClient('172.16.0.126', 'administrator', 'P@ssw0rd')
response = tool.run_cmd('whoami')
print(response) # ResponseParser(response=(0, 'test-vm1\\administrator', None, 'whoami'))
print(response.exited) # 0
print(response.stdout) # test-vm1\administrator
print(response.stderr) # None
print(response.ok) # True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pywinos-1.0.0rc1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for pywinos-1.0.0rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a384f4d0c063d62ede6e223b97c6e60933855e7cd773d00f1f555b66e09916b |
|
MD5 | da2942fcffcd6973eaeca7047837815c |
|
BLAKE2b-256 | 3fa223a62e69da658bd8392135e1b658aa3c76fd0dd4d31f7d5fd35247fa2c7e |