New upstream release.
Kali Janitor
2 years ago
0 | name: Test pywinrm | |
1 | on: | |
2 | push: | |
3 | branches: | |
4 | - master | |
5 | ||
6 | pull_request: | |
7 | branches: | |
8 | - master | |
9 | ||
10 | env: | |
11 | WINRM_USERNAME: pywinrm-test | |
12 | WINRM_PASSWORD: Password123! | |
13 | ||
14 | jobs: | |
15 | test: | |
16 | runs-on: ${{ matrix.os }} | |
17 | strategy: | |
18 | fail-fast: false | |
19 | matrix: | |
20 | os: | |
21 | - macos-latest | |
22 | - ubuntu-latest | |
23 | - windows-latest | |
24 | python-version: | |
25 | - 2.7 | |
26 | - 3.6 | |
27 | - 3.7 | |
28 | - 3.8 | |
29 | - 3.9 | |
30 | - pypy-2.7 | |
31 | - pypy-3.7 | |
32 | arch: | |
33 | - x86 | |
34 | - x64 | |
35 | ||
36 | exclude: | |
37 | - os: macos-latest | |
38 | arch: x86 | |
39 | - os: macos-latest | |
40 | python-version: pypy-2.7 | |
41 | - os: macos-latest | |
42 | python-version: pypy-3.7 | |
43 | - os: ubuntu-latest | |
44 | arch: x86 | |
45 | - os: windows-latest | |
46 | python-version: pypy-2.7 | |
47 | - os: windows-latest | |
48 | python-version: pypy-3.7 | |
49 | ||
50 | steps: | |
51 | - uses: actions/checkout@v2 | |
52 | ||
53 | - name: set up python | |
54 | uses: actions/setup-python@v2 | |
55 | with: | |
56 | python-version: ${{ matrix.python-version }} | |
57 | architecture: ${{ matrix.arch }} | |
58 | ||
59 | - name: set up Windows integration tests | |
60 | if: startsWith(matrix.os, 'windows') | |
61 | shell: pwsh | |
62 | run: | | |
63 | Write-Host 'Create local admin user' | |
64 | $userParams = @{ | |
65 | Name = $env:WINRM_USERNAME | |
66 | Password = (ConvertTo-SecureString -AsPlainText -Force -String $env:WINRM_PASSWORD) | |
67 | AccountNeverExpires = $true | |
68 | PasswordNeverExpires = $true | |
69 | } | |
70 | $null = New-LocalUser @userParams | |
71 | Add-LocalGroupMember -Group Administrators -Member $userParams.Name | |
72 | ||
73 | Write-Host 'Setting up WinRM settings' | |
74 | Enable-PSRemoting -Force -SkipNetworkProfileCheck | |
75 | Enable-WSManCredSSP -Role Server -Force | |
76 | Set-Item WSMan:\localhost\Service\Auth\Basic $true | |
77 | Set-Item WSMan:\localhost\Service\Auth\CredSSP $true | |
78 | Set-Item WSMan:\localhost\Service\AllowUnencrypted $true | |
79 | ||
80 | - name: set up Linux dependencies | |
81 | if: startsWith(matrix.os, 'ubuntu') | |
82 | run: >- | |
83 | sudo apt-get install -y | |
84 | gcc | |
85 | python-dev | |
86 | libkrb5-dev | |
87 | env: | |
88 | DEBIAN_FRONTEND: noninteractive | |
89 | ||
90 | - name: install dependencies | |
91 | run: | | |
92 | pip install coveralls | |
93 | pip install .[credssp,kerberos] | |
94 | pip install -r requirements-test.txt | |
95 | ||
96 | - name: run test - non Windows | |
97 | if: "!startsWith(matrix.os, 'windows')" | |
98 | run: | | |
99 | pytest -v --flake8 --cov=winrm --cov-report=term-missing winrm/tests/ | |
100 | ||
101 | - name: run test - Windows | |
102 | if: startsWith(matrix.os, 'windows') | |
103 | run: | | |
104 | pytest -v --flake8 --cov=winrm --cov-report=term-missing winrm/tests/ | |
105 | env: | |
106 | WINRM_TRANSPORT: basic | |
107 | WINRM_ENDPOINT: http://localhost:5985/wsman | |
108 | ||
109 | - name: upload coverage data | |
110 | if: "!endsWith(matrix.python-version, '2.7')" # Uses an older coverals version that doesn't support GHA | |
111 | run: coveralls --service=github | |
112 | env: | |
113 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
114 | ||
115 | - name: run integration with NTLM | |
116 | if: startsWith(matrix.os, 'windows') | |
117 | run: | | |
118 | Set-Item WSMan:\localhost\Service\AllowUnencrypted $false | |
119 | py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py | |
120 | env: | |
121 | WINRM_TRANSPORT: ntlm | |
122 | WINRM_ENDPOINT: http://localhost:5985/wsman | |
123 | ||
124 | - name: run integration with CredSSP | |
125 | if: startsWith(matrix.os, 'windows') | |
126 | run: | | |
127 | Set-Item WSMan:\localhost\Service\AllowUnencrypted $false | |
128 | py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py | |
129 | env: | |
130 | WINRM_TRANSPORT: credssp | |
131 | WINRM_ENDPOINT: http://localhost:5985/wsman |
0 | # http://travis-ci.org/#!/diyan/pywinrm | |
1 | # pyenv used instead of native Python support in Travis CI to: | |
2 | # - Make build steps exactly the same on both Linux and Mac OS workers | |
3 | # - Make possible to debug build steps on local workstation | |
4 | # - Integrate new Python / PyPy releases earlier; pyenv does it with less lag than Travis | |
5 | language: generic | |
6 | cache: | |
7 | directories: | |
8 | - $HOME/.cache/pip | |
9 | - $HOME/.cache/pyenv | |
10 | matrix: | |
11 | include: | |
12 | # Define 'sudo: false' to run on container-based workers | |
13 | - { os: linux, dist: xenial, sudo: false, env: UBUNTU=16.04 PYENV=2.7.16 } | |
14 | - { os: linux, dist: xenial, sudo: false, env: UBUNTU=16.04 PYENV=3.5.7 } | |
15 | - { os: linux, dist: xenial, sudo: false, env: UBUNTU=16.04 PYENV=3.6.8 } | |
16 | - { os: linux, dist: xenial, sudo: false, env: UBUNTU=16.04 PYENV=3.7.3 } | |
17 | - { os: linux, dist: xenial, sudo: false, env: UBUNTU=16.04 PYENV=3.8-dev } | |
18 | - { os: linux, dist: xenial, sudo: false, env: UBUNTU=16.04 PYENV=pypy2.7-7.1.1 } | |
19 | ||
20 | # pyenv won't build on current Mac versions without some extra conditional help, try to fix this later... | |
21 | # - { os: osx, osx_image: xcode10.2, language: generic, env: OSX=10.14 PYENV=2.7.16 } | |
22 | # - { os: osx, osx_image: xcode10.2, language: generic, env: OSX=10.14 PYENV=3.7.3 } | |
23 | ||
24 | install: | |
25 | # Always use latest pyenv but keep installed Python versions in cache | |
26 | - rm -rf ~/.pyenv | |
27 | - git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
28 | - mkdir -p ~/.cache/pyenv/versions | |
29 | - which pyenv | |
30 | - printenv | |
31 | - ln -s ~/.cache/pyenv/versions ~/.pyenv/versions | |
32 | - export PATH="$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH" | |
33 | - export PYENV_ROOT="$HOME/.pyenv" | |
34 | - pyenv --version | |
35 | - pyenv install --skip-existing $PYENV | |
36 | - pyenv global $PYENV | |
37 | - pyenv rehash | |
38 | - python --version | |
39 | - pip --version | |
40 | - pip install virtualenv | |
41 | - python -m virtualenv ~/.venv | |
42 | - source ~/.venv/bin/activate | |
43 | - pip install coveralls | |
44 | - pip install .[credssp] | |
45 | - pip install .[kerberos] | |
46 | - pip install -r requirements-test.txt | |
47 | script: | |
48 | - pytest -v --flake8 --cov=winrm --cov-report=term-missing winrm/tests/ | |
49 | ||
50 | after_success: | |
51 | - coveralls |
0 | 0 | # Changelog |
1 | 1 | |
2 | ### Version 0.4.2 | |
3 | - Dropped Python 3.5 from support matrix as it is EOL. | |
4 | - Remove dependency on `distutils` that is deprecated in Python 3.10. | |
5 | ||
2 | 6 | ### Version 0.4.1 |
3 | - HOT FIX: Fixing an issue with `requests_kerbose` not imported correctly from the changes in `0.4.0`. | |
7 | - HOT FIX: Fixing an issue with `requests_kerberos` not imported correctly from the changes in `0.4.0`. | |
4 | 8 | |
5 | 9 | ### Version 0.4.0 |
6 | 10 | - Ensure `server_cert_validation=ignore` supersedes ca_trust_path/env overrides |
3 | 3 | that can run Python. |
4 | 4 | |
5 | 5 | [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/diyan/pywinrm/blob/master/LICENSE) |
6 | [![Travis Build](https://travis-ci.org/diyan/pywinrm.svg)](https://travis-ci.org/diyan/pywinrm) | |
7 | [![AppVeyor Build](https://ci.appveyor.com/api/projects/status/github/diyan/pywinrm?svg=true)](https://ci.appveyor.com/project/diyan/pywinrm) [![Coverage](https://coveralls.io/repos/diyan/pywinrm/badge.svg)](https://coveralls.io/r/diyan/pywinrm) | |
6 | [![Test workflow](https://github.com/diyan/pywinrm/workflows/Test%20pywinrm/badge.svg)](https://github.com/diyan/pywinrm/actions/workflows/ci.yml) | |
7 | [![Coverage](https://coveralls.io/repos/diyan/pywinrm/badge.svg)](https://coveralls.io/r/diyan/pywinrm) | |
8 | 8 | [![PyPI](https://img.shields.io/pypi/dm/pywinrm.svg)](https://pypi.python.org/pypi/pywinrm) |
9 | 9 | |
10 | 10 | WinRM allows you to perform various management tasks remotely. These include, |
0 | environment: | |
1 | global: | |
2 | # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the | |
3 | # /E:ON and /V:ON options are not enabled in the batch script intepreter | |
4 | # See: http://stackoverflow.com/a/13751649/163740 | |
5 | WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\run_with_compiler.cmd" | |
6 | matrix: | |
7 | # https://www.appveyor.com/docs/installed-software/#python | |
8 | # NOTE Python 2.6 for Windows is no longer supported by the Python core team | |
9 | - PYTHON: Python27 | |
10 | - PYTHON: Python27-x64 | |
11 | - PYTHON: Python35 | |
12 | - PYTHON: Python35-x64 | |
13 | - PYTHON: Python36 | |
14 | - PYTHON: Python36-x64 | |
15 | - PYTHON: Python37 | |
16 | - PYTHON: Python37-x64 | |
17 | ||
18 | init: | |
19 | - ps: | | |
20 | $ErrorActionPreference = "Stop" | |
21 | # Override default Python version/architecture | |
22 | $env:Path="C:\$env:PYTHON;C:\$env:PYTHON\Scripts;$env:PATH" | |
23 | # disable "Python 2.7 is going away soon" warnings | |
24 | $env:PYTHONWARNINGS="ignore:DEPRECATION" | |
25 | python -c "import platform; print('Python', platform.python_version(), platform.architecture()[0])" | |
26 | # always install latest pip | |
27 | $(curl -UseBasicParsing https://bootstrap.pypa.io/get-pip.py).Content | python | |
28 | pip --version | |
29 | ||
30 | install: | |
31 | - ps: | | |
32 | Enable-WSManCredSSP -Role Server -Force | |
33 | Set-Item WSMan:\localhost\Service\Auth\Basic $true | |
34 | Set-Item WSMan:\localhost\Service\Auth\CredSSP $true | |
35 | Set-Item WSMan:\localhost\Service\AllowUnencrypted $true | |
36 | Invoke-Expression $($env:WITH_COMPILER + " pip install cffi coveralls") | |
37 | pip install . | |
38 | pip install -r requirements-test.txt | |
39 | pip install .[credssp] | |
40 | ||
41 | build: off # Do not run MSBuild, build stuff at install step | |
42 | ||
43 | build_script: | |
44 | - echo build_script | |
45 | ||
46 | test_script: | |
47 | # configure winrm envvars for tests | |
48 | - ps: | | |
49 | $ErrorActionPreference = "Stop" | |
50 | $env:WINRM_USERNAME=$($env:USERNAME) | |
51 | $env:WINRM_PASSWORD=[Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", '') | |
52 | $env:WINRM_TRANSPORT="basic" | |
53 | $env:WINRM_ENDPOINT="http://localhost:5985/wsman" | |
54 | ||
55 | py.test -v --cov-report=term-missing --cov=. | |
56 | ||
57 | # Run integration tests with NTLM to check message encryption | |
58 | $env:WINRM_TRANSPORT="ntlm" | |
59 | Set-Item WSMan:\localhost\Service\AllowUnencrypted $false | |
60 | py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py | |
61 | ||
62 | # Run integration tests with CredSSP to check message encryption | |
63 | $env:WINRM_TRANSPORT="credssp" | |
64 | py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py | |
65 | ||
66 | after_test: | |
67 | - echo after_test |
0 | pywinrm (0.4.2-0kali1) UNRELEASED; urgency=low | |
1 | ||
2 | * New upstream release. | |
3 | ||
4 | -- Kali Janitor <[email protected]> Sun, 21 Nov 2021 04:16:26 -0000 | |
5 | ||
0 | 6 | pywinrm (0.4.1-0kali2) kali-dev; urgency=medium |
1 | 7 | |
2 | 8 | [ Sophie Brun ] |
1 | 1 | # pin specific versions to keep things more stable over time; only pin sub-packages if necessary |
2 | 2 | pytest==4.4.2 |
3 | 3 | pytest-cov==2.7.1 |
4 | pytest-flake8==1.0.4 | |
4 | pytest-flake8==1.0.7 | |
5 | 5 | mock==3.0.5 |
0 | :: To build extensions for 64 bit Python 3, we need to configure environment | |
1 | :: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: | |
2 | :: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) | |
3 | :: | |
4 | :: To build extensions for 64 bit Python 2, we need to configure environment | |
5 | :: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: | |
6 | :: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) | |
7 | :: | |
8 | :: 32 bit builds do not require specific environment configurations. | |
9 | :: | |
10 | :: Note: this script needs to be run with the /E:ON and /V:ON flags for the | |
11 | :: cmd interpreter, at least for (SDK v7.0) | |
12 | :: | |
13 | :: More details at: | |
14 | :: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows | |
15 | :: http://stackoverflow.com/a/13751649/163740 | |
16 | :: | |
17 | :: Author: Olivier Grisel | |
18 | :: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ | |
19 | @ECHO OFF | |
20 | ||
21 | SET COMMAND_TO_RUN=%* | |
22 | SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows | |
23 | ||
24 | SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" | |
25 | IF %MAJOR_PYTHON_VERSION% == "2" ( | |
26 | SET WINDOWS_SDK_VERSION="v7.0" | |
27 | ) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( | |
28 | SET WINDOWS_SDK_VERSION="v7.1" | |
29 | ) ELSE ( | |
30 | ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" | |
31 | EXIT 1 | |
32 | ) | |
33 | ||
34 | IF "%PYTHON_ARCH%"=="64" ( | |
35 | ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture | |
36 | SET DISTUTILS_USE_SDK=1 | |
37 | SET MSSdk=1 | |
38 | "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% | |
39 | "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release | |
40 | ECHO Executing: %COMMAND_TO_RUN% | |
41 | call %COMMAND_TO_RUN% || EXIT 1 | |
42 | ) ELSE ( | |
43 | ECHO Using default MSVC build environment for 32 bit architecture | |
44 | ECHO Executing: %COMMAND_TO_RUN% | |
45 | call %COMMAND_TO_RUN% || EXIT 1 | |
46 | ) |
0 | 0 | from setuptools import setup, find_packages |
1 | 1 | |
2 | __version__ = '0.4.1' | |
2 | __version__ = '0.4.2' | |
3 | 3 | project_name = 'pywinrm' |
4 | 4 | |
5 | 5 | # PyPi supports only reStructuredText, so pandoc should be installed |
39 | 39 | 'Programming Language :: Python :: 2', |
40 | 40 | 'Programming Language :: Python :: 2.7', |
41 | 41 | 'Programming Language :: Python :: 3', |
42 | 'Programming Language :: Python :: 3.5', | |
43 | 42 | 'Programming Language :: Python :: 3.6', |
44 | 43 | 'Programming Language :: Python :: 3.7', |
45 | 44 | 'Programming Language :: Python :: 3.8', |
45 | 'Programming Language :: Python :: 3.9', | |
46 | 46 | 'Programming Language :: Python :: Implementation :: PyPy', |
47 | 47 | 'Topic :: Software Development :: Libraries :: Python Modules', |
48 | 48 | 'Topic :: System :: Clustering', |
5 | 5 | import requests.auth |
6 | 6 | import warnings |
7 | 7 | |
8 | from distutils.util import strtobool | |
9 | 8 | from winrm.exceptions import InvalidCredentialsError, WinRMError, WinRMTransportError |
10 | 9 | from winrm.encryption import Encryption |
11 | 10 | |
45 | 44 | pass |
46 | 45 | |
47 | 46 | __all__ = ['Transport'] |
47 | ||
48 | ||
49 | def strtobool(value): | |
50 | value = value.lower() | |
51 | if value in ('true', 't', 'yes', 'y', 'on', '1'): | |
52 | return True | |
53 | ||
54 | elif value in ('false', 'f', 'no', 'n', 'off', '0'): | |
55 | return False | |
56 | ||
57 | else: | |
58 | raise ValueError("invalid truth value '%s'" % value) | |
48 | 59 | |
49 | 60 | |
50 | 61 | class UnsupportedAuthArgument(Warning): |