wpchecker 0.2.2__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.
wpchecker/versions.py ADDED
@@ -0,0 +1,81 @@
1
+ """Version parsing and advisory-range matching.
2
+
3
+ Versions in the WordPress ecosystem are dotted numbers with
4
+ the occasional suffix ("5.0.1", "3.18.1", "1.0-beta3"). The
5
+ numeric core decides first; a pre-release suffix then ranks
6
+ BELOW the plain release (dev < alpha < beta < rc < release),
7
+ numbered suffixes order among themselves (beta2 < beta3),
8
+ and a patch-level suffix ("1.0pl1") ranks just above the
9
+ release it patches. The stability ordering and ranks mirror
10
+ phpscan's audit.py, so the two tools never disagree about
11
+ which of two versions is newer — in particular, a beta or
12
+ RC of the fixed version is NOT the fixed version. A version
13
+ string with no numeric core is unparseable and never matches
14
+ anything — the scanner does not guess.
15
+ """
16
+
17
+ import re
18
+
19
+ # Stability ranks, mirrored from phpscan's audit.py.
20
+ _STABILITY = {"dev": 0, "alpha": 1, "a": 1, "beta": 2, "b": 2,
21
+ "rc": 3, "stable": 4, "patch": 5, "pl": 5, "p": 5}
22
+ _STABLE = _STABILITY["stable"]
23
+
24
+ _VER_RE = re.compile(
25
+ r"^(\d+(?:\.\d+)*)"
26
+ r"(?:[-.]?(patch|alpha|beta|dev|rc|pl|a|b|p)"
27
+ r"(?:[-.]?(\d+))?)?", re.I)
28
+ _TERM_RE = re.compile(r"^(>=|<=|==|!=|>|<)\s*(\S+)$")
29
+
30
+
31
+ def parse_version(text):
32
+ """Parse a version string into a comparable key:
33
+ ((numeric, core), stability rank, suffix number).
34
+
35
+ '3.18.1' -> ((3, 18, 1), 4, 0); '1.0-beta3' ->
36
+ ((1, 0), 2, 3) — a pre-release OF 1.0, not 1.0 itself.
37
+ None when the string carries no numeric version."""
38
+ if text is None:
39
+ return None
40
+ m = _VER_RE.match(str(text).strip())
41
+ if not m:
42
+ return None
43
+ nums = tuple(int(p) for p in m.group(1).split("."))
44
+ word = m.group(2)
45
+ rank = _STABILITY[word.lower()] if word else _STABLE
46
+ num = int(m.group(3) or 0)
47
+ return (nums, rank, num)
48
+
49
+
50
+ def _cmp(a, b):
51
+ (an, ar, anum), (bn, br, bnum) = a, b
52
+ n = max(len(an), len(bn))
53
+ an = an + (0,) * (n - len(an))
54
+ bn = bn + (0,) * (n - len(bn))
55
+ ka, kb = (an, ar, anum), (bn, br, bnum)
56
+ return (ka > kb) - (ka < kb)
57
+
58
+
59
+ def _term_matches(version, term):
60
+ m = _TERM_RE.match(term.strip())
61
+ if not m:
62
+ return False
63
+ op, target = m.group(1), parse_version(m.group(2))
64
+ if target is None:
65
+ return False
66
+ c = _cmp(version, target)
67
+ return {">=": c >= 0, "<=": c <= 0, "==": c == 0,
68
+ "!=": c != 0, ">": c > 0, "<": c < 0}[op]
69
+
70
+
71
+ def in_range(version_text, range_text):
72
+ """True when version_text satisfies every comma-separated
73
+ term of range_text (">=3.3.0,<=3.18.1", "<=3.5.5", "<6.9",
74
+ "==1.2.3"). Unparseable input is False, never a guess."""
75
+ v = parse_version(version_text)
76
+ if v is None or not range_text:
77
+ return False
78
+ terms = [t for t in str(range_text).split(",") if t.strip()]
79
+ if not terms:
80
+ return False
81
+ return all(_term_matches(v, t) for t in terms)
@@ -0,0 +1,290 @@
1
+ Metadata-Version: 2.4
2
+ Name: wpchecker
3
+ Version: 0.2.2
4
+ Summary: Free external WordPress plugin/theme vulnerability scanner — passive fingerprinting plus read-only fetches of files WordPress sites serve publicly. No exploit probes, no API key.
5
+ Author: Superstar Telecom LLC
6
+ License: MIT
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ # wpchecker
13
+
14
+ A free, external WordPress plugin/theme vulnerability scanner.
15
+
16
+ ```bash
17
+ pip install wpchecker
18
+ wpchecker scan https://your-site.com
19
+ ```
20
+
21
+ wpchecker reads what your site itself discloses — the
22
+ homepage's generator tag and enqueued asset URLs, each
23
+ plugin's public `readme.txt`, the active theme's `style.css`,
24
+ and `/readme.html` — and matches those disclosed versions
25
+ against a bundled advisory dataset built from public data
26
+ (NVD + CVE.org ranges, CISA KEV flags). **No account, no API
27
+ key, no call cap.** Python standard library only, zero
28
+ dependencies.
29
+
30
+ It never sends an exploit probe. There is no aggressive
31
+ mode, no username enumeration, no password brute-forcing —
32
+ if a site does not disclose a component's version, wpchecker
33
+ reports it as **version hidden** and does not assess it. A
34
+ hidden version is not treated as evidence of a vulnerability,
35
+ and a component missing from the dataset is reported as
36
+ **not in dataset**, never silently passed.
37
+
38
+ Every finding carries a remediation. Where the public
39
+ sources publish no fixed version, the finding says
40
+ "no fixed version published" instead of inventing one.
41
+
42
+ ## Install
43
+
44
+ One line, from PyPI (Python 3.11+):
45
+
46
+ ```bash
47
+ pip install wpchecker
48
+ wpchecker scan https://your-site.com
49
+ ```
50
+
51
+ On systems that refuse with "externally-managed-environment"
52
+ (Debian/Ubuntu and Homebrew Pythons), use pipx or a virtual
53
+ environment instead.
54
+
55
+ For a CLI tool, pipx is the recommended route — it keeps
56
+ wpchecker's dependencies isolated from your system Python
57
+ (there are none, but the habit is sound):
58
+
59
+ ```bash
60
+ python3 -m pip install --user pipx # if you don't have pipx yet
61
+ pipx install wpchecker
62
+ ```
63
+
64
+ Also available directly from GitHub
65
+ (`pip install git+https://github.com/PHPatch/wpchecker.git`)
66
+ or by cloning this repo.
67
+
68
+ > **Note:** the PyPI release is being registered; until the
69
+ > first upload lands, install from GitHub.
70
+
71
+ ## Usage
72
+
73
+ ```bash
74
+ wpchecker scan https://example.com # JSON verdict
75
+ wpchecker scan https://example.com --text # human-readable
76
+ wpchecker scan https://a.com https://b.com # several sites
77
+ wpchecker save-snapshot https://example.com ./snap # capture evidence
78
+ wpchecker scan --snapshot ./snap # replay it, offline
79
+ ```
80
+
81
+ Example (trimmed):
82
+
83
+ ```text
84
+ wpchecker 0.2.0 — https://example.com
85
+ WordPress core: 6.4.2 (generator tag)
86
+
87
+ PLUGINS
88
+ duplicator — Duplicator 1.3.27 (asset URL)
89
+ VULNERABLE — CVE-2020-11738 (HIGH, CVSS 7.5, CISA KEV)
90
+ affected: <1.3.28 · installed: 1.3.27
91
+ remediation: Update Duplicator to 1.3.28 or later (installed: 1.3.27).
92
+ elementor — Elementor Website Builder 3.5.3 (asset URL)
93
+ VULNERABLE — CVE-2022-29455 (MEDIUM, CVSS 4.7)
94
+ affected: <=3.5.5 · installed: 3.5.3
95
+ remediation: No fixed version has been published for CVE-2022-29455; disable or remove Elementor Website Builder until the vendor ships a fix, and watch the advisory feed for the fix.
96
+ wpdiscuz — wpDiscuz version hidden
97
+ version hidden — not assessed
98
+
99
+ Summary: 3 plugins, 1 themes, 1 version hidden, 2 findings, 0 hygiene findings.
100
+ ```
101
+
102
+ (The Elementor line is the "no fixed version published"
103
+ rule at work: the CNA record structures the affected
104
+ range but no fixed version, so the tool says so instead
105
+ of inventing 3.5.6.)
106
+
107
+ Exit codes: **0** — scanned, no findings; **1** — at least
108
+ one finding (a vulnerable component or a hygiene exposure);
109
+ **2** — usage error, or a target could not be judged at all
110
+ (unreachable, or not a WordPress site). With several
111
+ targets, the worst code wins.
112
+
113
+ ## What it checks
114
+
115
+ - **WordPress core version** — from the generator tag,
116
+ enqueued `wp-includes` asset versions, or `/readme.html`.
117
+ The version is reported; plugin/theme advisories are the
118
+ assessed surface.
119
+ - **Plugins** — enumerated from `wp-content/plugins/<slug>/`
120
+ asset URLs in the page source and their `?ver=` strings.
121
+ For a plugin whose version the page hides, the public
122
+ `readme.txt` "Stable tag" is read instead. (`Stable tag:
123
+ trunk` is a development state, not a version — it stays
124
+ "version hidden".)
125
+ - **Themes** — the active theme's version comes from its
126
+ `style.css` header, a public file.
127
+ - **Hygiene** — a publicly served `/readme.html` hands the
128
+ exact core version to anyone who asks; it is reported
129
+ with its remediation (delete it or block it).
130
+
131
+ ## Verdicts
132
+
133
+ | Verdict | Meaning |
134
+ | --- | --- |
135
+ | `vulnerable` | The disclosed version falls inside a published affected range. The finding names the CVE, the range, and the remediation. |
136
+ | `no_known_vulnerabilities` | The disclosed version matches no advisory in the dataset. |
137
+ | `version_hidden` | Detected, but the site does not disclose its version. **Not assessed** — and not a finding. |
138
+ | `not_in_dataset` | The component is not covered by the starter dataset. Not assessed; absence is not a clean bill of health. |
139
+ | `not_wordpress` / `unreachable` | The scan could not judge the target (exit 2). |
140
+
141
+ ## Snapshot replay
142
+
143
+ Every other WordPress scanner needs a live target. Their
144
+ "offline" claims cover only the vulnerability *database* —
145
+ never the target *evidence*. wpchecker replays evidence:
146
+
147
+ ```bash
148
+ wpchecker save-snapshot https://client-site.com ./client-snap
149
+ wpchecker scan --snapshot ./client-snap # zero requests
150
+ ```
151
+
152
+ `save-snapshot` captures exactly what a live scan would
153
+ read — the homepage, `/readme.html`, the plugin
154
+ `readme.txt` files the scan probes, and the theme
155
+ `style.css` files — using the same SSRF-guarded fetcher
156
+ and the same probe plan. `scan --snapshot` then runs the
157
+ identical scan engine over the captures and makes **no
158
+ network requests at all**. The verdict carries
159
+ `mode: "snapshot"` and a `snapshot` block with the
160
+ capture timestamp, so a replayed verdict never poses as a
161
+ live one.
162
+
163
+ For: agencies auditing client exports, incident responders
164
+ working from captured pages, owners who won't point a
165
+ scanner at production, CI jobs replaying fixture sites.
166
+ Positioning line, because it's true: *the scanner that
167
+ doesn't need to touch your site.*
168
+
169
+ ### Snapshot format
170
+
171
+ A snapshot is a plain directory — you can also build one
172
+ by hand, or from any mirror/export that has these files:
173
+
174
+ ```
175
+ client-snap/
176
+ snapshot.json manifest (below)
177
+ homepage.html the captured homepage body
178
+ readme.html captured /readme.html (optional)
179
+ components/
180
+ contact-form-7.readme.txt per-slug captures (optional)
181
+ flavor.style.css
182
+ ```
183
+
184
+ `snapshot.json`:
185
+
186
+ ```json
187
+ {
188
+ "tool": "wpchecker-snapshot",
189
+ "version": 1,
190
+ "target": "https://client-site.com",
191
+ "final_url": "https://client-site.com/",
192
+ "captured_at": "2026-10-30T14:22:31Z",
193
+ "files": {
194
+ "homepage": "homepage.html",
195
+ "readme_html": "readme.html",
196
+ "plugin_readmes": {"contact-form-7": "components/contact-form-7.readme.txt"},
197
+ "theme_styles": {"flavor": "components/flavor.style.css"}
198
+ },
199
+ "headers": {
200
+ "homepage": {"link": "<https://client-site.com/wp-json/>; rel=\"https://api.w.org/\""}
201
+ }
202
+ }
203
+ ```
204
+
205
+ Only `homepage` is required; a file the site didn't serve
206
+ is simply absent from the manifest, and the replay treats
207
+ it exactly as a live scan treats a 404. The homepage's
208
+ response headers are captured and replayed too — live
209
+ detection reads them (the REST `Link:` header is a
210
+ WordPress signal), so a header-only-detectable site replays
211
+ to the same verdict it scans live. Manifest paths are
212
+ containment-checked with symlinks resolved, and reads are
213
+ size-capped — a snapshot handed to you by someone else
214
+ cannot make the reader open files outside the snapshot
215
+ directory.
216
+
217
+ ## The dataset
218
+
219
+ `wpchecker/data/wp_advisories.json` is a starter set: the
220
+ 44 WordPress plugins/themes most named by CISA
221
+ KEV and mass-exploitation reporting, carrying 49
222
+ advisories. Every entry was verified at build time against
223
+ three public sources:
224
+
225
+ - **NVD API 2.0** — affected-version ranges from CPE match
226
+ criteria (with the record's own description as a second
227
+ range source) and CVSS scores;
228
+ - **CVE.org** — the CNA's structured affected ranges;
229
+ - **CISA KEV** — flags for CVEs known to be exploited in
230
+ the wild (only a small share of WordPress plugin CVEs are
231
+ KEV-listed; the flag means the catalog says so, nothing
232
+ more).
233
+
234
+ A candidate that no source ties to its plugin with a
235
+ version range is dropped at build time, never silently
236
+ kept. Refresh it with `tools/refresh_advisories.py` (the
237
+ curated slug/CVE list lives there). No WPScan or Wordfence
238
+ data is used or redistributed — their databases are
239
+ theirs; this one is built from public sources and MIT
240
+ licensed with the tool.
241
+
242
+ The dataset is also published as feeds
243
+ (`tools/build_feed.py`): `feeds/wp-plugin-advisories.json`
244
+ and an Atom feed of the 50 most recent advisories, in the
245
+ same shapes as [phpscan](https://github.com/PHPatch/phpscan)'s
246
+ PHP advisory feeds.
247
+
248
+ ## How it compares to WPScan
249
+
250
+ WPScan is the incumbent and its database is far larger —
251
+ 44 components is a starter set, not a rival
252
+ census, and wpchecker says so on the tin. The differences
253
+ that matter (checked against wpscan.com on 2026-10-30):
254
+
255
+ | | wpchecker | WPScan |
256
+ | --- | --- | --- |
257
+ | Vulnerability data | Bundled in the tool, from public sources | Served through the WPScan API — one API request per core/plugin/theme checked |
258
+ | Account / key | None | API token required for vulnerability data |
259
+ | Cost | Free, MIT licensed | API free for non-commercial use up to 25 API calls/day; commercial use needs a paid license; WPScan itself is custom-licensed, not open source |
260
+ | Methods | Passive only: what the site discloses + public files | Passive/mixed/aggressive modes, incl. username enumeration and password brute-forcing (which wpchecker refuses to do) |
261
+ | Remediation | On every finding | Fixed version provided when released |
262
+ | Offline evidence replay | ✓ `scan --snapshot <dir>` — full verdict from saved captures, zero requests | ✗ a live target is required; "offline" covers only the database |
263
+
264
+ ## Safety
265
+
266
+ The fetcher is SSRF-guarded (mirroring phpscan): targets
267
+ must resolve — every answer — to globally routable public
268
+ addresses; connections are pinned to the checked IP with
269
+ SNI/certificate verification; every redirect hop is
270
+ re-validated; bodies are capped and one deadline bounds
271
+ the whole scan. Only ports 80/443, no URL credentials, no
272
+ non-standard IP encodings.
273
+
274
+ Only scan sites you own or are authorized to assess.
275
+
276
+ ## Security
277
+
278
+ See [SECURITY.md](SECURITY.md) — reports to
279
+ security@phpatch.com, response SLAs, and the PHPatch
280
+ Security PGP key that signs releases.
281
+
282
+ ## License
283
+
284
+ MIT. The advisory dataset is built from public U.S.
285
+ government and CVE registry data (NVD, CISA KEV, CVE.org).
286
+
287
+ wpchecker is part of the [PHPatch](https://phpatch.com)
288
+ scanner family, alongside
289
+ [phpscan](https://github.com/PHPatch/phpscan) for PHP
290
+ itself.
@@ -0,0 +1,13 @@
1
+ wpchecker/__init__.py,sha256=K1zc-OJuaHzc-bssSV7imFb5sA71u0mkynrfcuXrGNY,265
2
+ wpchecker/__main__.py,sha256=b04XOIOuO2t-r-Tq6nwVZt0Kwke1URymdsWDATZCh4Y,3573
3
+ wpchecker/advisories.py,sha256=ZPp-vJq6sQA0v_ABwrRTlKnlfQrRQ774mBSy6b0vEeI,3782
4
+ wpchecker/fetch.py,sha256=Q-vIUr5aRVcPyyzkO2M6eDMe-7tEx5cLVjYxfRP5jP4,10426
5
+ wpchecker/scan.py,sha256=rsGSm4xJn_zO8fsKTMnd3x5qKmCgLXgN5N2dRCgLvVs,24255
6
+ wpchecker/versions.py,sha256=iq7-PFh0EE-CtdgYN0ISuNqVYe2wwcvgpEox3umjWKI,2829
7
+ wpchecker/data/wp_advisories.json,sha256=jVUH7Me20e94xAqvUgVuGXUDDhCOTTIIMU-2aQJ7W_A,33090
8
+ wpchecker-0.2.2.dist-info/licenses/LICENSE,sha256=JJcWb6zutNQNCoxUfL1OPnUO8-_HIQWZVwVl2Iz5Pfw,1078
9
+ wpchecker-0.2.2.dist-info/METADATA,sha256=lcWC3qOCxdlTwjmumgDrYL3uBTDUo2qOcL2eVZzfUI0,11200
10
+ wpchecker-0.2.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
11
+ wpchecker-0.2.2.dist-info/entry_points.txt,sha256=xSoLtcicpLQXXoLOm69jWtLLLnjNwKQLh8zezmiwG5s,53
12
+ wpchecker-0.2.2.dist-info/top_level.txt,sha256=xaHfJ23rowiMDf7aZti4Gf7bXQk1VMrja1bKFEaPQzk,10
13
+ wpchecker-0.2.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ wpchecker = wpchecker.__main__:cli
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Superstar Telecom LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ wpchecker