Skip to content

Commit

Permalink
PAPP-30822: Revert old changes (#28)
Browse files Browse the repository at this point in the history
* Revert old changes

This reverts commit 8a7c230.

* updated copyright year and releasenotes

* Update README.md

---------

Co-authored-by: splunk-soar-connectors-admin <admin@splunksoar>
  • Loading branch information
aparekh-crest and splunk-soar-connectors-admin authored Jan 24, 2024
1 parent 0c5260d commit b9b1c5c
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 90 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2018-2023 Splunk Inc.
Copyright (c) 2018-2024 Splunk Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
12 changes: 1 addition & 11 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Splunk SOAR Windows Remote Management
Copyright (c) 2018-2023 Splunk Inc.
Copyright (c) 2018-2024 Splunk Inc.

Third-party Software Attributions:

Expand All @@ -10,23 +10,13 @@ Copyright 2004-2017 Leonard Richardson
Copyright 2004-2019 Leonard Richardson
Copyright 2018 Isaac Muse

Library: ntlm-auth
Version: 1.5.0
License: MIT
Copyright 2018 Jordan Borean, Red Hat

Library: pycparser
Version: 2.21
License: BSD 3
Copyright 2008-2020 Eli Bendersky
Copyright parser in Python
Copyright parser in Python

Library: requests
Version: 2.25.0
License: Apache 2.0
Kenneth Reitz

Library: six
Version: 1.15.0
License: MIT
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This app integrates with the Windows Remote Management service to execute variou

[comment]: # ""
[comment]: # " File: README.md"
[comment]: # " Copyright (c) 2018-2023 Splunk Inc."
[comment]: # " Copyright (c) 2018-2024 Splunk Inc."
[comment]: # " "
[comment]: # " Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)"
[comment]: # ""
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File: __init__.py
#
# Copyright (c) 2018-2023 Splunk Inc.
# Copyright (c) 2018-2024 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion manual_readme_content.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[comment]: # ""
[comment]: # " File: README.md"
[comment]: # " Copyright (c) 2018-2023 Splunk Inc."
[comment]: # " Copyright (c) 2018-2024 Splunk Inc."
[comment]: # " "
[comment]: # " Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)"
[comment]: # ""
Expand Down
2 changes: 1 addition & 1 deletion parse_callbacks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File: parse_callbacks.py
#
# Copyright (c) 2018-2023 Splunk Inc.
# Copyright (c) 2018-2024 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 0 additions & 2 deletions release_notes/2.2.7.md

This file was deleted.

1 change: 1 addition & 0 deletions release_notes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**Unreleased**
* Removed certifi and requests dependencies in order to use platform packages [PAPP-31096, PAPP-30822]
Binary file removed wheels/py3/certifi-2023.7.22-py3-none-any.whl
Binary file not shown.
Binary file removed wheels/py3/idna-3.4-py3-none-any.whl
Binary file not shown.
Binary file removed wheels/py3/requests-2.31.0-py3-none-any.whl
Binary file not shown.
Binary file removed wheels/py3/urllib3-2.0.7-py3-none-any.whl
Binary file not shown.
Binary file not shown.
20 changes: 2 additions & 18 deletions winrm.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"product_name": "Windows Remote Management",
"product_version_regex": ".*",
"publisher": "Splunk",
"license": "Copyright (c) 2018-2023 Splunk Inc.",
"license": "Copyright (c) 2018-2024 Splunk Inc.",
"app_version": "2.2.7",
"utctime_updated": "2023-12-05T12:42:47.000000Z",
"package_name": "phantom_winrm",
Expand Down Expand Up @@ -3307,26 +3307,14 @@
"module": "beautifulsoup4",
"input_file": "wheels/py3/beautifulsoup4-4.9.1-py3-none-any.whl"
},
{
"module": "certifi",
"input_file": "wheels/py3/certifi-2023.7.22-py3-none-any.whl"
},
{
"module": "cffi",
"input_file": "wheels/py39/cffi-1.16.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
},
{
"module": "charset_normalizer",
"input_file": "wheels/py39/charset_normalizer-3.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
},
{
"module": "cryptography",
"input_file": "wheels/py3/cryptography-41.0.5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
},
{
"module": "idna",
"input_file": "wheels/py3/idna-3.4-py3-none-any.whl"
},
{
"module": "pycparser",
"input_file": "wheels/shared/pycparser-2.21-py2.py3-none-any.whl"
Expand All @@ -3351,14 +3339,10 @@
"module": "soupsieve",
"input_file": "wheels/py3/soupsieve-2.5-py3-none-any.whl"
},
{
"module": "urllib3",
"input_file": "wheels/py3/urllib3-2.0.7-py3-none-any.whl"
},
{
"module": "xmltodict",
"input_file": "wheels/shared/xmltodict-0.13.0-py2.py3-none-any.whl"
}
]
}
}
}
54 changes: 14 additions & 40 deletions winrm_connector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File: winrm_connector.py
#
# Copyright (c) 2018-2023 Splunk Inc.
# Copyright (c) 2018-2024 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -187,19 +187,6 @@ def _sanitize_string(self, string):
# break any double quotes which are found, then we break any $, which is used to declare variables
return string.replace('`', '``').replace('"', '`"').replace('$', '`$').replace('&', '`&').replace(')', '`)').replace('(', '`(')

def _get_fips_enabled(self):
try:
from phantom_common.install_info import is_fips_enabled
except ImportError:
return False

fips_enabled = is_fips_enabled()
if fips_enabled:
self.debug_print('FIPS is enabled')
else:
self.debug_print('FIPS is not enabled')
return fips_enabled

def _create_ps_script(self, action_result, args, whitelist_args=set(), cmd_prefix="", cmd_suffix=""):
# Here, you can pass it something like {"val1": "value"} which will generate a string for "-val1 value"
# "For your convenience" you can also pass it a list of strings and dicts, something like [val1, {"val2": "asdf"}, foo],
Expand Down Expand Up @@ -237,19 +224,19 @@ def _create_ps_script(self, action_result, args, whitelist_args=set(), cmd_prefi
def _init_session(self, action_result, param=None):
config = self.get_config()

default_protocol = config.get(consts.WINRM_CONFIG_PROTOCOL, 'http')
default_protocol = config.get('default_protocol', 'http')
ret_val, default_port = self._validate_integer(
action_result,
config.get(consts.WINRM_CONFIG_PORT, 5985 if default_protocol == 'http' else 5986),
config.get('default_port', 5985 if default_protocol == 'http' else 5986),
"Default port",
True)
if phantom.is_fail(ret_val):
return action_result.get_status()

endpoint = self._handle_py_ver_compat_for_input_str(config.get(consts.WINRM_CONFIG_ENDPOINT))
if param:
endpoint = self._handle_py_ver_compat_for_input_str(param.get('ip_hostname', endpoint))

endpoint = self._handle_py_ver_compat_for_input_str(param.get('ip_hostname', config.get('endpoint')))
else:
endpoint = self._handle_py_ver_compat_for_input_str(config.get('endpoint'))
if endpoint is None:
return action_result.set_status(
phantom.APP_ERROR, "No Endpoint Configured"
Expand All @@ -258,16 +245,12 @@ def _init_session(self, action_result, param=None):
endpoint = '{0}://{1}'.format(default_protocol, endpoint)
if re.search(r':\d+$', endpoint, re.UNICODE | re.IGNORECASE) is None:
endpoint = '{0}:{1}'.format(endpoint, default_port)
username = config[consts.WINRM_CONFIG_USERNAME]
password = config[consts.WINRM_CONFIG_PASSWORD]
transport = config.get(consts.WINRM_CONFIG_TRANSPORT)
domain = self._handle_py_ver_compat_for_input_str(config.get(consts.WINRM_CONFIG_DOMAIN))
username = config['username']
password = config['password']
transport = config.get('transport')
domain = self._handle_py_ver_compat_for_input_str(config.get('domain'))

verify_bool = config.get(phantom.APP_JSON_VERIFY, False)
cert_pem_path = None
cert_key_pem_path = None
cert_ca_trust_path = config.get(consts.WINRM_CONFIG_CA_TRUST, "legacy_requests")

if verify_bool:
verify = 'validate'
else:
Expand All @@ -279,18 +262,12 @@ def _init_session(self, action_result, param=None):
"Warning: Domain is set but transport type is set to 'basic'"
)
elif transport == 'ntlm':
if self._get_fips_enabled():
return action_result.set_status(
phantom.APP_ERROR, "This transport type is not supported when FIPS is enabled"
)
if domain:
username = r'{}\{}'.format(domain, username)
elif transport == 'kerberos':
username = r'{}\{}'.format(domain, username)
elif transport == 'certificate':
username = r'{}\{}'.format(domain, username)
cert_pem_path = config.get(consts.WINRM_CONFIG_CERT_PEM)
cert_key_pem_path = config.get(consts.WINRM_CONFIG_CERT_KEY_PEM)
return action_result.set_status(
phantom.APP_ERROR, "This transport type is not yet implemented"
)
elif transport == 'credssp':
return action_result.set_status(
phantom.APP_ERROR, "This transport type is not yet implemented"
Expand All @@ -304,10 +281,7 @@ def _init_session(self, action_result, param=None):
endpoint,
auth=(username, password),
server_cert_validation=verify,
transport=transport,
cert_pem=cert_pem_path,
cert_key_pem=cert_key_pem_path,
ca_trust_path=cert_ca_trust_path
transport=transport
)
self._protocol = self._session.protocol

Expand Down
15 changes: 1 addition & 14 deletions winrm_consts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File: winrm_consts.py
#
# Copyright (c) 2018-2023 Splunk Inc.
# Copyright (c) 2018-2024 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -108,16 +108,3 @@
LOCATION_VALUE_LIST = ["local", "domain", "effective"]
DENY_ALLOW_VALUE_LIST = ["deny", "allow"]
VALUE_LIST_VALIDATION_MESSAGE = "Please provide valid input from {} in '{}' action parameter"

# Config keys

WINRM_CONFIG_ENDPOINT = "endpoint"
WINRM_CONFIG_PROTOCOL = "default_protocol"
WINRM_CONFIG_PORT = "default_port"
WINRM_CONFIG_USERNAME = "username"
WINRM_CONFIG_PASSWORD = "password"
WINRM_CONFIG_TRANSPORT = "transport"
WINRM_CONFIG_DOMAIN = "domain"
WINRM_CONFIG_CERT_PEM = "cert_pem_path"
WINRM_CONFIG_CERT_KEY_PEM = "cert_key_pem_path"
WINRM_CONFIG_CA_TRUST = "ca_trust_path"

0 comments on commit b9b1c5c

Please sign in to comment.