phishingdetectionapi 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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alpha Quantum
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include LICENSE
2
+ include README.md
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.1
2
+ Name: phishingdetectionapi
3
+ Version: 1.0.0
4
+ Summary: Python client for the PhishingDetectionAPI.com real-time phishing domain detection service
5
+ Home-page: https://www.phishingdetectionapi.com
6
+ Author: Alpha Quantum
7
+ Author-email: info@alpha-quantum.com
8
+ License: UNKNOWN
9
+ Description: # phishingdetectionapi
10
+
11
+ A production-ready Python client for the [phishing detection API](https://www.phishingdetectionapi.com) — a continuously updated threat-intelligence service that maintains a database of 390,000+ DNS-verified active phishing domains. The package wraps the REST API in a clean, dependency-light interface so security engineers, SOC analysts, email-gateway developers, and compliance teams can query, filter, and synchronize phishing intelligence directly from Python.
12
+
13
+ Phishing remains the single most common initial-access vector in cybersecurity breaches. According to industry reports, more than 80% of reported security incidents start with a phishing email or a malicious link that redirects a victim to a credential-harvesting page. The domains behind those pages are short-lived — most are registered, weaponized, and abandoned within 48 hours — which means static blocklists go stale almost immediately. Effective protection requires a live, curated feed of domains that are confirmed active right now, not a snapshot from last month.
14
+
15
+ The PhishingDetectionAPI service addresses this by ingesting domains from curated threat-intelligence feeds — including community-driven sources such as phish.co.za and other OSINT providers — every 24 hours. Each domain undergoes DNS verification to confirm it is still resolving, which eliminates the false-positive noise of stale entries. Domains that stop resolving are automatically pruned, so the database reflects the current threat landscape rather than an ever-growing graveyard of expired campaigns.
16
+
17
+ ---
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install phishingdetectionapi
23
+ ```
24
+
25
+ The only runtime dependency is [`requests`](https://requests.readthedocs.io/). Python 3.7 and newer are supported.
26
+
27
+ ## Quick start
28
+
29
+ ```python
30
+ from phishingdetectionapi import PhishingDetectionClient
31
+
32
+ client = PhishingDetectionClient("your_api_key_here")
33
+
34
+ # Check a single domain
35
+ result = client.check("suspicious-login.example.com")
36
+ print(result["is_phishing"]) # True
37
+ print(result["category"]) # "phishing/malware"
38
+ print(result["confidence"]) # 0.97
39
+ print(result["dns_active"]) # True
40
+
41
+ # Quick policy gate
42
+ if result["is_phishing"]:
43
+ block_request("suspicious-login.example.com")
44
+ ```
45
+
46
+ An API key is required and can be obtained by registering at [phishingdetectionapi.com](https://www.phishingdetectionapi.com). Keys are passed as a query parameter on every request.
47
+
48
+ ## API methods
49
+
50
+ ### `check(domain)`
51
+
52
+ Query a single domain against the phishing database. Pass a bare domain — `suspicious-site.com`, not `https://suspicious-site.com/page`. Returns an immediate verdict with no ambiguity: the `is_phishing` field is a boolean you can branch on directly.
53
+
54
+ ```python
55
+ result = client.check("paypal-verify-account.example.com")
56
+ ```
57
+
58
+ **Response:**
59
+
60
+ ```json
61
+ {
62
+ "domain": "paypal-verify-account.example.com",
63
+ "is_phishing": true,
64
+ "category": "phishing/malware",
65
+ "confidence": 0.97,
66
+ "dns_active": true,
67
+ "first_seen": "2026-07-18",
68
+ "source": "osint",
69
+ "status": 200
70
+ }
71
+ ```
72
+
73
+ A domain that is not in the database returns `"is_phishing": false` with a 200 status — your integration checks one field instead of interpreting HTTP error codes.
74
+
75
+ ### `bulk_check(domains)`
76
+
77
+ Submit up to 1,000 domains in a single request. Ideal for scanning email logs, proxy logs, or SIEM alert queues in batch.
78
+
79
+ ```python
80
+ domains = ["suspicious-bank.example.com", "legitimate-site.com", "phish-attempt.example.net"]
81
+ report = client.bulk_check(domains)
82
+
83
+ for entry in report["results"]:
84
+ if entry["is_phishing"]:
85
+ print(f"BLOCKED: {entry['domain']} — {entry['category']}")
86
+ ```
87
+
88
+ ### `feed(date=None, format="json")`
89
+
90
+ Retrieve the full daily threat feed or a specific date's snapshot. Use this to seed a local database, DNS sinkhole, or firewall blocklist.
91
+
92
+ ```python
93
+ # Today's full feed
94
+ today_feed = client.feed()
95
+
96
+ # Specific date
97
+ historical = client.feed(date="2026-07-15")
98
+
99
+ # CSV format for firewall ingestion
100
+ csv_feed = client.feed(format="csv")
101
+ ```
102
+
103
+ The feed endpoint supports both JSON and CSV formats. CSV output can be imported directly into DNS resolvers, firewall External Dynamic Lists (EDLs), or SIEM lookup tables without any transformation.
104
+
105
+ ### `stats()`
106
+
107
+ Returns current database statistics — total active domains, domains added in the last 24 hours, domains pruned, and category breakdowns.
108
+
109
+ ```python
110
+ stats = client.stats()
111
+ print(f"Active phishing domains: {stats['total_active']}")
112
+ print(f"Added today: {stats['added_24h']}")
113
+ print(f"Pruned (no longer resolving): {stats['pruned_24h']}")
114
+ ```
115
+
116
+ ## Error handling
117
+
118
+ The client raises a small, specific exception hierarchy:
119
+
120
+ ```python
121
+ from phishingdetectionapi import PhishingDetectionClient
122
+ from phishingdetectionapi.client import (
123
+ PhishingDetectionError,
124
+ AuthenticationError,
125
+ RateLimitError,
126
+ )
127
+
128
+ try:
129
+ result = client.check("example.com")
130
+ except AuthenticationError:
131
+ # 401 — API key invalid or expired
132
+ rotate_api_key()
133
+ except RateLimitError:
134
+ # 429 — slow down or upgrade plan
135
+ backoff_and_retry()
136
+ except PhishingDetectionError as e:
137
+ # Any other API or network failure
138
+ log_error(e)
139
+ ```
140
+
141
+ The client is also a context manager, so the underlying HTTP session is cleaned up automatically:
142
+
143
+ ```python
144
+ with PhishingDetectionClient("your_api_key_here") as client:
145
+ result = client.check("suspicious.example.com")
146
+ ```
147
+
148
+ ## Integration patterns
149
+
150
+ ### Email gateway / MTA plugin
151
+
152
+ Intercept inbound mail at the MTA layer and check every URL extracted from message bodies and headers against the phishing database before delivery:
153
+
154
+ ```python
155
+ from phishingdetectionapi import PhishingDetectionClient
156
+ import re
157
+
158
+ client = PhishingDetectionClient("your_api_key_here")
159
+
160
+ def scan_email(raw_message):
161
+ urls = re.findall(r'https?://([^/\s"\']+)', raw_message)
162
+ domains = list(set(urls))
163
+ if not domains:
164
+ return True # no URLs, deliver
165
+
166
+ results = client.bulk_check(domains)
167
+ threats = [r for r in results["results"] if r["is_phishing"]]
168
+ if threats:
169
+ quarantine_message(raw_message, threats)
170
+ return False
171
+ return True
172
+ ```
173
+
174
+ ### Proxy or browser extension
175
+
176
+ Wrap the lookup in a lightweight middleware that intercepts HTTP requests before they leave the network:
177
+
178
+ ```python
179
+ def should_allow(domain):
180
+ result = client.check(domain)
181
+ if result["is_phishing"]:
182
+ return False, f"Blocked: known phishing domain ({result['category']})"
183
+ return True, None
184
+ ```
185
+
186
+ ### SIEM / SOAR playbook
187
+
188
+ Feed the daily threat list into your SIEM as a lookup table, then trigger automated containment when a match fires:
189
+
190
+ ```python
191
+ def refresh_siem_indicators():
192
+ feed = client.feed(format="json")
193
+ for entry in feed["domains"]:
194
+ siem_client.add_indicator(
195
+ value=entry["domain"],
196
+ type="domain",
197
+ threat_type=entry["category"],
198
+ confidence=entry["confidence"],
199
+ )
200
+ ```
201
+
202
+ ### DNS sinkhole
203
+
204
+ Export the feed to a flat file and load it into your DNS resolver (BIND RPZ, Pi-hole, AdGuard, Unbound) for network-wide protection:
205
+
206
+ ```python
207
+ with PhishingDetectionClient("your_api_key_here") as client:
208
+ feed = client.feed(format="json")
209
+ with open("/etc/bind/rpz/phishing.zone", "w") as fh:
210
+ for entry in feed["domains"]:
211
+ fh.write(f"{entry['domain']} CNAME .\n")
212
+ ```
213
+
214
+ ## Why domain-level phishing detection matters
215
+
216
+ Traditional anti-phishing defenses rely on content analysis — scanning email bodies for suspicious language, checking for lookalike logos, or running URLs through a sandbox. These methods are valuable but slow: by the time a sandbox renders a page, hundreds of victims may have already submitted credentials. Domain-level detection operates upstream of content. If the domain itself is a known phishing host, you can block the connection before any content is loaded, any form is rendered, or any credential is at risk.
217
+
218
+ The speed advantage is significant. A single DNS or HTTP-layer lookup against a curated domain list adds negligible latency — typically under 5 milliseconds for a local cache hit — compared to the seconds required for full-page rendering and heuristic analysis. For high-volume environments such as email gateways processing millions of messages per day, or DNS resolvers handling billions of queries, that difference determines whether protection is practical at scale.
219
+
220
+ ### The evolving phishing landscape
221
+
222
+ Phishing campaigns have grown more sophisticated in recent years. Attackers now register domains that closely mimic legitimate brands, often using internationalized domain names (IDN homograph attacks), typosquatting, or subdomain abuse to evade casual inspection. A domain like `paypa1-secure-login.com` looks plausible at a glance in a mobile email client, and by the time a user realizes the deception, their credentials have already been harvested.
223
+
224
+ Bulk domain registration services and automated phishing kits have lowered the barrier to entry. A single threat actor can register hundreds of domains in a day, deploy templated credential-harvesting pages, and rotate through them as each domain gets flagged. This churn rate is what makes static, manually curated blocklists ineffective — they cannot keep pace with the volume of new domains entering the threat landscape daily.
225
+
226
+ The PhishingDetectionAPI database is rebuilt every 24 hours specifically to match this pace. Domains are sourced from multiple threat-intelligence feeds, deduplicated, categorized, and DNS-verified before they enter the active database. When a domain stops resolving — typically because the hosting provider or registrar has taken it down — it is pruned automatically so that the database reflects only current, active threats.
227
+
228
+ ### Industry use cases
229
+
230
+ Organizations across industries are adopting domain-level phishing intelligence. E-commerce platforms use it to block fake storefront pages that impersonate their checkout flows and steal payment credentials. Healthcare providers deploy it to protect patient portals from credential-harvesting campaigns that target sensitive medical records. Financial institutions integrate it into their transaction-monitoring pipelines to flag suspicious redirects in real time before customers are exposed to fraudulent login pages. Managed security service providers (MSSPs) bundle it into their SOC playbooks for automated triage, reducing mean time to response from hours to seconds. Educational institutions use it alongside their web filtering infrastructure to protect students and staff from phishing campaigns that target university credentials.
231
+
232
+ The [phishing detection API](https://www.phishingdetectionapi.com) provides the data layer for all of these use cases, and this Python package provides the integration.
233
+
234
+ ---
235
+
236
+ ## Related services
237
+
238
+ Organizations building layered security and content-filtering infrastructure may also benefit from these complementary services:
239
+
240
+ * **[Website Categorization API](https://www.websitecategorizationapi.com):** Classify any URL or domain into IAB content categories, detect malware and social engineering, and enrich with metadata including technologies used, buyer personas, and sentiment analysis. Supports 150 languages and 700+ IAB categories.
241
+
242
+ * **[AI Tools Blocklist](https://www.aitoolsblocklist.com):** A daily-refreshed database of tens of thousands of classified AI-tool domains — chatbots, code assistants, image generators, voice cloners — organized into functional categories for granular acceptable-use policies. Essential for enterprises and schools controlling data exposure through generative AI.
243
+
244
+ * **[CIPA Web Filtering](https://www.cipawebfiltering.com):** A categorized domain database of 120M+ domains designed for K-12 schools, districts, and libraries to meet Children's Internet Protection Act compliance. Supports 57+ content categories with multi-label classification delivered via API, CSV, DNS/RPZ, PAC files, and firewall EDLs.
245
+
246
+ * **[Web Filtering Database](https://www.webfilteringdatabase.com):** An enterprise-grade downloadable dataset of 100 million domains organized into 59 categories for DNS-level blocking, covering adult content, malware, gambling, social media, streaming, and other policy-relevant verticals.
247
+
248
+ * **[URL Categorization Database](https://www.urlcategorizationdatabase.com):** Comprehensive categorized domain data at enterprise scale, covering IAB content taxonomy, ad-tech verticals, and e-commerce classifications for contextual targeting, brand safety, and large-scale analytics.
249
+
250
+ ---
251
+
252
+ ## Links
253
+
254
+ - Product and API documentation: [https://www.phishingdetectionapi.com](https://www.phishingdetectionapi.com)
255
+ - APWG Phishing Activity Trends: [https://apwg.org/](https://apwg.org/)
256
+ - NIST Phishing Guidance: [https://www.nist.gov/](https://www.nist.gov/)
257
+ - OWASP Phishing: [https://owasp.org/](https://owasp.org/)
258
+
259
+ ## License
260
+
261
+ MIT
262
+
263
+ Platform: UNKNOWN
264
+ Classifier: Programming Language :: Python :: 3
265
+ Classifier: License :: OSI Approved :: MIT License
266
+ Classifier: Operating System :: OS Independent
267
+ Classifier: Topic :: Security
268
+ Classifier: Topic :: Internet :: WWW/HTTP
269
+ Classifier: Intended Audience :: Developers
270
+ Classifier: Intended Audience :: System Administrators
271
+ Requires-Python: >=3.7
272
+ Description-Content-Type: text/markdown
@@ -0,0 +1,253 @@
1
+ # phishingdetectionapi
2
+
3
+ A production-ready Python client for the [phishing detection API](https://www.phishingdetectionapi.com) — a continuously updated threat-intelligence service that maintains a database of 390,000+ DNS-verified active phishing domains. The package wraps the REST API in a clean, dependency-light interface so security engineers, SOC analysts, email-gateway developers, and compliance teams can query, filter, and synchronize phishing intelligence directly from Python.
4
+
5
+ Phishing remains the single most common initial-access vector in cybersecurity breaches. According to industry reports, more than 80% of reported security incidents start with a phishing email or a malicious link that redirects a victim to a credential-harvesting page. The domains behind those pages are short-lived — most are registered, weaponized, and abandoned within 48 hours — which means static blocklists go stale almost immediately. Effective protection requires a live, curated feed of domains that are confirmed active right now, not a snapshot from last month.
6
+
7
+ The PhishingDetectionAPI service addresses this by ingesting domains from curated threat-intelligence feeds — including community-driven sources such as phish.co.za and other OSINT providers — every 24 hours. Each domain undergoes DNS verification to confirm it is still resolving, which eliminates the false-positive noise of stale entries. Domains that stop resolving are automatically pruned, so the database reflects the current threat landscape rather than an ever-growing graveyard of expired campaigns.
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pip install phishingdetectionapi
15
+ ```
16
+
17
+ The only runtime dependency is [`requests`](https://requests.readthedocs.io/). Python 3.7 and newer are supported.
18
+
19
+ ## Quick start
20
+
21
+ ```python
22
+ from phishingdetectionapi import PhishingDetectionClient
23
+
24
+ client = PhishingDetectionClient("your_api_key_here")
25
+
26
+ # Check a single domain
27
+ result = client.check("suspicious-login.example.com")
28
+ print(result["is_phishing"]) # True
29
+ print(result["category"]) # "phishing/malware"
30
+ print(result["confidence"]) # 0.97
31
+ print(result["dns_active"]) # True
32
+
33
+ # Quick policy gate
34
+ if result["is_phishing"]:
35
+ block_request("suspicious-login.example.com")
36
+ ```
37
+
38
+ An API key is required and can be obtained by registering at [phishingdetectionapi.com](https://www.phishingdetectionapi.com). Keys are passed as a query parameter on every request.
39
+
40
+ ## API methods
41
+
42
+ ### `check(domain)`
43
+
44
+ Query a single domain against the phishing database. Pass a bare domain — `suspicious-site.com`, not `https://suspicious-site.com/page`. Returns an immediate verdict with no ambiguity: the `is_phishing` field is a boolean you can branch on directly.
45
+
46
+ ```python
47
+ result = client.check("paypal-verify-account.example.com")
48
+ ```
49
+
50
+ **Response:**
51
+
52
+ ```json
53
+ {
54
+ "domain": "paypal-verify-account.example.com",
55
+ "is_phishing": true,
56
+ "category": "phishing/malware",
57
+ "confidence": 0.97,
58
+ "dns_active": true,
59
+ "first_seen": "2026-07-18",
60
+ "source": "osint",
61
+ "status": 200
62
+ }
63
+ ```
64
+
65
+ A domain that is not in the database returns `"is_phishing": false` with a 200 status — your integration checks one field instead of interpreting HTTP error codes.
66
+
67
+ ### `bulk_check(domains)`
68
+
69
+ Submit up to 1,000 domains in a single request. Ideal for scanning email logs, proxy logs, or SIEM alert queues in batch.
70
+
71
+ ```python
72
+ domains = ["suspicious-bank.example.com", "legitimate-site.com", "phish-attempt.example.net"]
73
+ report = client.bulk_check(domains)
74
+
75
+ for entry in report["results"]:
76
+ if entry["is_phishing"]:
77
+ print(f"BLOCKED: {entry['domain']} — {entry['category']}")
78
+ ```
79
+
80
+ ### `feed(date=None, format="json")`
81
+
82
+ Retrieve the full daily threat feed or a specific date's snapshot. Use this to seed a local database, DNS sinkhole, or firewall blocklist.
83
+
84
+ ```python
85
+ # Today's full feed
86
+ today_feed = client.feed()
87
+
88
+ # Specific date
89
+ historical = client.feed(date="2026-07-15")
90
+
91
+ # CSV format for firewall ingestion
92
+ csv_feed = client.feed(format="csv")
93
+ ```
94
+
95
+ The feed endpoint supports both JSON and CSV formats. CSV output can be imported directly into DNS resolvers, firewall External Dynamic Lists (EDLs), or SIEM lookup tables without any transformation.
96
+
97
+ ### `stats()`
98
+
99
+ Returns current database statistics — total active domains, domains added in the last 24 hours, domains pruned, and category breakdowns.
100
+
101
+ ```python
102
+ stats = client.stats()
103
+ print(f"Active phishing domains: {stats['total_active']}")
104
+ print(f"Added today: {stats['added_24h']}")
105
+ print(f"Pruned (no longer resolving): {stats['pruned_24h']}")
106
+ ```
107
+
108
+ ## Error handling
109
+
110
+ The client raises a small, specific exception hierarchy:
111
+
112
+ ```python
113
+ from phishingdetectionapi import PhishingDetectionClient
114
+ from phishingdetectionapi.client import (
115
+ PhishingDetectionError,
116
+ AuthenticationError,
117
+ RateLimitError,
118
+ )
119
+
120
+ try:
121
+ result = client.check("example.com")
122
+ except AuthenticationError:
123
+ # 401 — API key invalid or expired
124
+ rotate_api_key()
125
+ except RateLimitError:
126
+ # 429 — slow down or upgrade plan
127
+ backoff_and_retry()
128
+ except PhishingDetectionError as e:
129
+ # Any other API or network failure
130
+ log_error(e)
131
+ ```
132
+
133
+ The client is also a context manager, so the underlying HTTP session is cleaned up automatically:
134
+
135
+ ```python
136
+ with PhishingDetectionClient("your_api_key_here") as client:
137
+ result = client.check("suspicious.example.com")
138
+ ```
139
+
140
+ ## Integration patterns
141
+
142
+ ### Email gateway / MTA plugin
143
+
144
+ Intercept inbound mail at the MTA layer and check every URL extracted from message bodies and headers against the phishing database before delivery:
145
+
146
+ ```python
147
+ from phishingdetectionapi import PhishingDetectionClient
148
+ import re
149
+
150
+ client = PhishingDetectionClient("your_api_key_here")
151
+
152
+ def scan_email(raw_message):
153
+ urls = re.findall(r'https?://([^/\s"\']+)', raw_message)
154
+ domains = list(set(urls))
155
+ if not domains:
156
+ return True # no URLs, deliver
157
+
158
+ results = client.bulk_check(domains)
159
+ threats = [r for r in results["results"] if r["is_phishing"]]
160
+ if threats:
161
+ quarantine_message(raw_message, threats)
162
+ return False
163
+ return True
164
+ ```
165
+
166
+ ### Proxy or browser extension
167
+
168
+ Wrap the lookup in a lightweight middleware that intercepts HTTP requests before they leave the network:
169
+
170
+ ```python
171
+ def should_allow(domain):
172
+ result = client.check(domain)
173
+ if result["is_phishing"]:
174
+ return False, f"Blocked: known phishing domain ({result['category']})"
175
+ return True, None
176
+ ```
177
+
178
+ ### SIEM / SOAR playbook
179
+
180
+ Feed the daily threat list into your SIEM as a lookup table, then trigger automated containment when a match fires:
181
+
182
+ ```python
183
+ def refresh_siem_indicators():
184
+ feed = client.feed(format="json")
185
+ for entry in feed["domains"]:
186
+ siem_client.add_indicator(
187
+ value=entry["domain"],
188
+ type="domain",
189
+ threat_type=entry["category"],
190
+ confidence=entry["confidence"],
191
+ )
192
+ ```
193
+
194
+ ### DNS sinkhole
195
+
196
+ Export the feed to a flat file and load it into your DNS resolver (BIND RPZ, Pi-hole, AdGuard, Unbound) for network-wide protection:
197
+
198
+ ```python
199
+ with PhishingDetectionClient("your_api_key_here") as client:
200
+ feed = client.feed(format="json")
201
+ with open("/etc/bind/rpz/phishing.zone", "w") as fh:
202
+ for entry in feed["domains"]:
203
+ fh.write(f"{entry['domain']} CNAME .\n")
204
+ ```
205
+
206
+ ## Why domain-level phishing detection matters
207
+
208
+ Traditional anti-phishing defenses rely on content analysis — scanning email bodies for suspicious language, checking for lookalike logos, or running URLs through a sandbox. These methods are valuable but slow: by the time a sandbox renders a page, hundreds of victims may have already submitted credentials. Domain-level detection operates upstream of content. If the domain itself is a known phishing host, you can block the connection before any content is loaded, any form is rendered, or any credential is at risk.
209
+
210
+ The speed advantage is significant. A single DNS or HTTP-layer lookup against a curated domain list adds negligible latency — typically under 5 milliseconds for a local cache hit — compared to the seconds required for full-page rendering and heuristic analysis. For high-volume environments such as email gateways processing millions of messages per day, or DNS resolvers handling billions of queries, that difference determines whether protection is practical at scale.
211
+
212
+ ### The evolving phishing landscape
213
+
214
+ Phishing campaigns have grown more sophisticated in recent years. Attackers now register domains that closely mimic legitimate brands, often using internationalized domain names (IDN homograph attacks), typosquatting, or subdomain abuse to evade casual inspection. A domain like `paypa1-secure-login.com` looks plausible at a glance in a mobile email client, and by the time a user realizes the deception, their credentials have already been harvested.
215
+
216
+ Bulk domain registration services and automated phishing kits have lowered the barrier to entry. A single threat actor can register hundreds of domains in a day, deploy templated credential-harvesting pages, and rotate through them as each domain gets flagged. This churn rate is what makes static, manually curated blocklists ineffective — they cannot keep pace with the volume of new domains entering the threat landscape daily.
217
+
218
+ The PhishingDetectionAPI database is rebuilt every 24 hours specifically to match this pace. Domains are sourced from multiple threat-intelligence feeds, deduplicated, categorized, and DNS-verified before they enter the active database. When a domain stops resolving — typically because the hosting provider or registrar has taken it down — it is pruned automatically so that the database reflects only current, active threats.
219
+
220
+ ### Industry use cases
221
+
222
+ Organizations across industries are adopting domain-level phishing intelligence. E-commerce platforms use it to block fake storefront pages that impersonate their checkout flows and steal payment credentials. Healthcare providers deploy it to protect patient portals from credential-harvesting campaigns that target sensitive medical records. Financial institutions integrate it into their transaction-monitoring pipelines to flag suspicious redirects in real time before customers are exposed to fraudulent login pages. Managed security service providers (MSSPs) bundle it into their SOC playbooks for automated triage, reducing mean time to response from hours to seconds. Educational institutions use it alongside their web filtering infrastructure to protect students and staff from phishing campaigns that target university credentials.
223
+
224
+ The [phishing detection API](https://www.phishingdetectionapi.com) provides the data layer for all of these use cases, and this Python package provides the integration.
225
+
226
+ ---
227
+
228
+ ## Related services
229
+
230
+ Organizations building layered security and content-filtering infrastructure may also benefit from these complementary services:
231
+
232
+ * **[Website Categorization API](https://www.websitecategorizationapi.com):** Classify any URL or domain into IAB content categories, detect malware and social engineering, and enrich with metadata including technologies used, buyer personas, and sentiment analysis. Supports 150 languages and 700+ IAB categories.
233
+
234
+ * **[AI Tools Blocklist](https://www.aitoolsblocklist.com):** A daily-refreshed database of tens of thousands of classified AI-tool domains — chatbots, code assistants, image generators, voice cloners — organized into functional categories for granular acceptable-use policies. Essential for enterprises and schools controlling data exposure through generative AI.
235
+
236
+ * **[CIPA Web Filtering](https://www.cipawebfiltering.com):** A categorized domain database of 120M+ domains designed for K-12 schools, districts, and libraries to meet Children's Internet Protection Act compliance. Supports 57+ content categories with multi-label classification delivered via API, CSV, DNS/RPZ, PAC files, and firewall EDLs.
237
+
238
+ * **[Web Filtering Database](https://www.webfilteringdatabase.com):** An enterprise-grade downloadable dataset of 100 million domains organized into 59 categories for DNS-level blocking, covering adult content, malware, gambling, social media, streaming, and other policy-relevant verticals.
239
+
240
+ * **[URL Categorization Database](https://www.urlcategorizationdatabase.com):** Comprehensive categorized domain data at enterprise scale, covering IAB content taxonomy, ad-tech verticals, and e-commerce classifications for contextual targeting, brand safety, and large-scale analytics.
241
+
242
+ ---
243
+
244
+ ## Links
245
+
246
+ - Product and API documentation: [https://www.phishingdetectionapi.com](https://www.phishingdetectionapi.com)
247
+ - APWG Phishing Activity Trends: [https://apwg.org/](https://apwg.org/)
248
+ - NIST Phishing Guidance: [https://www.nist.gov/](https://www.nist.gov/)
249
+ - OWASP Phishing: [https://owasp.org/](https://owasp.org/)
250
+
251
+ ## License
252
+
253
+ MIT
@@ -0,0 +1,4 @@
1
+ from .client import PhishingDetectionClient
2
+
3
+ __all__ = ["PhishingDetectionClient"]
4
+ __version__ = "1.0.0"
@@ -0,0 +1,78 @@
1
+ import requests
2
+
3
+
4
+ class PhishingDetectionError(Exception):
5
+ pass
6
+
7
+
8
+ class AuthenticationError(PhishingDetectionError):
9
+ pass
10
+
11
+
12
+ class RateLimitError(PhishingDetectionError):
13
+ pass
14
+
15
+
16
+ class PhishingDetectionClient:
17
+ def __init__(self, api_key, base_url="https://phishingdetectionapi.com/api/v1", timeout=30):
18
+ self.api_key = api_key
19
+ self.base_url = base_url.rstrip("/")
20
+ self.timeout = timeout
21
+ self.session = requests.Session()
22
+ self.session.headers.update({
23
+ "User-Agent": "phishingdetectionapi-python/1.0.0",
24
+ "Accept": "application/json",
25
+ "Accept-Encoding": "gzip",
26
+ })
27
+
28
+ def check(self, domain):
29
+ return self._get("/check", params={"domain": domain})
30
+
31
+ def bulk_check(self, domains):
32
+ return self._post("/bulk-check", json={"domains": domains})
33
+
34
+ def feed(self, date=None, format="json"):
35
+ params = {"format": format}
36
+ if date:
37
+ params["date"] = date
38
+ return self._get("/feed", params=params)
39
+
40
+ def stats(self):
41
+ return self._get("/stats")
42
+
43
+ def _get(self, path, params=None):
44
+ if params is None:
45
+ params = {}
46
+ params["apikey"] = self.api_key
47
+ resp = self.session.get(
48
+ f"{self.base_url}{path}",
49
+ params=params,
50
+ timeout=self.timeout,
51
+ )
52
+ return self._handle_response(resp)
53
+
54
+ def _post(self, path, json=None):
55
+ if json is None:
56
+ json = {}
57
+ json["apikey"] = self.api_key
58
+ resp = self.session.post(
59
+ f"{self.base_url}{path}",
60
+ json=json,
61
+ timeout=self.timeout,
62
+ )
63
+ return self._handle_response(resp)
64
+
65
+ def _handle_response(self, resp):
66
+ if resp.status_code == 401:
67
+ raise AuthenticationError("Invalid or expired API key")
68
+ if resp.status_code == 429:
69
+ raise RateLimitError("Rate limit exceeded — back off or upgrade your plan")
70
+ if resp.status_code >= 400:
71
+ raise PhishingDetectionError(f"API error {resp.status_code}: {resp.text}")
72
+ return resp.json()
73
+
74
+ def __enter__(self):
75
+ return self
76
+
77
+ def __exit__(self, *args):
78
+ self.session.close()
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.1
2
+ Name: phishingdetectionapi
3
+ Version: 1.0.0
4
+ Summary: Python client for the PhishingDetectionAPI.com real-time phishing domain detection service
5
+ Home-page: https://www.phishingdetectionapi.com
6
+ Author: Alpha Quantum
7
+ Author-email: info@alpha-quantum.com
8
+ License: UNKNOWN
9
+ Description: # phishingdetectionapi
10
+
11
+ A production-ready Python client for the [phishing detection API](https://www.phishingdetectionapi.com) — a continuously updated threat-intelligence service that maintains a database of 390,000+ DNS-verified active phishing domains. The package wraps the REST API in a clean, dependency-light interface so security engineers, SOC analysts, email-gateway developers, and compliance teams can query, filter, and synchronize phishing intelligence directly from Python.
12
+
13
+ Phishing remains the single most common initial-access vector in cybersecurity breaches. According to industry reports, more than 80% of reported security incidents start with a phishing email or a malicious link that redirects a victim to a credential-harvesting page. The domains behind those pages are short-lived — most are registered, weaponized, and abandoned within 48 hours — which means static blocklists go stale almost immediately. Effective protection requires a live, curated feed of domains that are confirmed active right now, not a snapshot from last month.
14
+
15
+ The PhishingDetectionAPI service addresses this by ingesting domains from curated threat-intelligence feeds — including community-driven sources such as phish.co.za and other OSINT providers — every 24 hours. Each domain undergoes DNS verification to confirm it is still resolving, which eliminates the false-positive noise of stale entries. Domains that stop resolving are automatically pruned, so the database reflects the current threat landscape rather than an ever-growing graveyard of expired campaigns.
16
+
17
+ ---
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install phishingdetectionapi
23
+ ```
24
+
25
+ The only runtime dependency is [`requests`](https://requests.readthedocs.io/). Python 3.7 and newer are supported.
26
+
27
+ ## Quick start
28
+
29
+ ```python
30
+ from phishingdetectionapi import PhishingDetectionClient
31
+
32
+ client = PhishingDetectionClient("your_api_key_here")
33
+
34
+ # Check a single domain
35
+ result = client.check("suspicious-login.example.com")
36
+ print(result["is_phishing"]) # True
37
+ print(result["category"]) # "phishing/malware"
38
+ print(result["confidence"]) # 0.97
39
+ print(result["dns_active"]) # True
40
+
41
+ # Quick policy gate
42
+ if result["is_phishing"]:
43
+ block_request("suspicious-login.example.com")
44
+ ```
45
+
46
+ An API key is required and can be obtained by registering at [phishingdetectionapi.com](https://www.phishingdetectionapi.com). Keys are passed as a query parameter on every request.
47
+
48
+ ## API methods
49
+
50
+ ### `check(domain)`
51
+
52
+ Query a single domain against the phishing database. Pass a bare domain — `suspicious-site.com`, not `https://suspicious-site.com/page`. Returns an immediate verdict with no ambiguity: the `is_phishing` field is a boolean you can branch on directly.
53
+
54
+ ```python
55
+ result = client.check("paypal-verify-account.example.com")
56
+ ```
57
+
58
+ **Response:**
59
+
60
+ ```json
61
+ {
62
+ "domain": "paypal-verify-account.example.com",
63
+ "is_phishing": true,
64
+ "category": "phishing/malware",
65
+ "confidence": 0.97,
66
+ "dns_active": true,
67
+ "first_seen": "2026-07-18",
68
+ "source": "osint",
69
+ "status": 200
70
+ }
71
+ ```
72
+
73
+ A domain that is not in the database returns `"is_phishing": false` with a 200 status — your integration checks one field instead of interpreting HTTP error codes.
74
+
75
+ ### `bulk_check(domains)`
76
+
77
+ Submit up to 1,000 domains in a single request. Ideal for scanning email logs, proxy logs, or SIEM alert queues in batch.
78
+
79
+ ```python
80
+ domains = ["suspicious-bank.example.com", "legitimate-site.com", "phish-attempt.example.net"]
81
+ report = client.bulk_check(domains)
82
+
83
+ for entry in report["results"]:
84
+ if entry["is_phishing"]:
85
+ print(f"BLOCKED: {entry['domain']} — {entry['category']}")
86
+ ```
87
+
88
+ ### `feed(date=None, format="json")`
89
+
90
+ Retrieve the full daily threat feed or a specific date's snapshot. Use this to seed a local database, DNS sinkhole, or firewall blocklist.
91
+
92
+ ```python
93
+ # Today's full feed
94
+ today_feed = client.feed()
95
+
96
+ # Specific date
97
+ historical = client.feed(date="2026-07-15")
98
+
99
+ # CSV format for firewall ingestion
100
+ csv_feed = client.feed(format="csv")
101
+ ```
102
+
103
+ The feed endpoint supports both JSON and CSV formats. CSV output can be imported directly into DNS resolvers, firewall External Dynamic Lists (EDLs), or SIEM lookup tables without any transformation.
104
+
105
+ ### `stats()`
106
+
107
+ Returns current database statistics — total active domains, domains added in the last 24 hours, domains pruned, and category breakdowns.
108
+
109
+ ```python
110
+ stats = client.stats()
111
+ print(f"Active phishing domains: {stats['total_active']}")
112
+ print(f"Added today: {stats['added_24h']}")
113
+ print(f"Pruned (no longer resolving): {stats['pruned_24h']}")
114
+ ```
115
+
116
+ ## Error handling
117
+
118
+ The client raises a small, specific exception hierarchy:
119
+
120
+ ```python
121
+ from phishingdetectionapi import PhishingDetectionClient
122
+ from phishingdetectionapi.client import (
123
+ PhishingDetectionError,
124
+ AuthenticationError,
125
+ RateLimitError,
126
+ )
127
+
128
+ try:
129
+ result = client.check("example.com")
130
+ except AuthenticationError:
131
+ # 401 — API key invalid or expired
132
+ rotate_api_key()
133
+ except RateLimitError:
134
+ # 429 — slow down or upgrade plan
135
+ backoff_and_retry()
136
+ except PhishingDetectionError as e:
137
+ # Any other API or network failure
138
+ log_error(e)
139
+ ```
140
+
141
+ The client is also a context manager, so the underlying HTTP session is cleaned up automatically:
142
+
143
+ ```python
144
+ with PhishingDetectionClient("your_api_key_here") as client:
145
+ result = client.check("suspicious.example.com")
146
+ ```
147
+
148
+ ## Integration patterns
149
+
150
+ ### Email gateway / MTA plugin
151
+
152
+ Intercept inbound mail at the MTA layer and check every URL extracted from message bodies and headers against the phishing database before delivery:
153
+
154
+ ```python
155
+ from phishingdetectionapi import PhishingDetectionClient
156
+ import re
157
+
158
+ client = PhishingDetectionClient("your_api_key_here")
159
+
160
+ def scan_email(raw_message):
161
+ urls = re.findall(r'https?://([^/\s"\']+)', raw_message)
162
+ domains = list(set(urls))
163
+ if not domains:
164
+ return True # no URLs, deliver
165
+
166
+ results = client.bulk_check(domains)
167
+ threats = [r for r in results["results"] if r["is_phishing"]]
168
+ if threats:
169
+ quarantine_message(raw_message, threats)
170
+ return False
171
+ return True
172
+ ```
173
+
174
+ ### Proxy or browser extension
175
+
176
+ Wrap the lookup in a lightweight middleware that intercepts HTTP requests before they leave the network:
177
+
178
+ ```python
179
+ def should_allow(domain):
180
+ result = client.check(domain)
181
+ if result["is_phishing"]:
182
+ return False, f"Blocked: known phishing domain ({result['category']})"
183
+ return True, None
184
+ ```
185
+
186
+ ### SIEM / SOAR playbook
187
+
188
+ Feed the daily threat list into your SIEM as a lookup table, then trigger automated containment when a match fires:
189
+
190
+ ```python
191
+ def refresh_siem_indicators():
192
+ feed = client.feed(format="json")
193
+ for entry in feed["domains"]:
194
+ siem_client.add_indicator(
195
+ value=entry["domain"],
196
+ type="domain",
197
+ threat_type=entry["category"],
198
+ confidence=entry["confidence"],
199
+ )
200
+ ```
201
+
202
+ ### DNS sinkhole
203
+
204
+ Export the feed to a flat file and load it into your DNS resolver (BIND RPZ, Pi-hole, AdGuard, Unbound) for network-wide protection:
205
+
206
+ ```python
207
+ with PhishingDetectionClient("your_api_key_here") as client:
208
+ feed = client.feed(format="json")
209
+ with open("/etc/bind/rpz/phishing.zone", "w") as fh:
210
+ for entry in feed["domains"]:
211
+ fh.write(f"{entry['domain']} CNAME .\n")
212
+ ```
213
+
214
+ ## Why domain-level phishing detection matters
215
+
216
+ Traditional anti-phishing defenses rely on content analysis — scanning email bodies for suspicious language, checking for lookalike logos, or running URLs through a sandbox. These methods are valuable but slow: by the time a sandbox renders a page, hundreds of victims may have already submitted credentials. Domain-level detection operates upstream of content. If the domain itself is a known phishing host, you can block the connection before any content is loaded, any form is rendered, or any credential is at risk.
217
+
218
+ The speed advantage is significant. A single DNS or HTTP-layer lookup against a curated domain list adds negligible latency — typically under 5 milliseconds for a local cache hit — compared to the seconds required for full-page rendering and heuristic analysis. For high-volume environments such as email gateways processing millions of messages per day, or DNS resolvers handling billions of queries, that difference determines whether protection is practical at scale.
219
+
220
+ ### The evolving phishing landscape
221
+
222
+ Phishing campaigns have grown more sophisticated in recent years. Attackers now register domains that closely mimic legitimate brands, often using internationalized domain names (IDN homograph attacks), typosquatting, or subdomain abuse to evade casual inspection. A domain like `paypa1-secure-login.com` looks plausible at a glance in a mobile email client, and by the time a user realizes the deception, their credentials have already been harvested.
223
+
224
+ Bulk domain registration services and automated phishing kits have lowered the barrier to entry. A single threat actor can register hundreds of domains in a day, deploy templated credential-harvesting pages, and rotate through them as each domain gets flagged. This churn rate is what makes static, manually curated blocklists ineffective — they cannot keep pace with the volume of new domains entering the threat landscape daily.
225
+
226
+ The PhishingDetectionAPI database is rebuilt every 24 hours specifically to match this pace. Domains are sourced from multiple threat-intelligence feeds, deduplicated, categorized, and DNS-verified before they enter the active database. When a domain stops resolving — typically because the hosting provider or registrar has taken it down — it is pruned automatically so that the database reflects only current, active threats.
227
+
228
+ ### Industry use cases
229
+
230
+ Organizations across industries are adopting domain-level phishing intelligence. E-commerce platforms use it to block fake storefront pages that impersonate their checkout flows and steal payment credentials. Healthcare providers deploy it to protect patient portals from credential-harvesting campaigns that target sensitive medical records. Financial institutions integrate it into their transaction-monitoring pipelines to flag suspicious redirects in real time before customers are exposed to fraudulent login pages. Managed security service providers (MSSPs) bundle it into their SOC playbooks for automated triage, reducing mean time to response from hours to seconds. Educational institutions use it alongside their web filtering infrastructure to protect students and staff from phishing campaigns that target university credentials.
231
+
232
+ The [phishing detection API](https://www.phishingdetectionapi.com) provides the data layer for all of these use cases, and this Python package provides the integration.
233
+
234
+ ---
235
+
236
+ ## Related services
237
+
238
+ Organizations building layered security and content-filtering infrastructure may also benefit from these complementary services:
239
+
240
+ * **[Website Categorization API](https://www.websitecategorizationapi.com):** Classify any URL or domain into IAB content categories, detect malware and social engineering, and enrich with metadata including technologies used, buyer personas, and sentiment analysis. Supports 150 languages and 700+ IAB categories.
241
+
242
+ * **[AI Tools Blocklist](https://www.aitoolsblocklist.com):** A daily-refreshed database of tens of thousands of classified AI-tool domains — chatbots, code assistants, image generators, voice cloners — organized into functional categories for granular acceptable-use policies. Essential for enterprises and schools controlling data exposure through generative AI.
243
+
244
+ * **[CIPA Web Filtering](https://www.cipawebfiltering.com):** A categorized domain database of 120M+ domains designed for K-12 schools, districts, and libraries to meet Children's Internet Protection Act compliance. Supports 57+ content categories with multi-label classification delivered via API, CSV, DNS/RPZ, PAC files, and firewall EDLs.
245
+
246
+ * **[Web Filtering Database](https://www.webfilteringdatabase.com):** An enterprise-grade downloadable dataset of 100 million domains organized into 59 categories for DNS-level blocking, covering adult content, malware, gambling, social media, streaming, and other policy-relevant verticals.
247
+
248
+ * **[URL Categorization Database](https://www.urlcategorizationdatabase.com):** Comprehensive categorized domain data at enterprise scale, covering IAB content taxonomy, ad-tech verticals, and e-commerce classifications for contextual targeting, brand safety, and large-scale analytics.
249
+
250
+ ---
251
+
252
+ ## Links
253
+
254
+ - Product and API documentation: [https://www.phishingdetectionapi.com](https://www.phishingdetectionapi.com)
255
+ - APWG Phishing Activity Trends: [https://apwg.org/](https://apwg.org/)
256
+ - NIST Phishing Guidance: [https://www.nist.gov/](https://www.nist.gov/)
257
+ - OWASP Phishing: [https://owasp.org/](https://owasp.org/)
258
+
259
+ ## License
260
+
261
+ MIT
262
+
263
+ Platform: UNKNOWN
264
+ Classifier: Programming Language :: Python :: 3
265
+ Classifier: License :: OSI Approved :: MIT License
266
+ Classifier: Operating System :: OS Independent
267
+ Classifier: Topic :: Security
268
+ Classifier: Topic :: Internet :: WWW/HTTP
269
+ Classifier: Intended Audience :: Developers
270
+ Classifier: Intended Audience :: System Administrators
271
+ Requires-Python: >=3.7
272
+ Description-Content-Type: text/markdown
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ setup.py
5
+ phishingdetectionapi/__init__.py
6
+ phishingdetectionapi/client.py
7
+ phishingdetectionapi.egg-info/PKG-INFO
8
+ phishingdetectionapi.egg-info/SOURCES.txt
9
+ phishingdetectionapi.egg-info/dependency_links.txt
10
+ phishingdetectionapi.egg-info/requires.txt
11
+ phishingdetectionapi.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ phishingdetectionapi
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,29 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ with open("README.md", "r", encoding="utf-8") as fh:
4
+ long_description = fh.read()
5
+
6
+ setup(
7
+ name="phishingdetectionapi",
8
+ version="1.0.0",
9
+ author="Alpha Quantum",
10
+ author_email="info@alpha-quantum.com",
11
+ description="Python client for the PhishingDetectionAPI.com real-time phishing domain detection service",
12
+ long_description=long_description,
13
+ long_description_content_type="text/markdown",
14
+ url="https://www.phishingdetectionapi.com",
15
+ packages=find_packages(),
16
+ classifiers=[
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Topic :: Security",
21
+ "Topic :: Internet :: WWW/HTTP",
22
+ "Intended Audience :: Developers",
23
+ "Intended Audience :: System Administrators",
24
+ ],
25
+ python_requires=">=3.7",
26
+ install_requires=[
27
+ "requests",
28
+ ],
29
+ )