phishingdetectionapi 1.0.0__py3-none-any.whl

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,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,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,275 @@
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
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Security
14
+ Classifier: Topic :: Internet :: WWW/HTTP
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Requires-Python: >=3.7
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: requests
20
+
21
+ # phishingdetectionapi
22
+
23
+ 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.
24
+
25
+ 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.
26
+
27
+ 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.
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pip install phishingdetectionapi
35
+ ```
36
+
37
+ The only runtime dependency is [`requests`](https://requests.readthedocs.io/). Python 3.7 and newer are supported.
38
+
39
+ ## Quick start
40
+
41
+ ```python
42
+ from phishingdetectionapi import PhishingDetectionClient
43
+
44
+ client = PhishingDetectionClient("your_api_key_here")
45
+
46
+ # Check a single domain
47
+ result = client.check("suspicious-login.example.com")
48
+ print(result["is_phishing"]) # True
49
+ print(result["category"]) # "phishing/malware"
50
+ print(result["confidence"]) # 0.97
51
+ print(result["dns_active"]) # True
52
+
53
+ # Quick policy gate
54
+ if result["is_phishing"]:
55
+ block_request("suspicious-login.example.com")
56
+ ```
57
+
58
+ 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.
59
+
60
+ ## API methods
61
+
62
+ ### `check(domain)`
63
+
64
+ 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.
65
+
66
+ ```python
67
+ result = client.check("paypal-verify-account.example.com")
68
+ ```
69
+
70
+ **Response:**
71
+
72
+ ```json
73
+ {
74
+ "domain": "paypal-verify-account.example.com",
75
+ "is_phishing": true,
76
+ "category": "phishing/malware",
77
+ "confidence": 0.97,
78
+ "dns_active": true,
79
+ "first_seen": "2026-07-18",
80
+ "source": "osint",
81
+ "status": 200
82
+ }
83
+ ```
84
+
85
+ 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.
86
+
87
+ ### `bulk_check(domains)`
88
+
89
+ Submit up to 1,000 domains in a single request. Ideal for scanning email logs, proxy logs, or SIEM alert queues in batch.
90
+
91
+ ```python
92
+ domains = ["suspicious-bank.example.com", "legitimate-site.com", "phish-attempt.example.net"]
93
+ report = client.bulk_check(domains)
94
+
95
+ for entry in report["results"]:
96
+ if entry["is_phishing"]:
97
+ print(f"BLOCKED: {entry['domain']} — {entry['category']}")
98
+ ```
99
+
100
+ ### `feed(date=None, format="json")`
101
+
102
+ Retrieve the full daily threat feed or a specific date's snapshot. Use this to seed a local database, DNS sinkhole, or firewall blocklist.
103
+
104
+ ```python
105
+ # Today's full feed
106
+ today_feed = client.feed()
107
+
108
+ # Specific date
109
+ historical = client.feed(date="2026-07-15")
110
+
111
+ # CSV format for firewall ingestion
112
+ csv_feed = client.feed(format="csv")
113
+ ```
114
+
115
+ 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.
116
+
117
+ ### `stats()`
118
+
119
+ Returns current database statistics — total active domains, domains added in the last 24 hours, domains pruned, and category breakdowns.
120
+
121
+ ```python
122
+ stats = client.stats()
123
+ print(f"Active phishing domains: {stats['total_active']}")
124
+ print(f"Added today: {stats['added_24h']}")
125
+ print(f"Pruned (no longer resolving): {stats['pruned_24h']}")
126
+ ```
127
+
128
+ ## Error handling
129
+
130
+ The client raises a small, specific exception hierarchy:
131
+
132
+ ```python
133
+ from phishingdetectionapi import PhishingDetectionClient
134
+ from phishingdetectionapi.client import (
135
+ PhishingDetectionError,
136
+ AuthenticationError,
137
+ RateLimitError,
138
+ )
139
+
140
+ try:
141
+ result = client.check("example.com")
142
+ except AuthenticationError:
143
+ # 401 — API key invalid or expired
144
+ rotate_api_key()
145
+ except RateLimitError:
146
+ # 429 — slow down or upgrade plan
147
+ backoff_and_retry()
148
+ except PhishingDetectionError as e:
149
+ # Any other API or network failure
150
+ log_error(e)
151
+ ```
152
+
153
+ The client is also a context manager, so the underlying HTTP session is cleaned up automatically:
154
+
155
+ ```python
156
+ with PhishingDetectionClient("your_api_key_here") as client:
157
+ result = client.check("suspicious.example.com")
158
+ ```
159
+
160
+ ## Integration patterns
161
+
162
+ ### Email gateway / MTA plugin
163
+
164
+ Intercept inbound mail at the MTA layer and check every URL extracted from message bodies and headers against the phishing database before delivery:
165
+
166
+ ```python
167
+ from phishingdetectionapi import PhishingDetectionClient
168
+ import re
169
+
170
+ client = PhishingDetectionClient("your_api_key_here")
171
+
172
+ def scan_email(raw_message):
173
+ urls = re.findall(r'https?://([^/\s"\']+)', raw_message)
174
+ domains = list(set(urls))
175
+ if not domains:
176
+ return True # no URLs, deliver
177
+
178
+ results = client.bulk_check(domains)
179
+ threats = [r for r in results["results"] if r["is_phishing"]]
180
+ if threats:
181
+ quarantine_message(raw_message, threats)
182
+ return False
183
+ return True
184
+ ```
185
+
186
+ ### Proxy or browser extension
187
+
188
+ Wrap the lookup in a lightweight middleware that intercepts HTTP requests before they leave the network:
189
+
190
+ ```python
191
+ def should_allow(domain):
192
+ result = client.check(domain)
193
+ if result["is_phishing"]:
194
+ return False, f"Blocked: known phishing domain ({result['category']})"
195
+ return True, None
196
+ ```
197
+
198
+ ### SIEM / SOAR playbook
199
+
200
+ Feed the daily threat list into your SIEM as a lookup table, then trigger automated containment when a match fires:
201
+
202
+ ```python
203
+ def refresh_siem_indicators():
204
+ feed = client.feed(format="json")
205
+ for entry in feed["domains"]:
206
+ siem_client.add_indicator(
207
+ value=entry["domain"],
208
+ type="domain",
209
+ threat_type=entry["category"],
210
+ confidence=entry["confidence"],
211
+ )
212
+ ```
213
+
214
+ ### DNS sinkhole
215
+
216
+ Export the feed to a flat file and load it into your DNS resolver (BIND RPZ, Pi-hole, AdGuard, Unbound) for network-wide protection:
217
+
218
+ ```python
219
+ with PhishingDetectionClient("your_api_key_here") as client:
220
+ feed = client.feed(format="json")
221
+ with open("/etc/bind/rpz/phishing.zone", "w") as fh:
222
+ for entry in feed["domains"]:
223
+ fh.write(f"{entry['domain']} CNAME .\n")
224
+ ```
225
+
226
+ ## Why domain-level phishing detection matters
227
+
228
+ 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.
229
+
230
+ 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.
231
+
232
+ ### The evolving phishing landscape
233
+
234
+ 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.
235
+
236
+ 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.
237
+
238
+ 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.
239
+
240
+ ### Industry use cases
241
+
242
+ 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.
243
+
244
+ 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.
245
+
246
+ ---
247
+
248
+ ## Related services
249
+
250
+ Organizations building layered security and content-filtering infrastructure may also benefit from these complementary services:
251
+
252
+ * **[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.
253
+
254
+ * **[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.
255
+
256
+ * **[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.
257
+
258
+ * **[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.
259
+
260
+ * **[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.
261
+
262
+ ---
263
+
264
+ ## Links
265
+
266
+ - Product and API documentation: [https://www.phishingdetectionapi.com](https://www.phishingdetectionapi.com)
267
+ - APWG Phishing Activity Trends: [https://apwg.org/](https://apwg.org/)
268
+ - NIST Phishing Guidance: [https://www.nist.gov/](https://www.nist.gov/)
269
+ - OWASP Phishing: [https://owasp.org/](https://owasp.org/)
270
+
271
+ ## License
272
+
273
+ MIT
274
+
275
+
@@ -0,0 +1,7 @@
1
+ phishingdetectionapi/__init__.py,sha256=klumj9teCxL99x9Vpqg0E72PAxtOmwUfmGf1lJEs30c,105
2
+ phishingdetectionapi/client.py,sha256=4lZ8tfQc8mCYCpeR_C_wEDKzmimtnLppzsnyzRTwFXM,2243
3
+ phishingdetectionapi-1.0.0.dist-info/LICENSE,sha256=-kjrwollysEMZkPQkJIq5zyefl9XyPw5egz8knSXiB4,1070
4
+ phishingdetectionapi-1.0.0.dist-info/METADATA,sha256=qZX9t_lYllwBQ4vU_Or5fW2B34KNWVtarp_FoF0miaU,13616
5
+ phishingdetectionapi-1.0.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
6
+ phishingdetectionapi-1.0.0.dist-info/top_level.txt,sha256=GJsAq0jsrgARyAjreLOCBCCEoyKKSJ0DIcFkAcOkXXY,21
7
+ phishingdetectionapi-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.45.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ phishingdetectionapi