Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Commit 443d589

Browse files
committed
Merge pull request #10 from deep-security/new-sdk
Tool now uses v2 of deepsecurity-py
2 parents 5ca4816 + 80ef20c commit 443d589

File tree

166 files changed

+1878
-56147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+1878
-56147
lines changed

lib/core.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import boto3.session
99

1010
# project libraries
11-
import deepsecurity
11+
import lib.deepsecurity as deepsecurity
1212

1313
def get_arg_parser(prog='ds-to-aws-waf.py', description=None, add_help=False):
1414
"""
@@ -183,15 +183,17 @@ def _connect_to_deep_security(self):
183183
try:
184184
dsm_port = self.args.dsm_port if not self.args.dsm == 'app.deepsecurity.trendmicro.com' else 443
185185
self._log("Attempting to connect to Deep Security at {}:{}".format(self.args.dsm, dsm_port))
186-
dsm = deepsecurity.manager.Manager(dsm_hostname=self.args.dsm, dsm_port=dsm_port, username=self.args.dsm_username, password=self.args.dsm_password, tenant=self.args.dsm_tenant, ignore_ssl_validation=self.args.ignore_ssl_validation)
187-
self._log("Connected to the Deep Security Manager at {}".format(self.args.dsm))
186+
dsm = deepsecurity.dsm.Manager(hostname=self.args.dsm, port=dsm_port, username=self.args.dsm_username, password=self.args.dsm_password, tenant=self.args.dsm_tenant, ignore_ssl_validation=self.args.ignore_ssl_validation)
187+
dsm.sign_in()
188188
except Exception, err:
189189
self._log("Could not connect to the Deep Security", err=err)
190190

191-
if not dsm.session_id_rest and not dsm.session_id_soap:
191+
if not dsm._sessions['REST'] and not dsm._sessions['SOAP']:
192192
self._log("Unable to connect to the Deep Security Manager. Please check your settings")
193193
if not self.args.ignore_ssl_validation:
194194
self._log("You did not ask to ignore SSL certification validation. This is a common error when connect to a Deep Security Manager that was installed via software or the AWS Marketplace. Please set the flag (--ignore-ssl-validation), check your other settings, and try again")
195+
else:
196+
self._log("Connected to the Deep Security Manager at {}".format(self.args.dsm))
195197

196198
return dsm
197199

lib/deepsecurity/__init__.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
import manager
1+
# make sure we add the current path structure to sys.path
2+
# this is required to import local dependencies
3+
import sys
4+
import os
5+
current_path = os.path.dirname(os.path.realpath(__file__))
6+
sys.path.append(current_path)
7+
8+
# import project files as required
9+
import dsm

lib/deepsecurity/application_type.py

-30
This file was deleted.

lib/deepsecurity/computer.py

-170
This file was deleted.

lib/deepsecurity/computer_group.py

-30
This file was deleted.

0 commit comments

Comments
 (0)