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

Commit

Permalink
Merge pull request #10 from deep-security/new-sdk
Browse files Browse the repository at this point in the history
Tool now uses v2 of deepsecurity-py
  • Loading branch information
marknca committed Mar 30, 2016
2 parents 5ca4816 + 80ef20c commit 443d589
Show file tree
Hide file tree
Showing 166 changed files with 1,878 additions and 56,147 deletions.
10 changes: 6 additions & 4 deletions lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import boto3.session

# project libraries
import deepsecurity
import lib.deepsecurity as deepsecurity

def get_arg_parser(prog='ds-to-aws-waf.py', description=None, add_help=False):
"""
Expand Down Expand Up @@ -183,15 +183,17 @@ def _connect_to_deep_security(self):
try:
dsm_port = self.args.dsm_port if not self.args.dsm == 'app.deepsecurity.trendmicro.com' else 443
self._log("Attempting to connect to Deep Security at {}:{}".format(self.args.dsm, dsm_port))
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)
self._log("Connected to the Deep Security Manager at {}".format(self.args.dsm))
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)
dsm.sign_in()
except Exception, err:
self._log("Could not connect to the Deep Security", err=err)

if not dsm.session_id_rest and not dsm.session_id_soap:
if not dsm._sessions['REST'] and not dsm._sessions['SOAP']:
self._log("Unable to connect to the Deep Security Manager. Please check your settings")
if not self.args.ignore_ssl_validation:
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")
else:
self._log("Connected to the Deep Security Manager at {}".format(self.args.dsm))

return dsm

Expand Down
10 changes: 9 additions & 1 deletion lib/deepsecurity/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
import manager
# make sure we add the current path structure to sys.path
# this is required to import local dependencies
import sys
import os
current_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(current_path)

# import project files as required
import dsm
30 changes: 0 additions & 30 deletions lib/deepsecurity/application_type.py

This file was deleted.

170 changes: 0 additions & 170 deletions lib/deepsecurity/computer.py

This file was deleted.

30 changes: 0 additions & 30 deletions lib/deepsecurity/computer_group.py

This file was deleted.

Loading

0 comments on commit 443d589

Please sign in to comment.