pypsrp 0.8.1__tar.gz → 0.9.0rc2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/CHANGELOG.md +17 -1
  2. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/PKG-INFO +74 -30
  3. pypsrp-0.8.1/src/pypsrp.egg-info/PKG-INFO → pypsrp-0.9.0rc2/README.md +42 -40
  4. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/build_helpers/lib.sh +7 -20
  5. pypsrp-0.9.0rc2/build_helpers/win-setup.ps1 +432 -0
  6. pypsrp-0.9.0rc2/pyproject.toml +110 -0
  7. pypsrp-0.9.0rc2/setup.cfg +4 -0
  8. pypsrp-0.9.0rc2/src/pypsrp/_pool_manager.py +142 -0
  9. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/_utils.py +0 -1
  10. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/client.py +0 -1
  11. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/complex_objects.py +3 -3
  12. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/encryption.py +0 -1
  13. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/messages.py +3 -2
  14. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/negotiate.py +5 -8
  15. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/powershell.py +109 -8
  16. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/serializer.py +21 -18
  17. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/shell.py +41 -3
  18. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/wsman.py +118 -40
  19. pypsrp-0.8.1/README.md → pypsrp-0.9.0rc2/src/pypsrp.egg-info/PKG-INFO +84 -15
  20. pypsrp-0.9.0rc2/src/pypsrp.egg-info/SOURCES.txt +118 -0
  21. pypsrp-0.9.0rc2/src/pypsrp.egg-info/requires.txt +25 -0
  22. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/conftest.py +12 -3
  23. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/_template.yml +1 -0
  24. pypsrp-0.9.0rc2/tests/tests_pypsrp/responses/test_psrp_is_alive_http_error.yml +12 -0
  25. pypsrp-0.9.0rc2/tests/tests_pypsrp/responses/test_psrp_is_alive_invalid_selectors.yml +14 -0
  26. pypsrp-0.9.0rc2/tests/tests_pypsrp/responses/test_psrp_is_alive_other_wsman_error.yml +14 -0
  27. pypsrp-0.9.0rc2/tests/tests_pypsrp/responses/test_psrp_is_alive_state_disconnected.yml +11 -0
  28. pypsrp-0.9.0rc2/tests/tests_pypsrp/responses/test_psrp_multiple_invocations.yml +21 -0
  29. pypsrp-0.9.0rc2/tests/tests_pypsrp/responses/test_psrp_no_profile.yml +13 -0
  30. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_noprofile.yml +1 -1
  31. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_client.py +1 -1
  32. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_complex_objects.py +0 -4
  33. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_host.py +9 -10
  34. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_integration.py +20 -10
  35. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_negotiate.py +40 -40
  36. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_powershell.py +127 -9
  37. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_shell.py +2 -2
  38. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_wsman.py +8 -8
  39. pypsrp-0.8.1/build_helpers/win-setup.ps1 +0 -359
  40. pypsrp-0.8.1/pyproject.toml +0 -76
  41. pypsrp-0.8.1/requirements-dev.txt +0 -17
  42. pypsrp-0.8.1/setup.cfg +0 -53
  43. pypsrp-0.8.1/src/pypsrp.egg-info/SOURCES.txt +0 -114
  44. pypsrp-0.8.1/src/pypsrp.egg-info/requires.txt +0 -9
  45. pypsrp-0.8.1/src/pypsrp.egg-info/zip-safe +0 -1
  46. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/LICENSE +0 -0
  47. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/MANIFEST.in +0 -0
  48. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/build_helpers/JEARole.psrc +0 -0
  49. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/build_helpers/JEARoleSettings.pssc +0 -0
  50. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/build_helpers/check-winrm.py +0 -0
  51. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/build_helpers/run-ci.sh +0 -0
  52. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/__init__.py +0 -0
  53. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/exceptions.py +0 -0
  54. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/host.py +0 -0
  55. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/pwsh_scripts/__init__.py +0 -0
  56. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/pwsh_scripts/copy.ps1 +0 -0
  57. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/pwsh_scripts/fetch.ps1 +0 -0
  58. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp/py.typed +0 -0
  59. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp.egg-info/dependency_links.txt +0 -0
  60. {pypsrp-0.8.1 → pypsrp-0.9.0rc2}/src/pypsrp.egg-info/top_level.txt +0 -0
  61. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/__init__.py +0 -0
  62. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/data/test_sanitise_clixml_with_error.xml +0 -0
  63. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/data/test_sanitise_clixml_with_no_errors.xml +0 -0
  64. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_copy_expand_vars.yml +0 -0
  65. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_copy_file.yml +0 -0
  66. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_copy_file_empty.yml +0 -0
  67. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_copy_file_failure.yml +0 -0
  68. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_copy_file_really_large.yml +0 -0
  69. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_copy_file_warning.yml +0 -0
  70. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_execute_cmd.yml +0 -0
  71. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_execute_cmd_environment.yml +0 -0
  72. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_execute_ps.yml +0 -0
  73. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_execute_ps_environment.yml +0 -0
  74. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_execute_ps_failure.yml +0 -0
  75. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_fetch_file.yml +0 -0
  76. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_fetch_file_expand_vars.yml +0 -0
  77. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_fetch_file_fail_dir.yml +0 -0
  78. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_fetch_file_fail_missing.yml +0 -0
  79. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_client_fetch_file_hash_mismatch.yml +0 -0
  80. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_application_args.yml +0 -0
  81. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_clear_commands.yml +0 -0
  82. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_disconnect_runspaces.yml +0 -0
  83. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_disconnected_commands.yml +0 -0
  84. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_error_failed.yml +0 -0
  85. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_get_command_metadata.yml +0 -0
  86. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_key_exchange_timeout.yml +0 -0
  87. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_long_running_cmdlet.yml +0 -0
  88. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_merge_commands.yml +0 -0
  89. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_multiple_commands.yml +0 -0
  90. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_nested_command.yml +0 -0
  91. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_open_runspace.yml +0 -0
  92. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_pshost_methods.yml +0 -0
  93. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_pshost_raw_ui_mocked_methods.yml +0 -0
  94. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_pshost_ui_mocked_methods.yml +0 -0
  95. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_receive_failure.yml +0 -0
  96. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_reset_runspace_state.yml +0 -0
  97. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_reset_runspace_state_fail.yml +0 -0
  98. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_run_protocol_version_2.1.yml +0 -0
  99. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_run_protocol_version_2.2.yml +0 -0
  100. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_run_protocol_version_2.3.yml +0 -0
  101. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_set_runspaces.yml +0 -0
  102. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_small_msg_size.yml +0 -0
  103. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_stream_no_output_invocation.yml +0 -0
  104. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_stream_output_invocation.yml +0 -0
  105. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_with_history.yml +0 -0
  106. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_with_input.yml +0 -0
  107. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_with_jea_configuration.yml +0 -0
  108. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_psrp_with_no_history.yml +0 -0
  109. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_bad_cmd_id.yml +0 -0
  110. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_environment.yml +0 -0
  111. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_extra_opts.yml +0 -0
  112. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_fail_poll_process.yml +0 -0
  113. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_no_cmd_shell.yml +0 -0
  114. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_open_already_opened.yml +0 -0
  115. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_operation_timeout.yml +0 -0
  116. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_send.yml +0 -0
  117. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_standard.yml +0 -0
  118. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_stderr_rc.yml +0 -0
  119. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_winrs_unicode.yml +0 -0
  120. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_wsman_update_envelope_size_150.yml +0 -0
  121. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_wsman_update_envelope_size_4096.yml +0 -0
  122. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/responses/test_wsman_update_envelope_size_500.yml +0 -0
  123. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_encryption.py +0 -0
  124. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_exceptions.py +0 -0
  125. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_messages.py +0 -0
  126. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_serializer.py +0 -0
  127. {pypsrp-0.8.1/tests → pypsrp-0.9.0rc2/tests/tests_pypsrp}/test_utils.py +0 -0
@@ -1,8 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0 - TBD
4
+
5
+ * Raised minimum Python version to 3.10
6
+ * Added retry handler for WSMan `Receive` operations that can attempt to recover from a network disconnect during a command operation
7
+ * Added `no_profile` option to `RunspacePool` to skip loading the user profile on the remote shell
8
+ * Added `idle_timeout` option to `RunspacePool` to control the idle timeout, in seconds, of the remote Runspace Pool
9
+ * Made an `__enter__` and `__exit__` method for `PowerShell` to allow it to be used with a `with PowerShell(runspace) as ps:` syntax
10
+ * On `__exit__` the pipeline will be closed using the `TERMINATE` signal to clean up any resources on the server end
11
+ * `ps.close()` can also be called manually to clean up any resources and to prep the pipeline to be run again
12
+ * Added `clear_streams()` onto a `PowerShell` object to clear the output and `streams` values so it is ready for a subsequent run
13
+ * Changed default service name used for Kerberos authentication from `WSMAN` to `host` to match the behaviour on Windows
14
+ * `WSMAN` was used for CredSSP authentication only on the native Windows client while `Negotiate/Kerberos` auth used `host`
15
+ * This should fix errors when authenticating with domain controllers which sometimes fail to register the `WSMAN` service for the host
16
+ * Added `is_alive(timeout=...)` on `RunspacePool` to check if the Runspace Pool is still alive and ready for use on the server
17
+ * Added `certificate_key_password` option to `WSMan` to support loaded client certificate keys that have been encrypted
18
+
3
19
  ## 0.8.1 - 2022-02-22
4
20
 
5
- * Bump `requests-credssp` minimumt to new version to support newer encryption format and simpler dependencies
21
+ * Bump `requests-credssp` minimum to new version to support newer encryption format and simpler dependencies
6
22
 
7
23
 
8
24
  ## 0.8.0 - 2022-02-01
@@ -1,25 +1,44 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pypsrp
3
- Version: 0.8.1
3
+ Version: 0.9.0rc2
4
4
  Summary: PowerShell Remoting Protocol and WinRM for Python
5
- Home-page: https://github.com/jborean93/pypsrp
6
- Author: Jordan Borean
7
- Author-email: jborean93@gmail.com
8
- License: MIT
5
+ Author-email: Jordan Borean <jborean93@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: homepage, https://github.com/jborean93/pypsrp
9
8
  Keywords: winrm,psrp,winrs,windows,powershell
10
- Platform: UNKNOWN
11
9
  Classifier: Development Status :: 4 - Beta
12
- Classifier: License :: OSI Approved :: MIT License
13
10
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: 3.7
16
- Classifier: Programming Language :: Python :: 3.8
17
- Classifier: Programming Language :: Python :: 3.9
18
11
  Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Requires-Python: >=3.10
19
17
  Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: cryptography>=3.1
20
+ Requires-Dist: pyspnego<1.0.0,>=0.7.0
21
+ Requires-Dist: requests>=2.27.0
20
22
  Provides-Extra: credssp
23
+ Requires-Dist: requests-credssp>=2.0.0; extra == "credssp"
21
24
  Provides-Extra: kerberos
22
- License-File: LICENSE
25
+ Requires-Dist: pyspnego[kerberos]; extra == "kerberos"
26
+ Provides-Extra: dev
27
+ Requires-Dist: black==25.11.0; extra == "dev"
28
+ Requires-Dist: build; extra == "dev"
29
+ Requires-Dist: isort==6.1.0; extra == "dev"
30
+ Requires-Dist: mypy==1.19.0; extra == "dev"
31
+ Requires-Dist: pre-commit; extra == "dev"
32
+ Requires-Dist: pyspnego[kerberos]; extra == "dev"
33
+ Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: pytest-cov; extra == "dev"
35
+ Requires-Dist: pytest-mock; extra == "dev"
36
+ Requires-Dist: PyYAML; extra == "dev"
37
+ Requires-Dist: requests-credssp; extra == "dev"
38
+ Requires-Dist: types-requests; extra == "dev"
39
+ Requires-Dist: types-PyYAML; extra == "dev"
40
+ Requires-Dist: xmldiff; extra == "dev"
41
+ Dynamic: license-file
23
42
 
24
43
  # pypsrp - Python PowerShell Remoting Protocol Client library
25
44
 
@@ -64,7 +83,7 @@ libraries to be installed.
64
83
 
65
84
  See `How to Install` for more details
66
85
 
67
- * CPython 3.6+
86
+ * CPython 3.10+
68
87
  * [cryptography](https://github.com/pyca/cryptography)
69
88
  * [pyspnego](https://github.com/jborean93/pyspnego)
70
89
  * [requests](https://github.com/requests/requests)
@@ -150,7 +169,19 @@ pip install pypsrp[credssp]
150
169
  ```
151
170
 
152
171
  If that fails you may need to update pip and setuptools to a newer version
153
- `pip install -U pip setuptools`.
172
+ `pip install -U pip setuptools`, otherwise the following system package may be
173
+ required;
174
+
175
+ ```bash
176
+ # For Debian/Ubuntu
177
+ apt-get install gcc python-dev
178
+
179
+ # For RHEL/Centos
180
+ yum install gcc python-devel
181
+
182
+ # For Fedora
183
+ dnf install gcc python-devel
184
+ ```
154
185
 
155
186
 
156
187
  ## How to Use
@@ -193,7 +224,8 @@ These are the options that can be used to setup `WSMan`;
193
224
  * `data_locale`: The `wsmv:DataLocale` value to set on each WSMan request. This specifies the format in which numerical data is presented in the response text, default is the value of `locale`
194
225
  * `reconnection_retries`: Number of retries on a connection problem, default is `0`
195
226
  * `reconnection_backoff`: Number of seconds to backoff in between reconnection attempts (first sleeps X, then sleeps 2*X, 4*X, 8*X, ...), default is `2.0`
196
- * `certificate_key_pem`: The path to the certificate key used in `certificate` authentication
227
+ * `certificate_key_pem`: The path to the certificate key used in `certificate` authentication. The key can be in either a `PKCS#1` or `PKCS#8` format
228
+ * `certificate_key_password`: The password for `certificate_key_pem` if it is encrypted
197
229
  * `certificate_pem`: The path to the certificate used in `certificate` authentication
198
230
  * `credssp_auth_mechanism`: The sub-auth mechanism used in CredSSP, default is `auto`, choices are `auto`, `ntlm`, or `kerberos`
199
231
  * `credssp_disable_tlsv1_2`: Whether to used CredSSP auth over the insecure TLSv1.0, default is `False`
@@ -230,7 +262,7 @@ configure a `WinRS` shell;
230
262
  * `idle_time_out`: THe idle timeout in seconds of the shell
231
263
  * `lifetime`: The total lifetime of the shell
232
264
  * `name`: The name (description only) of the shell
233
- * `no_profile`: Whether to create the shell with the user profile loaded or not
265
+ * `no_profile`: Whether to create the shell with the user profile loaded or not. This no longer works on Server 2012/Windows 8 or newer
234
266
  * `working_directory`: The default working directory of the created shell
235
267
 
236
268
  `RunspacePool` is a shell used by the PSRP protocol, it is designed to be a
@@ -247,6 +279,7 @@ Here are the options that can be used to configure a `RunspacePool` shell;
247
279
  * `min_runspaces`: The minimuum number of runspaces that a pool can hold, default is 1
248
280
  * `max_runspaces`: The maximum number of runspaces that a pool can hold. Each PowerShell pipeline is run in a single Runspace, default is 1
249
281
  * `session_key_timeout_ms`: The maximum time to wait for a session key transfer from the server
282
+ * `no_profile`: Do not load the user profile on the remote Runspace Pool
250
283
 
251
284
  ### Process
252
285
 
@@ -352,9 +385,8 @@ from pypsrp.wsman import WSMan
352
385
  # creates a https connection with explicit kerberos auth and implicit credentials
353
386
  wsman = WSMan("server", auth="kerberos", cert_validation=False))
354
387
 
355
- with wsman, RunspacePool(wsman) as pool:
388
+ with wsman, RunspacePool(wsman) as pool, PowerShell(pool) as ps:
356
389
  # execute 'Get-Process | Select-Object Name'
357
- ps = PowerShell(pool)
358
390
  ps.add_cmdlet("Get-Process").add_cmdlet("Select-Object").add_argument("Name")
359
391
  output = ps.invoke()
360
392
 
@@ -385,6 +417,19 @@ with wsman, RunspacePool(wsman) as pool:
385
417
  ps.invoke(["string", 1])
386
418
  print(ps.output)
387
419
  print(ps.streams.debug)
420
+
421
+ # It is possible to run the PowerShell pipeline again with invoke() but it
422
+ # needs to be explicitly closed first and the commands/streams optionally
423
+ # cleared if desired.
424
+ ps.close()
425
+
426
+ # Clears out ps.output and ps.streams to a blank value. Not required but
427
+ # nice if the output should be separate from a previous run
428
+ ps.clear_streams()
429
+
430
+ # Removes all existing commands. Not required but needed if re-using the
431
+ # same pipeline with a different set of commands
432
+ ps.clear_commands()
388
433
  ```
389
434
 
390
435
 
@@ -438,17 +483,18 @@ information and should only be used for debugging purposes._
438
483
  ## Testing
439
484
 
440
485
  Any changes are more than welcome in pull request form, you can run the current
441
- test suite with tox like so;
486
+ test suite with:
442
487
 
443
488
  ```bash
444
- # make sure tox is installed
445
- pip install tox
446
-
447
- # run the tox suite
448
- tox
449
-
450
- # or run the test manually for the current Python environment
451
- py.test -v --pep8 --cov pypsrp --cov-report term-missing
489
+ pip install -e .[dev]
490
+
491
+ python -m pytest \
492
+ tests/tests_pypsrp \
493
+ --verbose \
494
+ --junitxml junit/test-results.xml \
495
+ --cov pypsrp \
496
+ --cov-report xml \
497
+ --cov-report term-missing
452
498
  ```
453
499
 
454
500
  A lot of the tests either simulate a remote Windows host but you can also run a
@@ -518,5 +564,3 @@ tests.
518
564
  * Add Ansible playbook for better integration tests
519
565
  * Improved serialization between Python and .NET objects
520
566
  * Live interactive console for PSRP
521
-
522
-
@@ -1,26 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: pypsrp
3
- Version: 0.8.1
4
- Summary: PowerShell Remoting Protocol and WinRM for Python
5
- Home-page: https://github.com/jborean93/pypsrp
6
- Author: Jordan Borean
7
- Author-email: jborean93@gmail.com
8
- License: MIT
9
- Keywords: winrm,psrp,winrs,windows,powershell
10
- Platform: UNKNOWN
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: 3.7
16
- Classifier: Programming Language :: Python :: 3.8
17
- Classifier: Programming Language :: Python :: 3.9
18
- Classifier: Programming Language :: Python :: 3.10
19
- Description-Content-Type: text/markdown
20
- Provides-Extra: credssp
21
- Provides-Extra: kerberos
22
- License-File: LICENSE
23
-
24
1
  # pypsrp - Python PowerShell Remoting Protocol Client library
25
2
 
26
3
  [![Test workflow](https://github.com/jborean93/pypsrp/actions/workflows/ci.yml/badge.svg)](https://github.com/jborean93/pypsrp/actions/workflows/ci.yml)
@@ -64,7 +41,7 @@ libraries to be installed.
64
41
 
65
42
  See `How to Install` for more details
66
43
 
67
- * CPython 3.6+
44
+ * CPython 3.10+
68
45
  * [cryptography](https://github.com/pyca/cryptography)
69
46
  * [pyspnego](https://github.com/jborean93/pyspnego)
70
47
  * [requests](https://github.com/requests/requests)
@@ -150,7 +127,19 @@ pip install pypsrp[credssp]
150
127
  ```
151
128
 
152
129
  If that fails you may need to update pip and setuptools to a newer version
153
- `pip install -U pip setuptools`.
130
+ `pip install -U pip setuptools`, otherwise the following system package may be
131
+ required;
132
+
133
+ ```bash
134
+ # For Debian/Ubuntu
135
+ apt-get install gcc python-dev
136
+
137
+ # For RHEL/Centos
138
+ yum install gcc python-devel
139
+
140
+ # For Fedora
141
+ dnf install gcc python-devel
142
+ ```
154
143
 
155
144
 
156
145
  ## How to Use
@@ -193,7 +182,8 @@ These are the options that can be used to setup `WSMan`;
193
182
  * `data_locale`: The `wsmv:DataLocale` value to set on each WSMan request. This specifies the format in which numerical data is presented in the response text, default is the value of `locale`
194
183
  * `reconnection_retries`: Number of retries on a connection problem, default is `0`
195
184
  * `reconnection_backoff`: Number of seconds to backoff in between reconnection attempts (first sleeps X, then sleeps 2*X, 4*X, 8*X, ...), default is `2.0`
196
- * `certificate_key_pem`: The path to the certificate key used in `certificate` authentication
185
+ * `certificate_key_pem`: The path to the certificate key used in `certificate` authentication. The key can be in either a `PKCS#1` or `PKCS#8` format
186
+ * `certificate_key_password`: The password for `certificate_key_pem` if it is encrypted
197
187
  * `certificate_pem`: The path to the certificate used in `certificate` authentication
198
188
  * `credssp_auth_mechanism`: The sub-auth mechanism used in CredSSP, default is `auto`, choices are `auto`, `ntlm`, or `kerberos`
199
189
  * `credssp_disable_tlsv1_2`: Whether to used CredSSP auth over the insecure TLSv1.0, default is `False`
@@ -230,7 +220,7 @@ configure a `WinRS` shell;
230
220
  * `idle_time_out`: THe idle timeout in seconds of the shell
231
221
  * `lifetime`: The total lifetime of the shell
232
222
  * `name`: The name (description only) of the shell
233
- * `no_profile`: Whether to create the shell with the user profile loaded or not
223
+ * `no_profile`: Whether to create the shell with the user profile loaded or not. This no longer works on Server 2012/Windows 8 or newer
234
224
  * `working_directory`: The default working directory of the created shell
235
225
 
236
226
  `RunspacePool` is a shell used by the PSRP protocol, it is designed to be a
@@ -247,6 +237,7 @@ Here are the options that can be used to configure a `RunspacePool` shell;
247
237
  * `min_runspaces`: The minimuum number of runspaces that a pool can hold, default is 1
248
238
  * `max_runspaces`: The maximum number of runspaces that a pool can hold. Each PowerShell pipeline is run in a single Runspace, default is 1
249
239
  * `session_key_timeout_ms`: The maximum time to wait for a session key transfer from the server
240
+ * `no_profile`: Do not load the user profile on the remote Runspace Pool
250
241
 
251
242
  ### Process
252
243
 
@@ -352,9 +343,8 @@ from pypsrp.wsman import WSMan
352
343
  # creates a https connection with explicit kerberos auth and implicit credentials
353
344
  wsman = WSMan("server", auth="kerberos", cert_validation=False))
354
345
 
355
- with wsman, RunspacePool(wsman) as pool:
346
+ with wsman, RunspacePool(wsman) as pool, PowerShell(pool) as ps:
356
347
  # execute 'Get-Process | Select-Object Name'
357
- ps = PowerShell(pool)
358
348
  ps.add_cmdlet("Get-Process").add_cmdlet("Select-Object").add_argument("Name")
359
349
  output = ps.invoke()
360
350
 
@@ -385,6 +375,19 @@ with wsman, RunspacePool(wsman) as pool:
385
375
  ps.invoke(["string", 1])
386
376
  print(ps.output)
387
377
  print(ps.streams.debug)
378
+
379
+ # It is possible to run the PowerShell pipeline again with invoke() but it
380
+ # needs to be explicitly closed first and the commands/streams optionally
381
+ # cleared if desired.
382
+ ps.close()
383
+
384
+ # Clears out ps.output and ps.streams to a blank value. Not required but
385
+ # nice if the output should be separate from a previous run
386
+ ps.clear_streams()
387
+
388
+ # Removes all existing commands. Not required but needed if re-using the
389
+ # same pipeline with a different set of commands
390
+ ps.clear_commands()
388
391
  ```
389
392
 
390
393
 
@@ -438,17 +441,18 @@ information and should only be used for debugging purposes._
438
441
  ## Testing
439
442
 
440
443
  Any changes are more than welcome in pull request form, you can run the current
441
- test suite with tox like so;
444
+ test suite with:
442
445
 
443
446
  ```bash
444
- # make sure tox is installed
445
- pip install tox
446
-
447
- # run the tox suite
448
- tox
449
-
450
- # or run the test manually for the current Python environment
451
- py.test -v --pep8 --cov pypsrp --cov-report term-missing
447
+ pip install -e .[dev]
448
+
449
+ python -m pytest \
450
+ tests/tests_pypsrp \
451
+ --verbose \
452
+ --junitxml junit/test-results.xml \
453
+ --cov pypsrp \
454
+ --cov-report xml \
455
+ --cov-report term-missing
452
456
  ```
453
457
 
454
458
  A lot of the tests either simulate a remote Windows host but you can also run a
@@ -518,5 +522,3 @@ tests.
518
522
  * Add Ansible playbook for better integration tests
519
523
  * Improved serialization between Python and .NET objects
520
524
  * Live interactive console for PSRP
521
-
522
-
@@ -28,12 +28,6 @@ lib::setup::windows_requirements() {
28
28
  -Password "${PYPSRP_PASSWORD}" \
29
29
  -CertPath "${PYPSRP_CERT_DIR}" \
30
30
  -InformationAction Continue
31
-
32
- # FIXME: For some reason cert auth is failing with. Need to figure out what's happening here and unset this
33
- # pypsrp.exceptions.WSManFaultError: Received a WSManFault message. (Code: 2150859262, Machine: localhost,
34
- # Reason: The WS-Management service cannot process the operation. An attempt to query mapped credential failed.
35
- # This will happen if the security context associated with WinRM service has changed since the credential was originally mapped
36
- unset PYPSRP_CERT_DIR
37
31
  }
38
32
 
39
33
  lib::setup::system_requirements() {
@@ -62,25 +56,17 @@ lib::setup::python_requirements() {
62
56
  echo "::group::Installing Python Requirements"
63
57
  fi
64
58
 
65
- python -m pip install --upgrade pip setuptools wheel
59
+ # Getting the version is important so that pip prioritises our local dist
60
+ python -m pip install build
61
+ PSRP_VERSION="$( python -c "import build.util; print(build.util.project_wheel_metadata('.').get('Version'))" )"
66
62
 
67
63
  echo "Installing pypsrp"
68
- if [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then
69
- DIST_LINK_PATH="$( echo "${PWD}/dist" | sed -e 's/^\///' -e 's/\//\\/g' -e 's/^./\0:/' )"
70
- else
71
- DIST_LINK_PATH="${PWD}/dist"
72
- fi
73
-
74
- python -m pip install pypsrp \
75
- --no-index \
76
- --find-links "file://${DIST_LINK_PATH}" \
77
- --no-build-isolation \
78
- --no-dependencies \
64
+ python -m pip install pypsrp[credssp,kerberos]=="${PSRP_VERSION}" \
65
+ --find-links dist \
79
66
  --verbose
80
- python -m pip install pypsrp[credssp,kerberos]
81
67
 
82
68
  echo "Installing dev dependencies"
83
- python -m pip install -r requirements-dev.txt
69
+ python -m pip install .[dev]
84
70
 
85
71
  if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then
86
72
  echo "::endgroup::"
@@ -114,6 +100,7 @@ lib::tests::run() {
114
100
  fi
115
101
 
116
102
  python -m pytest \
103
+ tests/tests_pypsrp \
117
104
  --verbose \
118
105
  --junitxml junit/test-results.xml \
119
106
  --cov pypsrp \