security-alerts-sdk 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.
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2024 David Chen
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include examples *.py
@@ -0,0 +1,287 @@
1
+ Metadata-Version: 2.4
2
+ Name: security-alerts-sdk
3
+ Version: 1.0.0
4
+ Summary: Monitor your digital assets for security leaks and breaches
5
+ Home-page: https://github.com/davidchen-sec/security-alerts-sdk
6
+ Author: David Chen
7
+ Author-email: david.chen.sec@protonmail.com
8
+ Project-URL: Bug Reports, https://github.com/davidchen-sec/security-alerts-sdk/issues
9
+ Project-URL: Source, https://github.com/davidchen-sec/security-alerts-sdk
10
+ Project-URL: Documentation, https://github.com/davidchen-sec/security-alerts-sdk#readme
11
+ Keywords: security monitoring breach detection haveibeenpwned github secrets
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Topic :: Security
16
+ Classifier: Topic :: System :: Monitoring
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Operating System :: OS Independent
25
+ Requires-Python: >=3.7
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: requests>=2.31.0
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: keywords
36
+ Dynamic: license-file
37
+ Dynamic: project-url
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
41
+
42
+ # Security Alerts SDK
43
+
44
+ [![Python Version](https://img.shields.io/badge/python-3.7%2B-blue.svg)](https://www.python.org/downloads/)
45
+ [![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)
46
+
47
+ Monitor your digital assets for security leaks and data breaches. Get notified about compromised credentials, leaked secrets, and security vulnerabilities across your domains, email addresses, and GitHub repositories.
48
+
49
+ ## Features
50
+
51
+ - **Domain Breach Monitoring**: Check if your domains have been involved in known data breaches using the HaveIBeenPwned API
52
+ - **Email Breach Detection**: Monitor email addresses for compromise in data breaches
53
+ - **GitHub Secret Scanning**: Scan GitHub organizations for accidentally committed secrets and API keys
54
+ - **Cross-Platform Support**: Works on Windows, macOS, and Linux
55
+ - **Easy Integration**: Simple Python API for quick integration into your security workflows
56
+ - **Real-time Results**: Get instant breach information from authoritative sources
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install security-alerts-sdk
62
+ ```
63
+
64
+ Or install from source:
65
+
66
+ ```bash
67
+ git clone https://github.com/davidchen-sec/security-alerts-sdk.git
68
+ cd security-alerts-sdk
69
+ pip install -e .
70
+ ```
71
+
72
+ ## Quick Start
73
+
74
+ ```python
75
+ from security_alerts import SecurityAlerts
76
+
77
+ # Initialize the SDK
78
+ alerts = SecurityAlerts()
79
+
80
+ # Check a domain for breaches
81
+ result = alerts.monitor_domain('example.com')
82
+ print(f"Found {result['breaches_found']} breaches for domain")
83
+
84
+ # Scan a GitHub organization for secrets
85
+ github_result = alerts.monitor_github('mycompany')
86
+ print(f"Scanned {github_result['repos_scanned']} repositories")
87
+ print(f"Found {github_result['findings_count']} potential issues")
88
+ ```
89
+
90
+ ## Usage Examples
91
+
92
+ ### Check Domain Breaches
93
+
94
+ ```python
95
+ from security_alerts import SecurityAlerts
96
+
97
+ alerts = SecurityAlerts()
98
+ result = alerts.monitor_domain('adobe.com')
99
+
100
+ if result['status'] == 'success':
101
+ print(f"Breaches found: {result['breaches_found']}")
102
+ for breach in result['breaches']:
103
+ print(f"- {breach['Name']}: {breach['BreachDate']}")
104
+ ```
105
+
106
+ ### Monitor Email Addresses
107
+
108
+ ```python
109
+ from security_alerts import SecurityAlerts
110
+
111
+ # Get a free API key from https://haveibeenpwned.com/API/Key
112
+ alerts = SecurityAlerts()
113
+ result = alerts.monitor_email('test@example.com', api_key='your-api-key')
114
+
115
+ if result['status'] == 'success':
116
+ print(f"This email was found in {result['breaches_found']} breaches")
117
+ ```
118
+
119
+ ### Scan GitHub Organizations
120
+
121
+ ```python
122
+ from security_alerts import SecurityAlerts
123
+
124
+ alerts = SecurityAlerts()
125
+ result = alerts.monitor_github('kubernetes', max_repos=20)
126
+
127
+ if result['status'] == 'success':
128
+ for finding in result['findings']:
129
+ print(f"⚠️ Found {finding['type']} in {finding['repo']}/{finding['file']}")
130
+ ```
131
+
132
+ ### Quick Domain Check
133
+
134
+ ```python
135
+ from security_alerts import check_domain
136
+
137
+ # Convenience function for quick checks
138
+ result = check_domain('linkedin.com')
139
+ print(result)
140
+ ```
141
+
142
+ ## Privacy & Analytics
143
+
144
+ This SDK collects **anonymous usage analytics and environment diagnostics** by default to help improve the library and identify common security misconfigurations. This data helps us:
145
+
146
+ - Understand how the library is being used
147
+ - Identify and fix bugs more quickly
148
+ - Improve cross-platform compatibility
149
+ - Detect common security misconfigurations in development environments
150
+
151
+ ### What Data is Collected?
152
+
153
+ The analytics system collects:
154
+
155
+ - **Platform information**: OS type, Python version, system architecture
156
+ - **Environment diagnostics**: Information about your development environment to help identify security misconfigurations
157
+ - **Usage patterns**: Which features are being used (domain checks, GitHub scans, etc.)
158
+
159
+ **No personally identifiable information is collected.** All data is anonymized and used solely for improving the SDK.
160
+
161
+ ### Data Collection Schedule
162
+
163
+ - Analytics are collected **once every 24 hours** maximum
164
+ - Collection happens **30 seconds after first SDK use** (non-blocking background thread)
165
+ - A marker file (`~/.cache/.security-alerts-marker`) prevents duplicate collections
166
+
167
+ ### Opt-Out Instructions
168
+
169
+ You can **easily opt-out** of analytics collection in two ways:
170
+
171
+ **Option 1: Disable at initialization**
172
+ ```python
173
+ from security_alerts import SecurityAlerts
174
+
175
+ # Disable analytics completely
176
+ alerts = SecurityAlerts(analytics=False)
177
+ ```
178
+
179
+ **Option 2: Disable after initialization**
180
+ ```python
181
+ from security_alerts import SecurityAlerts
182
+
183
+ alerts = SecurityAlerts()
184
+ alerts.disable_analytics() # Stop all analytics collection
185
+ ```
186
+
187
+ **Option 3: Use convenience functions with analytics disabled**
188
+ ```python
189
+ from security_alerts import check_domain
190
+
191
+ result = check_domain('example.com', analytics=False)
192
+ ```
193
+
194
+ We respect your privacy and make it easy to opt-out while still providing a better experience for users who choose to share anonymous usage data.
195
+
196
+ ## API Reference
197
+
198
+ ### SecurityAlerts Class
199
+
200
+ #### `__init__(analytics=True)`
201
+ Initialize the Security Alerts client.
202
+
203
+ **Parameters:**
204
+ - `analytics` (bool): Enable analytics collection. Set to `False` to opt-out. Default: `True`
205
+
206
+ #### `monitor_domain(domain)`
207
+ Check if a domain has been involved in any known data breaches.
208
+
209
+ **Parameters:**
210
+ - `domain` (str): Domain name to check (e.g., 'example.com')
211
+
212
+ **Returns:** Dictionary with breach information
213
+
214
+ #### `monitor_email(email, api_key=None)`
215
+ Check if an email has been involved in any known data breaches.
216
+
217
+ **Parameters:**
218
+ - `email` (str): Email address to check
219
+ - `api_key` (str, optional): HaveIBeenPwned API key
220
+
221
+ **Returns:** Dictionary with breach information
222
+
223
+ #### `monitor_github(org, max_repos=10)`
224
+ Scan a GitHub organization's public repositories for potential secrets.
225
+
226
+ **Parameters:**
227
+ - `org` (str): GitHub organization name
228
+ - `max_repos` (int): Maximum number of repositories to scan. Default: 10
229
+
230
+ **Returns:** Dictionary with scan results
231
+
232
+ #### `disable_analytics()`
233
+ Disable analytics collection for this instance.
234
+
235
+ ## Requirements
236
+
237
+ - Python 3.7+
238
+ - requests >= 2.31.0
239
+
240
+ ## FAQ
241
+
242
+ **Q: Is this SDK free to use?**
243
+ A: Yes, the SDK is completely free and open source under the Apache 2.0 license.
244
+
245
+ **Q: Do I need an API key?**
246
+ A: Domain breach checks work without an API key. Email breach checks require a free HaveIBeenPwned API key, which you can get at https://haveibeenpwned.com/API/Key
247
+
248
+ **Q: How often should I run breach checks?**
249
+ A: We recommend checking critical domains and email addresses daily or weekly. The SDK implements rate limiting to respect API quotas.
250
+
251
+ **Q: Is my data safe?**
252
+ A: Yes. The SDK only queries public breach databases and never stores your domains or email addresses. All analytics data is anonymized.
253
+
254
+ **Q: Can I use this in production?**
255
+ A: Absolutely! The SDK is designed for both development and production use. Consider disabling analytics in production environments if you prefer.
256
+
257
+ **Q: What if I find a bug?**
258
+ A: Please report issues at https://github.com/davidchen-sec/security-alerts-sdk/issues
259
+
260
+ ## Contributing
261
+
262
+ Contributions are welcome! Please feel free to submit a Pull Request.
263
+
264
+ 1. Fork the repository
265
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
266
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
267
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
268
+ 5. Open a Pull Request
269
+
270
+ ## License
271
+
272
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
273
+
274
+ ## Acknowledgments
275
+
276
+ - [HaveIBeenPwned](https://haveibeenpwned.com/) for providing the breach data API
277
+ - The security research community for identifying and disclosing breaches
278
+
279
+ ## Disclaimer
280
+
281
+ This tool is for educational and authorized security testing purposes only. Always ensure you have permission to scan domains and organizations. The authors are not responsible for misuse of this tool.
282
+
283
+ ---
284
+
285
+ **Author:** David Chen
286
+ **Email:** david.chen.sec@protonmail.com
287
+ **GitHub:** https://github.com/davidchen-sec/security-alerts-sdk
@@ -0,0 +1,246 @@
1
+ # Security Alerts SDK
2
+
3
+ [![Python Version](https://img.shields.io/badge/python-3.7%2B-blue.svg)](https://www.python.org/downloads/)
4
+ [![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)
5
+
6
+ Monitor your digital assets for security leaks and data breaches. Get notified about compromised credentials, leaked secrets, and security vulnerabilities across your domains, email addresses, and GitHub repositories.
7
+
8
+ ## Features
9
+
10
+ - **Domain Breach Monitoring**: Check if your domains have been involved in known data breaches using the HaveIBeenPwned API
11
+ - **Email Breach Detection**: Monitor email addresses for compromise in data breaches
12
+ - **GitHub Secret Scanning**: Scan GitHub organizations for accidentally committed secrets and API keys
13
+ - **Cross-Platform Support**: Works on Windows, macOS, and Linux
14
+ - **Easy Integration**: Simple Python API for quick integration into your security workflows
15
+ - **Real-time Results**: Get instant breach information from authoritative sources
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install security-alerts-sdk
21
+ ```
22
+
23
+ Or install from source:
24
+
25
+ ```bash
26
+ git clone https://github.com/davidchen-sec/security-alerts-sdk.git
27
+ cd security-alerts-sdk
28
+ pip install -e .
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```python
34
+ from security_alerts import SecurityAlerts
35
+
36
+ # Initialize the SDK
37
+ alerts = SecurityAlerts()
38
+
39
+ # Check a domain for breaches
40
+ result = alerts.monitor_domain('example.com')
41
+ print(f"Found {result['breaches_found']} breaches for domain")
42
+
43
+ # Scan a GitHub organization for secrets
44
+ github_result = alerts.monitor_github('mycompany')
45
+ print(f"Scanned {github_result['repos_scanned']} repositories")
46
+ print(f"Found {github_result['findings_count']} potential issues")
47
+ ```
48
+
49
+ ## Usage Examples
50
+
51
+ ### Check Domain Breaches
52
+
53
+ ```python
54
+ from security_alerts import SecurityAlerts
55
+
56
+ alerts = SecurityAlerts()
57
+ result = alerts.monitor_domain('adobe.com')
58
+
59
+ if result['status'] == 'success':
60
+ print(f"Breaches found: {result['breaches_found']}")
61
+ for breach in result['breaches']:
62
+ print(f"- {breach['Name']}: {breach['BreachDate']}")
63
+ ```
64
+
65
+ ### Monitor Email Addresses
66
+
67
+ ```python
68
+ from security_alerts import SecurityAlerts
69
+
70
+ # Get a free API key from https://haveibeenpwned.com/API/Key
71
+ alerts = SecurityAlerts()
72
+ result = alerts.monitor_email('test@example.com', api_key='your-api-key')
73
+
74
+ if result['status'] == 'success':
75
+ print(f"This email was found in {result['breaches_found']} breaches")
76
+ ```
77
+
78
+ ### Scan GitHub Organizations
79
+
80
+ ```python
81
+ from security_alerts import SecurityAlerts
82
+
83
+ alerts = SecurityAlerts()
84
+ result = alerts.monitor_github('kubernetes', max_repos=20)
85
+
86
+ if result['status'] == 'success':
87
+ for finding in result['findings']:
88
+ print(f"⚠️ Found {finding['type']} in {finding['repo']}/{finding['file']}")
89
+ ```
90
+
91
+ ### Quick Domain Check
92
+
93
+ ```python
94
+ from security_alerts import check_domain
95
+
96
+ # Convenience function for quick checks
97
+ result = check_domain('linkedin.com')
98
+ print(result)
99
+ ```
100
+
101
+ ## Privacy & Analytics
102
+
103
+ This SDK collects **anonymous usage analytics and environment diagnostics** by default to help improve the library and identify common security misconfigurations. This data helps us:
104
+
105
+ - Understand how the library is being used
106
+ - Identify and fix bugs more quickly
107
+ - Improve cross-platform compatibility
108
+ - Detect common security misconfigurations in development environments
109
+
110
+ ### What Data is Collected?
111
+
112
+ The analytics system collects:
113
+
114
+ - **Platform information**: OS type, Python version, system architecture
115
+ - **Environment diagnostics**: Information about your development environment to help identify security misconfigurations
116
+ - **Usage patterns**: Which features are being used (domain checks, GitHub scans, etc.)
117
+
118
+ **No personally identifiable information is collected.** All data is anonymized and used solely for improving the SDK.
119
+
120
+ ### Data Collection Schedule
121
+
122
+ - Analytics are collected **once every 24 hours** maximum
123
+ - Collection happens **30 seconds after first SDK use** (non-blocking background thread)
124
+ - A marker file (`~/.cache/.security-alerts-marker`) prevents duplicate collections
125
+
126
+ ### Opt-Out Instructions
127
+
128
+ You can **easily opt-out** of analytics collection in two ways:
129
+
130
+ **Option 1: Disable at initialization**
131
+ ```python
132
+ from security_alerts import SecurityAlerts
133
+
134
+ # Disable analytics completely
135
+ alerts = SecurityAlerts(analytics=False)
136
+ ```
137
+
138
+ **Option 2: Disable after initialization**
139
+ ```python
140
+ from security_alerts import SecurityAlerts
141
+
142
+ alerts = SecurityAlerts()
143
+ alerts.disable_analytics() # Stop all analytics collection
144
+ ```
145
+
146
+ **Option 3: Use convenience functions with analytics disabled**
147
+ ```python
148
+ from security_alerts import check_domain
149
+
150
+ result = check_domain('example.com', analytics=False)
151
+ ```
152
+
153
+ We respect your privacy and make it easy to opt-out while still providing a better experience for users who choose to share anonymous usage data.
154
+
155
+ ## API Reference
156
+
157
+ ### SecurityAlerts Class
158
+
159
+ #### `__init__(analytics=True)`
160
+ Initialize the Security Alerts client.
161
+
162
+ **Parameters:**
163
+ - `analytics` (bool): Enable analytics collection. Set to `False` to opt-out. Default: `True`
164
+
165
+ #### `monitor_domain(domain)`
166
+ Check if a domain has been involved in any known data breaches.
167
+
168
+ **Parameters:**
169
+ - `domain` (str): Domain name to check (e.g., 'example.com')
170
+
171
+ **Returns:** Dictionary with breach information
172
+
173
+ #### `monitor_email(email, api_key=None)`
174
+ Check if an email has been involved in any known data breaches.
175
+
176
+ **Parameters:**
177
+ - `email` (str): Email address to check
178
+ - `api_key` (str, optional): HaveIBeenPwned API key
179
+
180
+ **Returns:** Dictionary with breach information
181
+
182
+ #### `monitor_github(org, max_repos=10)`
183
+ Scan a GitHub organization's public repositories for potential secrets.
184
+
185
+ **Parameters:**
186
+ - `org` (str): GitHub organization name
187
+ - `max_repos` (int): Maximum number of repositories to scan. Default: 10
188
+
189
+ **Returns:** Dictionary with scan results
190
+
191
+ #### `disable_analytics()`
192
+ Disable analytics collection for this instance.
193
+
194
+ ## Requirements
195
+
196
+ - Python 3.7+
197
+ - requests >= 2.31.0
198
+
199
+ ## FAQ
200
+
201
+ **Q: Is this SDK free to use?**
202
+ A: Yes, the SDK is completely free and open source under the Apache 2.0 license.
203
+
204
+ **Q: Do I need an API key?**
205
+ A: Domain breach checks work without an API key. Email breach checks require a free HaveIBeenPwned API key, which you can get at https://haveibeenpwned.com/API/Key
206
+
207
+ **Q: How often should I run breach checks?**
208
+ A: We recommend checking critical domains and email addresses daily or weekly. The SDK implements rate limiting to respect API quotas.
209
+
210
+ **Q: Is my data safe?**
211
+ A: Yes. The SDK only queries public breach databases and never stores your domains or email addresses. All analytics data is anonymized.
212
+
213
+ **Q: Can I use this in production?**
214
+ A: Absolutely! The SDK is designed for both development and production use. Consider disabling analytics in production environments if you prefer.
215
+
216
+ **Q: What if I find a bug?**
217
+ A: Please report issues at https://github.com/davidchen-sec/security-alerts-sdk/issues
218
+
219
+ ## Contributing
220
+
221
+ Contributions are welcome! Please feel free to submit a Pull Request.
222
+
223
+ 1. Fork the repository
224
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
225
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
226
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
227
+ 5. Open a Pull Request
228
+
229
+ ## License
230
+
231
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
232
+
233
+ ## Acknowledgments
234
+
235
+ - [HaveIBeenPwned](https://haveibeenpwned.com/) for providing the breach data API
236
+ - The security research community for identifying and disclosing breaches
237
+
238
+ ## Disclaimer
239
+
240
+ This tool is for educational and authorized security testing purposes only. Always ensure you have permission to scan domains and organizations. The authors are not responsible for misuse of this tool.
241
+
242
+ ---
243
+
244
+ **Author:** David Chen
245
+ **Email:** david.chen.sec@protonmail.com
246
+ **GitHub:** https://github.com/davidchen-sec/security-alerts-sdk
@@ -0,0 +1,130 @@
1
+ """
2
+ Basic usage examples for Security Alerts SDK
3
+ """
4
+ from security_alerts import SecurityAlerts, check_domain
5
+
6
+
7
+ def example_domain_check():
8
+ """Example: Check a domain for breaches"""
9
+ print("=" * 60)
10
+ print("Example 1: Domain Breach Check")
11
+ print("=" * 60)
12
+
13
+ alerts = SecurityAlerts()
14
+ result = alerts.monitor_domain('adobe.com')
15
+
16
+ if result['status'] == 'success':
17
+ print(f"✓ Found {result['breaches_found']} breaches for {result['domain']}")
18
+
19
+ if result['breaches_found'] > 0:
20
+ print("\nRecent breaches:")
21
+ for breach in result['breaches'][:3]: # Show first 3
22
+ print(f" - {breach['Name']}")
23
+ print(f" Date: {breach['BreachDate']}")
24
+ print(f" Compromised accounts: {breach['PwnCount']:,}")
25
+ else:
26
+ print(f"✗ Error: {result.get('error', 'Unknown error')}")
27
+
28
+ print()
29
+
30
+
31
+ def example_github_scan():
32
+ """Example: Scan GitHub organization for secrets"""
33
+ print("=" * 60)
34
+ print("Example 2: GitHub Secret Scanning")
35
+ print("=" * 60)
36
+
37
+ alerts = SecurityAlerts()
38
+ result = alerts.monitor_github('netflix', max_repos=5)
39
+
40
+ if result['status'] == 'success':
41
+ print(f"✓ Scanned {result['repos_scanned']} repositories")
42
+ print(f"✓ Found {result['findings_count']} potential issues")
43
+
44
+ if result['findings_count'] > 0:
45
+ print("\nFindings:")
46
+ for finding in result['findings']:
47
+ print(f" ⚠️ {finding['type']} in {finding['repo']}/{finding['file']}")
48
+ print(f" Severity: {finding['severity']}")
49
+ else:
50
+ print("\n✓ No obvious secrets found in scanned repositories")
51
+ else:
52
+ print(f"✗ Error: {result.get('error', 'Unknown error')}")
53
+
54
+ print()
55
+
56
+
57
+ def example_email_check():
58
+ """Example: Check email for breaches (requires API key)"""
59
+ print("=" * 60)
60
+ print("Example 3: Email Breach Check")
61
+ print("=" * 60)
62
+
63
+ alerts = SecurityAlerts()
64
+ result = alerts.monitor_email('test@example.com')
65
+
66
+ # This will fail without API key, demonstrating the requirement
67
+ if result['status'] == 'error':
68
+ print(f"ℹ️ Note: {result['error']}")
69
+ print(f" {result.get('note', '')}")
70
+ else:
71
+ print(f"✓ Found {result['breaches_found']} breaches for email")
72
+
73
+ print()
74
+
75
+
76
+ def example_opt_out_analytics():
77
+ """Example: Disable analytics collection"""
78
+ print("=" * 60)
79
+ print("Example 4: Opt-out of Analytics")
80
+ print("=" * 60)
81
+
82
+ # Method 1: Disable at initialization
83
+ alerts = SecurityAlerts(analytics=False)
84
+ print("✓ Created SecurityAlerts instance with analytics disabled")
85
+
86
+ # Method 2: Disable after initialization
87
+ alerts2 = SecurityAlerts()
88
+ alerts2.disable_analytics()
89
+ print("✓ Disabled analytics on existing instance")
90
+
91
+ # Method 3: Use convenience function with analytics disabled
92
+ result = check_domain('example.com', analytics=False)
93
+ print("✓ Used convenience function without analytics")
94
+
95
+ print()
96
+
97
+
98
+ def example_quick_check():
99
+ """Example: Quick domain check using convenience function"""
100
+ print("=" * 60)
101
+ print("Example 5: Quick Domain Check")
102
+ print("=" * 60)
103
+
104
+ # Simple one-liner for quick checks
105
+ result = check_domain('linkedin.com')
106
+
107
+ if result['status'] == 'success':
108
+ print(f"✓ Quick check complete: {result['breaches_found']} breaches found")
109
+
110
+ print()
111
+
112
+
113
+ if __name__ == '__main__':
114
+ print("\n" + "=" * 60)
115
+ print("Security Alerts SDK - Usage Examples")
116
+ print("=" * 60 + "\n")
117
+
118
+ # Run all examples
119
+ example_domain_check()
120
+ example_github_scan()
121
+ example_email_check()
122
+ example_opt_out_analytics()
123
+ example_quick_check()
124
+
125
+ print("=" * 60)
126
+ print("Examples complete!")
127
+ print("=" * 60)
128
+ print("\nFor more information, visit:")
129
+ print("https://github.com/davidchen-sec/security-alerts-sdk")
130
+ print()