aribot 1.0.0__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.
- aribot-1.0.0/.gitignore +25 -0
- aribot-1.0.0/PKG-INFO +377 -0
- aribot-1.0.0/README.md +347 -0
- aribot-1.0.0/pyproject.toml +61 -0
- aribot-1.0.0/src/aribot/__init__.py +40 -0
- aribot-1.0.0/src/aribot/client.py +103 -0
- aribot-1.0.0/src/aribot/cloud.py +308 -0
- aribot-1.0.0/src/aribot/compliance.py +211 -0
- aribot-1.0.0/src/aribot/exceptions.py +42 -0
- aribot-1.0.0/src/aribot/http.py +167 -0
- aribot-1.0.0/src/aribot/pipeline.py +380 -0
- aribot-1.0.0/src/aribot/threat_modeling.py +230 -0
aribot-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.pyc
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
|
|
8
|
+
# Build artifacts
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
*.egg-info/
|
|
12
|
+
|
|
13
|
+
# IDE
|
|
14
|
+
.idea/
|
|
15
|
+
.vscode/
|
|
16
|
+
*.swp
|
|
17
|
+
|
|
18
|
+
# OS
|
|
19
|
+
.DS_Store
|
|
20
|
+
Thumbs.db
|
|
21
|
+
|
|
22
|
+
# Environment
|
|
23
|
+
.env
|
|
24
|
+
.env.local
|
|
25
|
+
*.log
|
aribot-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aribot
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Aribot Security Platform SDK by Aristiun & Ayurak - Threat modeling, compliance, and cloud security APIs
|
|
5
|
+
Project-URL: Homepage, https://developer.ayurak.com
|
|
6
|
+
Project-URL: Documentation, https://developer.ayurak.com/docs/python-sdk
|
|
7
|
+
Project-URL: Repository, https://github.com/Aristiun/aribot-python
|
|
8
|
+
Author-email: Aristiun <sdk@ayurak.com>, Ayurak <sdk@ayurak.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: api,cloud-security,compliance,devsecops,security,threat-modeling
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Requires-Dist: pydantic>=2.0.0
|
|
24
|
+
Requires-Dist: requests>=2.28.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: responses>=0.23.0; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Aribot Python SDK
|
|
32
|
+
|
|
33
|
+
Official Python SDK for the Aribot Security Platform.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install aribot
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from aribot import Aribot
|
|
45
|
+
|
|
46
|
+
client = Aribot(api_key="your_api_key")
|
|
47
|
+
|
|
48
|
+
# Analyze architecture diagram for threats
|
|
49
|
+
result = client.threat_modeling.analyze_diagram("architecture.png")
|
|
50
|
+
print(f"Found {result['threat_count']} threats")
|
|
51
|
+
|
|
52
|
+
# Get detailed threats
|
|
53
|
+
threats = client.threat_modeling.get_threats(result['diagram_id'])
|
|
54
|
+
for threat in threats:
|
|
55
|
+
print(f"[{threat['severity']}] {threat['title']}")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
- **Threat Modeling** - Upload diagrams, detect components, identify threats
|
|
61
|
+
- **Compliance Scanning** - ISO 27001, SOC2, GDPR, HIPAA, PCI-DSS, NIST
|
|
62
|
+
- **Cloud Security** - Scan AWS, Azure, GCP for misconfigurations
|
|
63
|
+
- **Pipeline Security** - SAST, SCA, secrets detection in CI/CD
|
|
64
|
+
|
|
65
|
+
## API Reference
|
|
66
|
+
|
|
67
|
+
### Threat Modeling
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
# Upload and analyze a diagram
|
|
71
|
+
result = client.threat_modeling.analyze_diagram(
|
|
72
|
+
"architecture.png",
|
|
73
|
+
analysis_depth="comprehensive", # basic, comprehensive, detailed
|
|
74
|
+
wait=True, # wait for analysis to complete
|
|
75
|
+
timeout=300 # max wait time in seconds
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# List diagrams
|
|
79
|
+
diagrams = client.threat_modeling.list(page=1, limit=25)
|
|
80
|
+
|
|
81
|
+
# Get diagram details
|
|
82
|
+
diagram = client.threat_modeling.get(diagram_id)
|
|
83
|
+
|
|
84
|
+
# Get threats for a diagram
|
|
85
|
+
threats = client.threat_modeling.get_threats(diagram_id)
|
|
86
|
+
|
|
87
|
+
# Get detected components
|
|
88
|
+
components = client.threat_modeling.get_components(diagram_id)
|
|
89
|
+
|
|
90
|
+
# Run AI-powered analysis
|
|
91
|
+
ai_result = client.threat_modeling.analyze_with_ai(
|
|
92
|
+
diagram_id,
|
|
93
|
+
analysis_types=["attack_paths", "data_flow"]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Delete a diagram
|
|
97
|
+
client.threat_modeling.delete(diagram_id)
|
|
98
|
+
|
|
99
|
+
# Get dashboard metrics
|
|
100
|
+
dashboard = client.threat_modeling.dashboard(period="month")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Compliance Scanning
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
# Run compliance scan
|
|
107
|
+
result = client.compliance.scan(
|
|
108
|
+
diagram_id,
|
|
109
|
+
standards=["ISO27001", "SOC2", "GDPR"],
|
|
110
|
+
include_recommendations=True
|
|
111
|
+
)
|
|
112
|
+
print(f"Compliance score: {result['overall_score']}%")
|
|
113
|
+
|
|
114
|
+
# Get compliance report
|
|
115
|
+
report = client.compliance.get_report(diagram_id, format="json")
|
|
116
|
+
|
|
117
|
+
# List available standards
|
|
118
|
+
standards = client.compliance.list_standards()
|
|
119
|
+
|
|
120
|
+
# Get standard details
|
|
121
|
+
iso = client.compliance.get_standard("ISO27001")
|
|
122
|
+
|
|
123
|
+
# List controls for a standard
|
|
124
|
+
controls = client.compliance.list_controls("SOC2", category="access_control")
|
|
125
|
+
|
|
126
|
+
# Get compliance gaps
|
|
127
|
+
gaps = client.compliance.get_gaps(diagram_id, standard_id="ISO27001")
|
|
128
|
+
|
|
129
|
+
# Create custom standard
|
|
130
|
+
custom = client.compliance.add_custom_standard(
|
|
131
|
+
name="Internal Security Policy",
|
|
132
|
+
description="Company security requirements",
|
|
133
|
+
controls=[
|
|
134
|
+
{
|
|
135
|
+
"id": "ISP-001",
|
|
136
|
+
"name": "Data Encryption",
|
|
137
|
+
"description": "All data must be encrypted at rest",
|
|
138
|
+
"severity": "high"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# Get compliance dashboard
|
|
144
|
+
dashboard = client.compliance.dashboard(period="quarter")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Cloud Security
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
# Run cloud security scan
|
|
151
|
+
scan = client.cloud.scan(
|
|
152
|
+
project_id="123456789012",
|
|
153
|
+
provider="aws",
|
|
154
|
+
services=["iam", "s3", "ec2"],
|
|
155
|
+
compliance_standards=["CIS-AWS"]
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
# Get scan results
|
|
159
|
+
scan = client.cloud.get_scan(scan_id)
|
|
160
|
+
|
|
161
|
+
# List scans
|
|
162
|
+
scans = client.cloud.list_scans(provider="aws", status="completed")
|
|
163
|
+
|
|
164
|
+
# Get findings
|
|
165
|
+
findings = client.cloud.get_findings(
|
|
166
|
+
scan_id,
|
|
167
|
+
severity="critical",
|
|
168
|
+
service="s3"
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
# Connect AWS account
|
|
172
|
+
account = client.cloud.connect_account(
|
|
173
|
+
provider="aws",
|
|
174
|
+
credentials={
|
|
175
|
+
"role_arn": "arn:aws:iam::123456789012:role/AribotSecurityRole",
|
|
176
|
+
"external_id": "your-external-id"
|
|
177
|
+
},
|
|
178
|
+
name="Production AWS"
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# Connect GCP project
|
|
182
|
+
account = client.cloud.connect_account(
|
|
183
|
+
provider="gcp",
|
|
184
|
+
credentials={
|
|
185
|
+
"service_account_key": "{ ... }",
|
|
186
|
+
"project_id": "my-project-123"
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
# Connect Azure subscription
|
|
191
|
+
account = client.cloud.connect_account(
|
|
192
|
+
provider="azure",
|
|
193
|
+
credentials={
|
|
194
|
+
"tenant_id": "...",
|
|
195
|
+
"client_id": "...",
|
|
196
|
+
"client_secret": "..."
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
# List connected accounts
|
|
201
|
+
accounts = client.cloud.list_accounts(provider="aws")
|
|
202
|
+
|
|
203
|
+
# Get remediation steps
|
|
204
|
+
remediation = client.cloud.get_remediation(finding_id)
|
|
205
|
+
|
|
206
|
+
# Resolve a finding
|
|
207
|
+
client.cloud.resolve_finding(
|
|
208
|
+
finding_id,
|
|
209
|
+
resolution="fixed",
|
|
210
|
+
notes="Patched in deployment v1.2.3"
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
# Suppress a finding
|
|
214
|
+
client.cloud.suppress_finding(
|
|
215
|
+
finding_id,
|
|
216
|
+
reason="Accepted risk per security review",
|
|
217
|
+
duration_days=90
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
# Get cloud security dashboard
|
|
221
|
+
dashboard = client.cloud.dashboard(project_id="123456789012")
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Pipeline Security
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
# Create a project
|
|
228
|
+
project = client.pipeline.create_project(
|
|
229
|
+
name="my-api",
|
|
230
|
+
repository_url="https://github.com/org/my-api",
|
|
231
|
+
scan_types=["sast", "sca", "secrets"]
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
# Run security scan
|
|
235
|
+
result = client.pipeline.scan(
|
|
236
|
+
project_id,
|
|
237
|
+
commit_sha="abc123def456",
|
|
238
|
+
branch="main",
|
|
239
|
+
scan_types=["sast", "sca", "secrets"],
|
|
240
|
+
fail_on_severity="high",
|
|
241
|
+
wait=True
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
if result['status'] == 'failed':
|
|
245
|
+
print("Security gate failed!")
|
|
246
|
+
for finding in result['blocking_findings']:
|
|
247
|
+
print(f" [{finding['severity']}] {finding['title']}")
|
|
248
|
+
|
|
249
|
+
# Get scan details
|
|
250
|
+
scan = client.pipeline.get_scan(scan_id)
|
|
251
|
+
|
|
252
|
+
# Get specific finding types
|
|
253
|
+
sast_findings = client.pipeline.get_sast_findings(scan_id)
|
|
254
|
+
sca_findings = client.pipeline.get_sca_findings(scan_id)
|
|
255
|
+
secrets = client.pipeline.get_secrets_findings(scan_id)
|
|
256
|
+
|
|
257
|
+
# Configure security gates
|
|
258
|
+
client.pipeline.configure_gates(
|
|
259
|
+
project_id,
|
|
260
|
+
gates={
|
|
261
|
+
"fail_on_critical": True,
|
|
262
|
+
"fail_on_high": True,
|
|
263
|
+
"max_high_findings": 5,
|
|
264
|
+
"block_secrets": True,
|
|
265
|
+
"required_scan_types": ["sast", "secrets"]
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
# Set baseline (suppress existing findings)
|
|
270
|
+
client.pipeline.add_baseline(project_id, scan_id)
|
|
271
|
+
|
|
272
|
+
# Suppress a finding
|
|
273
|
+
client.pipeline.suppress_finding(
|
|
274
|
+
finding_id,
|
|
275
|
+
reason="False positive - validated manually"
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
# Get pipeline dashboard
|
|
279
|
+
dashboard = client.pipeline.dashboard(project_id=project_id)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Error Handling
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
from aribot import (
|
|
286
|
+
Aribot,
|
|
287
|
+
AribotError,
|
|
288
|
+
AuthenticationError,
|
|
289
|
+
RateLimitError,
|
|
290
|
+
ValidationError,
|
|
291
|
+
NotFoundError,
|
|
292
|
+
ServerError
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
client = Aribot(api_key="your_api_key")
|
|
296
|
+
|
|
297
|
+
try:
|
|
298
|
+
result = client.threat_modeling.analyze_diagram("diagram.png")
|
|
299
|
+
except AuthenticationError:
|
|
300
|
+
print("Invalid API key")
|
|
301
|
+
except RateLimitError as e:
|
|
302
|
+
print(f"Rate limited. Retry after {e.retry_after} seconds")
|
|
303
|
+
except ValidationError as e:
|
|
304
|
+
print(f"Invalid request: {e.errors}")
|
|
305
|
+
except NotFoundError:
|
|
306
|
+
print("Resource not found")
|
|
307
|
+
except ServerError:
|
|
308
|
+
print("Server error - try again later")
|
|
309
|
+
except AribotError as e:
|
|
310
|
+
print(f"API error: {e.message}")
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Configuration
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
# Custom base URL (for on-premise deployments)
|
|
317
|
+
client = Aribot(
|
|
318
|
+
api_key="your_api_key",
|
|
319
|
+
base_url="https://aribot.internal.company.com/api",
|
|
320
|
+
timeout=60
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
# Check API health
|
|
324
|
+
health = client.health()
|
|
325
|
+
|
|
326
|
+
# Get current user info
|
|
327
|
+
user = client.me()
|
|
328
|
+
|
|
329
|
+
# Get usage stats
|
|
330
|
+
usage = client.usage(period="month")
|
|
331
|
+
print(f"API calls used: {usage['calls_used']}/{usage['calls_limit']}")
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## CI/CD Integration
|
|
335
|
+
|
|
336
|
+
### GitHub Actions
|
|
337
|
+
|
|
338
|
+
```yaml
|
|
339
|
+
- name: Security Scan
|
|
340
|
+
env:
|
|
341
|
+
AYURAK_API_KEY: ${{ secrets.AYURAK_API_KEY }}
|
|
342
|
+
run: |
|
|
343
|
+
pip install aribot
|
|
344
|
+
python -c "
|
|
345
|
+
from aribot import Aribot
|
|
346
|
+
client = Aribot(api_key='$AYURAK_API_KEY')
|
|
347
|
+
result = client.pipeline.scan(
|
|
348
|
+
project_id='${{ vars.PROJECT_ID }}',
|
|
349
|
+
commit_sha='${{ github.sha }}',
|
|
350
|
+
fail_on_severity='high',
|
|
351
|
+
wait=True
|
|
352
|
+
)
|
|
353
|
+
if result['status'] == 'failed':
|
|
354
|
+
exit(1)
|
|
355
|
+
"
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### GitLab CI
|
|
359
|
+
|
|
360
|
+
```yaml
|
|
361
|
+
security_scan:
|
|
362
|
+
script:
|
|
363
|
+
- pip install aribot
|
|
364
|
+
- python scripts/security_scan.py
|
|
365
|
+
variables:
|
|
366
|
+
AYURAK_API_KEY: $AYURAK_API_KEY
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Support
|
|
370
|
+
|
|
371
|
+
- Documentation: https://developers.aribot.com/docs/python-sdk
|
|
372
|
+
- API Reference: https://developers.aribot.com/api
|
|
373
|
+
- Issues: https://github.com/AribotAI/aribot-python/issues
|
|
374
|
+
|
|
375
|
+
## License
|
|
376
|
+
|
|
377
|
+
MIT
|