...
Anchor |
---|
| _Toc341972300 |
---|
| _Toc341972300 |
---|
|
Create a DualShield Class
Code Block |
---|
|
class DualShield: |
...
headers = {"Content-Type": "application/json"} |
...
app_context = "/das5/rest/" |
...
def _init_(self, host, port, keyFile, certFile): |
...
...
...
self.conn = HTTPSConnection(host, port, keyFile, certFile) |
...
def execute(self, method, params): |
...
data = json.dumps(params) |
...
self.conn.request("POST", self.app_context + method, data, self.headers) |
...
response = self.conn.getresponse() |
...
...
return json.loads(data.decode('utf-8')) |
...
...
...
Anchor |
---|
| _Toc341972301 |
---|
| _Toc341972301 |
---|
|
Initialize DualShield Variables
Code Block |
---|
|
host = 'dualshield.deepnetlabs.com' |
...
...
...
...
domainname='deepnetlabs.com' |
Replace the values of these variable with your own.
host: the host name (FQDN) of your DualShield server
port: the port number of the DualShield authentication server
keyFile: Your agent's private key file
certFile: Your agent's certificate file
domainname: The name of the domain that your agent is connected to
Anchor |
---|
| _Toc341972302 |
---|
| _Toc341972302 |
---|
|
Create a Test Class
Code Block |
---|
|
class TestDualShield(unittest.TestCase): |
...
...
self.auth=DualShield(host, port, keyFile, certFile) |
...
...
Anchor |
---|
| _Toc341972303 |
---|
| _Toc341972303 |
---|
|
Check the Connection
...