secploy 0.2.4__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {secploy-0.2.4/secploy.egg-info → secploy-0.2.5}/PKG-INFO +1 -1
- {secploy-0.2.4 → secploy-0.2.5}/pyproject.toml +1 -1
- {secploy-0.2.4 → secploy-0.2.5}/secploy/__init__.py +1 -1
- {secploy-0.2.4 → secploy-0.2.5}/secploy/client.py +11 -13
- {secploy-0.2.4 → secploy-0.2.5}/secploy/schemas.py +1 -1
- {secploy-0.2.4 → secploy-0.2.5/secploy.egg-info}/PKG-INFO +1 -1
- {secploy-0.2.4 → secploy-0.2.5}/secploy.egg-info/SOURCES.txt +0 -2
- secploy-0.2.4/secploy/utils.py +0 -5
- {secploy-0.2.4 → secploy-0.2.5}/LICENSE +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/MANIFEST.in +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/README.md +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/secploy/enums.py +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/secploy/exceptions.py +0 -0
- /secploy-0.2.4/secploy/schema.py → /secploy-0.2.5/secploy/utils.py +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/secploy.egg-info/dependency_links.txt +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/secploy.egg-info/requires.txt +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/secploy.egg-info/top_level.txt +0 -0
- {secploy-0.2.4 → secploy-0.2.5}/setup.cfg +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "secploy"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.5"
|
|
8
8
|
description = "Python SDK for Secploy security monitoring and event tracking"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name="Abdulsamad Abdulganiyu", email="agastronics@gmail.com" }
|
|
@@ -5,10 +5,8 @@ from typing import Any, Dict, Optional
|
|
|
5
5
|
import requests
|
|
6
6
|
from dataclasses import dataclass, field
|
|
7
7
|
|
|
8
|
-
from lib
|
|
9
|
-
from
|
|
10
|
-
from lib.config import load_config, DEFAULT_CONFIG
|
|
11
|
-
from .schemas import SecployConfig, LogLevel
|
|
8
|
+
from lib import setup_logger, load_config, DEFAULT_CONFIG, secploy_logger
|
|
9
|
+
from schemas import SecployConfig, LogLevel
|
|
12
10
|
|
|
13
11
|
@dataclass
|
|
14
12
|
class EventBatch:
|
|
@@ -105,7 +103,7 @@ class SecployClient:
|
|
|
105
103
|
})
|
|
106
104
|
return True
|
|
107
105
|
except Exception as e:
|
|
108
|
-
|
|
106
|
+
secploy_logger.error(f"Failed to queue event: {e}", self.debug)
|
|
109
107
|
return False
|
|
110
108
|
|
|
111
109
|
def _send_batch(self, events: list) -> bool:
|
|
@@ -123,10 +121,10 @@ class SecployClient:
|
|
|
123
121
|
try:
|
|
124
122
|
resp = requests.post(url, json={"events": events}, headers=self._headers(), timeout=5)
|
|
125
123
|
if resp.status_code == 200:
|
|
126
|
-
|
|
124
|
+
secploy_logger.info(f"Batch of {len(events)} events sent successfully", self.debug)
|
|
127
125
|
return True
|
|
128
126
|
except Exception as e:
|
|
129
|
-
|
|
127
|
+
secploy_logger.error(f"Send batch failed: {e}", self.debug)
|
|
130
128
|
time.sleep(1)
|
|
131
129
|
return False
|
|
132
130
|
|
|
@@ -157,7 +155,7 @@ class SecployClient:
|
|
|
157
155
|
time.sleep(1)
|
|
158
156
|
|
|
159
157
|
except Exception as e:
|
|
160
|
-
|
|
158
|
+
secploy_logger.error(f"Error processing events: {e}", self.debug)
|
|
161
159
|
|
|
162
160
|
def _heartbeat_loop(self):
|
|
163
161
|
"""Send periodic heartbeats to the server."""
|
|
@@ -166,16 +164,16 @@ class SecployClient:
|
|
|
166
164
|
try:
|
|
167
165
|
resp = requests.post(url, headers=self._headers(), timeout=5)
|
|
168
166
|
if resp.status_code == 200:
|
|
169
|
-
|
|
167
|
+
secploy_logger.info(f"Heartbeat sent successfully", self.debug)
|
|
170
168
|
else:
|
|
171
|
-
|
|
169
|
+
secploy_logger.error(f"Heartbeat failed with status {resp.status_code}", self.debug)
|
|
172
170
|
except Exception as e:
|
|
173
|
-
|
|
171
|
+
secploy_logger.error(f"Heartbeat failed: {e}", self.debug)
|
|
174
172
|
time.sleep(self.heartbeat_interval)
|
|
175
173
|
|
|
176
174
|
def start(self):
|
|
177
175
|
"""Start the client's background threads for heartbeat and event processing."""
|
|
178
|
-
|
|
176
|
+
secploy_logger.info("Starting Secploy client...", self.debug)
|
|
179
177
|
self._stop_event.clear()
|
|
180
178
|
|
|
181
179
|
# Start heartbeat thread
|
|
@@ -196,7 +194,7 @@ class SecployClient:
|
|
|
196
194
|
|
|
197
195
|
def stop(self):
|
|
198
196
|
"""Stop the client and wait for background threads to finish."""
|
|
199
|
-
|
|
197
|
+
secploy_logger.info("Stopping Secploy client...", self.debug)
|
|
200
198
|
self._stop_event.set()
|
|
201
199
|
|
|
202
200
|
# Wait for threads to finish
|
|
@@ -7,14 +7,12 @@ setup.cfg
|
|
|
7
7
|
./secploy/client.py
|
|
8
8
|
./secploy/enums.py
|
|
9
9
|
./secploy/exceptions.py
|
|
10
|
-
./secploy/schema.py
|
|
11
10
|
./secploy/schemas.py
|
|
12
11
|
./secploy/utils.py
|
|
13
12
|
secploy/__init__.py
|
|
14
13
|
secploy/client.py
|
|
15
14
|
secploy/enums.py
|
|
16
15
|
secploy/exceptions.py
|
|
17
|
-
secploy/schema.py
|
|
18
16
|
secploy/schemas.py
|
|
19
17
|
secploy/utils.py
|
|
20
18
|
secploy.egg-info/PKG-INFO
|
secploy-0.2.4/secploy/utils.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|