@fanboynz/network-scanner 1.0.35
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.
- package/.github/workflows/npm-publish.yml +33 -0
- package/JSONMANUAL.md +121 -0
- package/LICENSE +674 -0
- package/README.md +357 -0
- package/config.json +74 -0
- package/lib/browserexit.js +522 -0
- package/lib/browserhealth.js +308 -0
- package/lib/cloudflare.js +660 -0
- package/lib/colorize.js +168 -0
- package/lib/compare.js +159 -0
- package/lib/compress.js +129 -0
- package/lib/fingerprint.js +613 -0
- package/lib/flowproxy.js +274 -0
- package/lib/grep.js +348 -0
- package/lib/ignore_similar.js +237 -0
- package/lib/nettools.js +1200 -0
- package/lib/output.js +633 -0
- package/lib/redirect.js +384 -0
- package/lib/searchstring.js +561 -0
- package/lib/validate_rules.js +1107 -0
- package/nwss.1 +824 -0
- package/nwss.js +2488 -0
- package/package.json +45 -0
- package/regex-samples.md +27 -0
- package/scanner-script-org.js +588 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-npm:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: 20
|
|
29
|
+
registry-url: https://registry.npmjs.org/
|
|
30
|
+
- run: npm ci
|
|
31
|
+
- run: npm publish
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
package/JSONMANUAL.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# JSON Configuration Manual for scanner-script.js (v0.8.7)
|
|
2
|
+
|
|
3
|
+
This document provides detailed explanations for each option available in the `config.json` file used by `scanner-script.js`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Root Fields
|
|
8
|
+
|
|
9
|
+
| Field | Type | Required | Description |
|
|
10
|
+
| --------------- | ---------------- | -------- | ------------------------------------------------- |
|
|
11
|
+
| `sites` | Array of objects | Yes | List of site config entries to scan |
|
|
12
|
+
| `ignoreDomains` | Array of strings | No | Domains to ignore (e.g., known CDN, safe domains) |
|
|
13
|
+
| `blocked` | Array of strings | No | Regex patterns to block globally during scan |
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Per-Site Fields
|
|
18
|
+
|
|
19
|
+
| Field | Type | Default | Description |
|
|
20
|
+
| ------------------------ | -------------------------------------- | ------- | ------------------------------------------------- |
|
|
21
|
+
| `url` | String or Array | – | Target URL(s) to scan |
|
|
22
|
+
| `filterRegex` | String or Array (regex) | – | Regex(es) to match request URLs for detection |
|
|
23
|
+
| `blocked` | Array of strings (regex) | – | Regex patterns to block network requests |
|
|
24
|
+
| `interact` | Boolean | false | Simulate mouse movement/clicks on page |
|
|
25
|
+
| `isBrave` | Boolean | false | Spoof `navigator.brave` to bypass Brave detection |
|
|
26
|
+
| `userAgent` | String (`chrome`, `firefox`, `safari`) | – | Spoof User-Agent string |
|
|
27
|
+
| `timeout` | Number (ms) | 40000 | Max time to wait before aborting page load |
|
|
28
|
+
| `delay` | Number (ms) | 2000 | Delay after page load before evaluating requests |
|
|
29
|
+
| `reload` | Number | 1 | How many times to reload the page |
|
|
30
|
+
| `subDomains` | Number (0 or 1) | 0 | Output full subdomains if set to 1 |
|
|
31
|
+
| `localhost` | Boolean | false | Output rules as `127.0.0.1 domain.com` |
|
|
32
|
+
| `localhost_0_0_0_0` | Boolean | false | Output rules as `0.0.0.0 domain.com` |
|
|
33
|
+
| `source` | Boolean | false | Save HTML source after page load |
|
|
34
|
+
| `firstParty` | Boolean | false | Include first-party requests |
|
|
35
|
+
| `thirdParty` | Boolean | true | Include third-party requests |
|
|
36
|
+
| `screenshot` | Boolean | false | Capture screenshot on load failure |
|
|
37
|
+
| `headful` | Boolean | false | Run browser in non-headless mode for this site |
|
|
38
|
+
| `fingerprint_protection` | Boolean or "random" | false | Enable spoofing of device memory, screen, etc. |
|
|
39
|
+
| `evaluateOnNewDocument` | Boolean | false | Inject JS to log `fetch`/XHR calls from page |
|
|
40
|
+
| `cdp` | Boolean | false | Enable Chrome DevTools Protocol logging |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Field Descriptions (Detailed)
|
|
45
|
+
|
|
46
|
+
### `url`
|
|
47
|
+
|
|
48
|
+
Specifies the webpage(s) to scan. Can be a single URL string or an array of URLs. This is the entry point for Puppeteer to navigate to.
|
|
49
|
+
|
|
50
|
+
### `filterRegex`
|
|
51
|
+
|
|
52
|
+
One or more regex patterns that determine which request URLs should be matched and turned into adblock rules. For example, `/track/`, `/analytics.js$/`.
|
|
53
|
+
|
|
54
|
+
### `blocked`
|
|
55
|
+
|
|
56
|
+
Used to actively block specific network requests using Puppeteer's interception. This prevents those requests from being sent at all.
|
|
57
|
+
|
|
58
|
+
### `interact`
|
|
59
|
+
|
|
60
|
+
If enabled, simulates basic user interactions such as mouse movements and clicks. Useful for triggering lazy-loaded elements or interactive trackers.
|
|
61
|
+
|
|
62
|
+
### `isBrave`
|
|
63
|
+
|
|
64
|
+
Spoofs `navigator.brave` object so sites that detect Brave browser will believe it's running. Helps bypass anti-Brave scripts.
|
|
65
|
+
|
|
66
|
+
### `userAgent`
|
|
67
|
+
|
|
68
|
+
Overrides the default user-agent string with one that mimics Chrome, Firefox, or Safari on desktop. Useful for evading UA-based fingerprinting.
|
|
69
|
+
|
|
70
|
+
### `delay`
|
|
71
|
+
|
|
72
|
+
Milliseconds to wait after page load completes before evaluating network requests. Helps ensure trackers that load late are included.
|
|
73
|
+
|
|
74
|
+
### `reload`
|
|
75
|
+
|
|
76
|
+
If set to >1, reloads the page multiple times. Each reload allows scanning additional resources that load inconsistently or dynamically.
|
|
77
|
+
|
|
78
|
+
### `subDomains`
|
|
79
|
+
|
|
80
|
+
When enabled (`1`), uses full subdomains in adblock output (e.g., `cdn.ads.example.com`). If disabled, collapses to root domain (`example.com`).
|
|
81
|
+
|
|
82
|
+
### `localhost` / `localhost_0_0_0_0`
|
|
83
|
+
|
|
84
|
+
If enabled, outputs domains in the form `127.0.0.1 domain.com` or `0.0.0.0 domain.com` respectively—useful for local blacklists.
|
|
85
|
+
|
|
86
|
+
### `source`
|
|
87
|
+
|
|
88
|
+
If true, saves the full HTML source of the page after it finishes loading. Helpful for debugging or archival.
|
|
89
|
+
|
|
90
|
+
### `firstParty` and `thirdParty`
|
|
91
|
+
|
|
92
|
+
Controls which types of requests to include in detection. `firstParty` includes requests to the same domain; `thirdParty` includes cross-origin requests.
|
|
93
|
+
|
|
94
|
+
### `screenshot`
|
|
95
|
+
|
|
96
|
+
Takes a full-page screenshot **only if** the page fails to load. Useful for debugging.
|
|
97
|
+
|
|
98
|
+
### `headful`
|
|
99
|
+
|
|
100
|
+
Overrides headless mode to show the browser GUI. Can be useful for debugging visual elements or captcha gates.
|
|
101
|
+
|
|
102
|
+
### `fingerprint_protection`
|
|
103
|
+
|
|
104
|
+
Injects spoofed browser characteristics (like screen size, platform, memory, CPU). Can be static (`true`) or randomized (`"random"`).
|
|
105
|
+
|
|
106
|
+
### `evaluateOnNewDocument`
|
|
107
|
+
|
|
108
|
+
Injects JS into the page before any script runs. Overrides `fetch()` and `XMLHttpRequest` to log third-party requests made from within the page’s JavaScript.
|
|
109
|
+
|
|
110
|
+
### `timeout`
|
|
111
|
+
|
|
112
|
+
Maximum time (in milliseconds) the browser should wait when loading a page before timing out. Default is 40000ms (40 seconds). Increase this if scanning slow-loading sites.
|
|
113
|
+
|
|
114
|
+
### `cdp`
|
|
115
|
+
|
|
116
|
+
Enables Chrome DevTools Protocol for full visibility of network requests, including types like `HEAD`, WebSockets, preloads, and others missed by Puppeteer. for full visibility of network requests, including types like `HEAD`, WebSockets, preloads, and others missed by Puppeteer.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
For questions or examples, see the README or run with `--help`.
|
|
121
|
+
|