From 36023b27d32c3bf02378ac980d3ca39c916ea99f Mon Sep 17 00:00:00 2001 From: Wasim Akram <55689108+wasimness@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:24:32 +0530 Subject: [PATCH 1/2] feat: split rule sources and import files, add import guide (0.2.0) Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 16 ++- CONTRIBUTING.md | 4 +- README.md | 31 +++-- docs/IMPORT.md | 49 ++++++++ rules/in/allow.txt | 3 - rules/in/allow/IN-1601.txt | 6 + rules/in/allow/IN-AMAZON.txt | 6 + rules/in/block.txt | 6 - rules/in/block/IN-140.txt | 6 + rules/in/block/IN-BULK-MOBILE.txt | 6 + rules/in/block/IN-CC-BLR.txt | 6 + rules/in/block/IN-CC-LANDLINE.txt | 6 + rules/in/optional-block.txt | 2 - rules/in/optional/IN-1600.txt | 6 + rules/in/patterns.md | 12 ++ spamblocker/complete.gz | Bin 0 -> 1093 bytes .../{spamwall-in.json => complete.json} | 8 +- spamblocker/rules-default.gz | Bin 0 -> 651 bytes spamblocker/rules-default.json | 113 ++++++++++++++++++ spamblocker/rules-strict.gz | Bin 0 -> 721 bytes ...mwall-in-strict.json => rules-strict.json} | 102 +--------------- spamblocker/settings.gz | Bin 0 -> 529 bytes spamblocker/settings.json | 100 ++++++++++++++++ spamblocker/spamwall-in-strict.gz | Bin 1173 -> 0 bytes spamblocker/spamwall-in.gz | Bin 1094 -> 0 bytes tools/build_spamblocker.py | 73 ++++++++--- tools/check.py | 45 ++++++- 27 files changed, 456 insertions(+), 150 deletions(-) create mode 100644 docs/IMPORT.md delete mode 100644 rules/in/allow.txt create mode 100644 rules/in/allow/IN-1601.txt create mode 100644 rules/in/allow/IN-AMAZON.txt delete mode 100644 rules/in/block.txt create mode 100644 rules/in/block/IN-140.txt create mode 100644 rules/in/block/IN-BULK-MOBILE.txt create mode 100644 rules/in/block/IN-CC-BLR.txt create mode 100644 rules/in/block/IN-CC-LANDLINE.txt delete mode 100644 rules/in/optional-block.txt create mode 100644 rules/in/optional/IN-1600.txt create mode 100644 rules/in/patterns.md create mode 100644 spamblocker/complete.gz rename spamblocker/{spamwall-in.json => complete.json} (100%) create mode 100644 spamblocker/rules-default.gz create mode 100644 spamblocker/rules-default.json create mode 100644 spamblocker/rules-strict.gz rename spamblocker/{spamwall-in-strict.json => rules-strict.json} (68%) create mode 100644 spamblocker/settings.gz create mode 100644 spamblocker/settings.json delete mode 100644 spamblocker/spamwall-in-strict.gz delete mode 100644 spamblocker/spamwall-in.gz diff --git a/CHANGELOG.md b/CHANGELOG.md index f5ff566..100214b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ## [Unreleased] +## [0.2.0] - 2026-11-27 + +### Added +- Separate import files: `settings.gz` (Others), `rules-default.gz` and `rules-strict.gz` (Regex Settings), and `complete.gz` (both), each with a readable `.json` twin. +- `docs/IMPORT.md`: which file to pick, step-by-step import, nuances and manual steps. +- `rules/in/patterns.md`, a generated table of every pattern. +- Checks for file header comments, IDs matching file names and shared priorities. + +### Changed +- Rule sources split into one file per pattern under `rules/in/allow/`, `block/` and `optional/`. +- README Quick start shortened; added a Files table and a Releases line. +- Removed `spamwall-in*.{gz,json}` (replaced by the files above). + ## [0.1.0] - 2026-11-27 ### Added @@ -13,5 +26,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - One-click SpamBlocker import files and plain regex lists. - Unblock-request and new-pattern issue templates. -[Unreleased]: https://github.com/wasimness/spamwall/compare/v0.1.0...HEAD +[Unreleased]: https://github.com/wasimness/spamwall/compare/v0.2.0...HEAD +[0.2.0]: https://github.com/wasimness/spamwall/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/wasimness/spamwall/releases/tag/v0.1.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb756aa..c22d5c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,9 +1,9 @@ # Contributing -- Rules live in `rules//`: `allow.txt`, `block.txt`, `optional-block.txt` and `allow-apps.txt`. +- Rules live in `rules//`: one file per pattern in `allow/`, `block/` and `optional/` (named by ID), and `allow-apps.txt`. - One regex per line, matched against the national number (no country code, no leading 0), followed by `# ID | what | source`. - Prefer a range (pattern) over single numbers, but keep it narrow: a block must not catch shopping, delivery, ride, payment, bank or government service calls. -- Never add official service series (India: 1600, 1601) to `block.txt`. +- Never add official service series (India: 1600, 1601) to `block/`. - Never commit personal phone numbers or call logs. - After editing, run `python -I tools/build_spamblocker.py` and commit the rebuilt files in `spamblocker/`. - Fix false positives first. An unblock request outranks a new block. diff --git a/README.md b/README.md index f4229f7..fb3673b 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,24 @@ spamwall is a separate community project and is not made by or affiliated with S ## Quick start (SpamBlocker) -1. In SpamBlocker, export a backup first: **Settings > Backup > Export**. An import replaces your number rules. -2. Download [`spamblocker/spamwall-in.gz`](spamblocker/spamwall-in.gz) to your phone. -3. **Settings > Backup > Import**, pick the file, keep only **Others** and **Regex Settings** under *Include Settings*, then tap **Import**. -4. **Recent Apps** comes pre-filled with the shopping, delivery, ride, payment and government apps in [`rules/in/allow-apps.txt`](rules/in/allow-apps.txt), set to 120 minutes. If you used one of them in the last 2 hours, any call gets through, so delivery riders and drivers on masked numbers reach you. Apps you have not installed are ignored. Add your own bank and broker apps in **Settings > Recent Apps**. -5. Check that **Contacts**, **Repeated Call**, **Dialed Number** and **Answered Number** are on. +1. Export a backup first (**Settings > Backup > Export**), because an import replaces your number rules. +2. Download [`spamblocker/complete.gz`](spamblocker/complete.gz), then **Settings > Backup > Import** and pick it. +3. Follow the full guide, including the manual steps the import cannot do: [docs/IMPORT.md](docs/IMPORT.md). -Want bank and insurance service calls blocked too? Use `spamwall-in-strict.gz` instead, and add your own banks' 1600 numbers to your contacts first. +## Files + +| File | What it has | +|---|---| +| [`spamblocker/settings.gz`](spamblocker/settings.gz) | Only the Others category (contacts, STIR, repeated call, dialed, answered, Recent Apps) | +| [`spamblocker/rules-default.gz`](spamblocker/rules-default.gz) | Only the Regex Settings category: allow rules and default block rules | +| [`spamblocker/rules-strict.gz`](spamblocker/rules-strict.gz) | `rules-default` plus IN-1600 (bank and government service calls) | +| [`spamblocker/complete.gz`](spamblocker/complete.gz) | `settings` plus `rules-default`, for a one-tap full setup | +| [`rules/in/`](rules/in/) | One file per pattern in `allow/`, `block/` and `optional/`, plus [`allow-apps.txt`](rules/in/allow-apps.txt) | +| [`rules/in/patterns.md`](rules/in/patterns.md) | Table of every pattern, generated from the files | + +Each `.gz` has a readable `.json` twin. + +**Releases:** download the files from the [latest release](../../releases/latest). ## How the rules are checked @@ -33,9 +44,9 @@ SpamBlocker checks higher priorities first. Allow and block rules never share a | Priority | Type | Rules | |---|---|---| -| 15 | Allow | `allow.txt` (official delivery series, known support numbers) | +| 15 | Allow | `rules/in/allow/` (official delivery series, known support numbers) | | 10 | Allow | Contacts, repeated calls, numbers you dialled or answered, Recent Apps (built into SpamBlocker) | -| 5 | Block | `block.txt` | +| 5 | Block | `rules/in/block/` | ## India rules @@ -57,7 +68,7 @@ Numbers are matched without `+91` or a leading `0`. | IN-CC-BLR | `^(803710\|...)\d{4}$` | Narrow Bengaluru call-centre blocks. Bengaluru `080` numbers are not blocked as a whole, because delivery apps call from them | Clustered from community spam reports | | IN-BULK-MOBILE | `^(657350\|...)\d{4}$` | Mobile number blocks used for bulk telemarketing | Clustered from community spam reports | -### Optional (strict file only) +### Optional (`rules-strict` only) | ID | Pattern | What it blocks | Why it is off by default | |---|---|---|---| @@ -71,7 +82,7 @@ Open an [**Unblock request**](../../issues/new?template=unblock-request.yml). Gi ## Contributing -See [CONTRIBUTING.md](CONTRIBUTING.md). Edit the `.txt` files in `rules//`, then run `python -I tools/build_spamblocker.py` to rebuild the import files. +See [CONTRIBUTING.md](CONTRIBUTING.md). Edit the files in `rules//allow/`, `block/` and `optional/`, then run `python -I tools/build_spamblocker.py` to rebuild the import files. ## License diff --git a/docs/IMPORT.md b/docs/IMPORT.md new file mode 100644 index 0000000..a74539a --- /dev/null +++ b/docs/IMPORT.md @@ -0,0 +1,49 @@ +# Import guide (SpamBlocker) + +## What you need + +SpamBlocker for Android, from [F-Droid](https://f-droid.org/packages/spam.blocker/) or the [GitHub releases](https://github.com/aj3423/SpamBlocker/releases). Download the spamwall files from the [latest release](../../releases/latest). + +## Which file to pick + +| File | What it has | Pick it when | +|---|---|---| +| `complete.gz` | Settings plus default rules (both categories) | You want a full setup in one tap | +| `settings.gz` | Only the "Others" category: contacts, STIR, repeated call, dialed, answered, Recent Apps (120 min) | You want the settings without touching your number rules | +| `rules-default.gz` | Only the "Regex Settings" category: all allow rules and the default block rules | You want the rules without touching your settings | +| `rules-strict.gz` | Same as `rules-default.gz` plus IN-1600 | You also want bank, insurer and government service calls blocked (add your own bank and broker numbers to contacts first) | + +Each file also has a readable `.json` twin in `spamblocker/`. + +## Step-by-step import + +1. In SpamBlocker, open **Settings > Backup > Export** and save a backup of your current setup first. +2. Download the file you picked to your phone. +3. Open **Settings > Backup > Import** and pick the file. +4. In the **Include Settings** dialog, tap a category to move it between Include and Exclude. Keep only the category the file has (Others for `settings.gz`, Regex Settings for `rules-*.gz`, both for `complete.gz`). +5. Confirm the import. + +## Nuances + +- Import REPLACES the whole section. Number rules are cleared and re-added, so importing a `rules-*.gz` file (or `complete.gz`) deletes your own number rules. Export first, or add your own rules again afterwards. +- A file that lacks a category shows "This setting is missing from the backup file and cannot be restored" for that category. Exclude it, as in step 4. +- Allow and block rules must never share a priority. Here allow is 15, the built-in allow checks are 10 and block is 5. +- Numbers are matched without +91 or a leading 0. +- Recent Apps ignores apps that are not installed. +- If you install a new shopping app, add it in Recent Apps by hand. + +## Manual steps the import cannot do + +- Grant SpamBlocker's permissions when it asks: the call screening role, contacts, and usage access for Recent Apps. +- Turn on SMS screening under **Settings > Screening** if you want it, and follow the app's prompts. +- Add your own bank and broker numbers to contacts (with the strict file). +- Optionally turn off Tellows, which sends unknown numbers to tellows.com. +- On Xiaomi/MIUI, allow autostart and set no battery restriction for SpamBlocker so screening keeps running. + +## Using single patterns in another app + +Each pattern is one file: `rules/in//.txt`, where type is `allow`, `block` or `optional`. Copy the regex from the line (the part before `#`) into any blocker that accepts regular expressions. [`rules/in/patterns.md`](../rules/in/patterns.md) lists every pattern. + +## Undo + +Import the backup you exported in step 1. diff --git a/rules/in/allow.txt b/rules/in/allow.txt deleted file mode 100644 index d18f646..0000000 --- a/rules/in/allow.txt +++ /dev/null @@ -1,3 +0,0 @@ -# spamwall - India ALLOW patterns (checked before block rules) -^1601\d{6}$ # IN-1601 | Official series for utilities, courier and logistics (deliveries) | TRAI Direction 10-08-2026 -^2263257863$ # IN-AMAZON | Amazon India customer service | public number diff --git a/rules/in/allow/IN-1601.txt b/rules/in/allow/IN-1601.txt new file mode 100644 index 0000000..59c6651 --- /dev/null +++ b/rules/in/allow/IN-1601.txt @@ -0,0 +1,6 @@ +# spamwall India ALLOW pattern (national number without +91 or leading 0) +# Allows: official series for service and transactional calls from utilities, courier and logistics (your deliveries). +# Source: TRAI Direction 10 Aug 2026 https://trai.gov.in/sites/default/files/2026-08/Direction_10082026.pdf +# False-positive risk: low. Allowing is the safe side; a spammer using this series would break TRAI rules. +# Format: # id | what | source +^1601\d{6}$ # IN-1601 | Official series for utilities, courier and logistics (deliveries) | TRAI Direction 10-08-2026 diff --git a/rules/in/allow/IN-AMAZON.txt b/rules/in/allow/IN-AMAZON.txt new file mode 100644 index 0000000..afd898c --- /dev/null +++ b/rules/in/allow/IN-AMAZON.txt @@ -0,0 +1,6 @@ +# spamwall India ALLOW pattern (national number without +91 or leading 0) +# Allows: Amazon India customer service. +# Source: public number. +# False-positive risk: low. +# Format: # id | what | source +^2263257863$ # IN-AMAZON | Amazon India customer service | public number diff --git a/rules/in/block.txt b/rules/in/block.txt deleted file mode 100644 index ecf66a1..0000000 --- a/rules/in/block.txt +++ /dev/null @@ -1,6 +0,0 @@ -# spamwall - India BLOCK patterns (regex, national number without +91 or leading 0) -# Format: # id | what | source -^140\d{7}$ # IN-140 | Promotional / telemarketing series | TRAI TCCCPR 2018; RBI circular 2025-01 (140 = promotional only) -^(1725|2250|2269|3366|3368|3371|4071|7935|7969|7971)\d{6}$ # IN-CC-LANDLINE | Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad) | clustered from community spam reports -^(803710|803720|804795|804819|806935|806954|806985)\d{4}$ # IN-CC-BLR | Bengaluru call-centre blocks | clustered from community spam reports -^(657350|731361|914714|922807|942209|948470)\d{4}$ # IN-BULK-MOBILE | Bulk telemarketing mobile ranges | clustered from community spam reports diff --git a/rules/in/block/IN-140.txt b/rules/in/block/IN-140.txt new file mode 100644 index 0000000..5db0f8c --- /dev/null +++ b/rules/in/block/IN-140.txt @@ -0,0 +1,6 @@ +# spamwall India BLOCK pattern (national number without +91 or leading 0) +# Blocks: promotional and telemarketing calls and SMS from the 140 series. +# Source: TRAI TCCCPR 2018 https://trai.gov.in/release-publication/directions ; RBI circular Jan 2025 https://www.rbi.org.in/scripts/NotificationUser.aspx?Id=12770 +# False-positive risk: low. The series is for promotions only. +# Format: # id | what | source +^140\d{7}$ # IN-140 | Promotional / telemarketing series | TRAI TCCCPR 2018; RBI circular 2025-01 (140 = promotional only) diff --git a/rules/in/block/IN-BULK-MOBILE.txt b/rules/in/block/IN-BULK-MOBILE.txt new file mode 100644 index 0000000..85965ad --- /dev/null +++ b/rules/in/block/IN-BULK-MOBILE.txt @@ -0,0 +1,6 @@ +# spamwall India BLOCK pattern (national number without +91 or leading 0) +# Blocks: mobile number blocks used for bulk telemarketing. +# Source: clustered from community spam reports. +# False-positive risk: medium. Mobile blocks can be reassigned to ordinary users. +# Format: # id | what | source +^(657350|731361|914714|922807|942209|948470)\d{4}$ # IN-BULK-MOBILE | Bulk telemarketing mobile ranges | clustered from community spam reports diff --git a/rules/in/block/IN-CC-BLR.txt b/rules/in/block/IN-CC-BLR.txt new file mode 100644 index 0000000..4e761fb --- /dev/null +++ b/rules/in/block/IN-CC-BLR.txt @@ -0,0 +1,6 @@ +# spamwall India BLOCK pattern (national number without +91 or leading 0) +# Blocks: narrow Bengaluru call-centre blocks (not all of 080). +# Source: clustered from community spam reports. +# False-positive risk: medium. Delivery apps call from other 080 numbers, which are not blocked. +# Format: # id | what | source +^(803710|803720|804795|804819|806935|806954|806985)\d{4}$ # IN-CC-BLR | Bengaluru call-centre blocks | clustered from community spam reports diff --git a/rules/in/block/IN-CC-LANDLINE.txt b/rules/in/block/IN-CC-LANDLINE.txt new file mode 100644 index 0000000..9407792 --- /dev/null +++ b/rules/in/block/IN-CC-LANDLINE.txt @@ -0,0 +1,6 @@ +# spamwall India BLOCK pattern (national number without +91 or leading 0) +# Blocks: call-centre landline ranges in Chandigarh, Mumbai, Kolkata, Hyderabad and Ahmedabad. +# Source: clustered from community spam reports. +# False-positive risk: medium. Ranges are narrow but a real business in them would be blocked; use an unblock request. +# Format: # id | what | source +^(1725|2250|2269|3366|3368|3371|4071|7935|7969|7971)\d{6}$ # IN-CC-LANDLINE | Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad) | clustered from community spam reports diff --git a/rules/in/optional-block.txt b/rules/in/optional-block.txt deleted file mode 100644 index eb41d0f..0000000 --- a/rules/in/optional-block.txt +++ /dev/null @@ -1,2 +0,0 @@ -# spamwall - India OPTIONAL block patterns (off by default) -^1600\d{6}$ # IN-1600 | Official BFSI + Government service/transactional series. Blocks REAL bank, insurer, broker and govt calls too. Enable only if you add your own banks to allow.txt | TRAI Direction (PIB PRID 2191647) diff --git a/rules/in/optional/IN-1600.txt b/rules/in/optional/IN-1600.txt new file mode 100644 index 0000000..64e10c1 --- /dev/null +++ b/rules/in/optional/IN-1600.txt @@ -0,0 +1,6 @@ +# spamwall India OPTIONAL BLOCK pattern (off by default; only in rules-strict) +# Blocks: official BFSI and government service and transactional series. +# Source: TRAI Direction, PIB https://pib.gov.in/PressReleasePage.aspx?PRID=2191647 +# False-positive risk: high. Blocks real bank, insurer, broker and government calls. Add your own banks to contacts first. +# Format: # id | what | source +^1600\d{6}$ # IN-1600 | Official BFSI + Government service/transactional series. Blocks REAL bank, insurer, broker and govt calls too. Enable only if you add your own banks to allow.txt | TRAI Direction (PIB PRID 2191647) diff --git a/rules/in/patterns.md b/rules/in/patterns.md new file mode 100644 index 0000000..b258caf --- /dev/null +++ b/rules/in/patterns.md @@ -0,0 +1,12 @@ + +# IN patterns + +| ID | Type | Regex | What | Source | Priority | +|---|---|---|---|---|---| +| IN-1601 | allow | `^1601\d{6}$` | Official series for utilities, courier and logistics (deliveries) | TRAI Direction 10-08-2026 | 15 | +| IN-AMAZON | allow | `^2263257863$` | Amazon India customer service | public number | 15 | +| IN-140 | block | `^140\d{7}$` | Promotional / telemarketing series | TRAI TCCCPR 2018; RBI circular 2025-01 (140 = promotional only) | 5 | +| IN-BULK-MOBILE | block | `^(657350\|731361\|914714\|922807\|942209\|948470)\d{4}$` | Bulk telemarketing mobile ranges | clustered from community spam reports | 5 | +| IN-CC-BLR | block | `^(803710\|803720\|804795\|804819\|806935\|806954\|806985)\d{4}$` | Bengaluru call-centre blocks | clustered from community spam reports | 5 | +| IN-CC-LANDLINE | block | `^(1725\|2250\|2269\|3366\|3368\|3371\|4071\|7935\|7969\|7971)\d{6}$` | Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad) | clustered from community spam reports | 5 | +| IN-1600 | optional | `^1600\d{6}$` | Official BFSI + Government service/transactional series. Blocks REAL bank, insurer, broker and govt calls too. Enable only if you add your own banks to allow.txt | TRAI Direction (PIB PRID 2191647) | 5 | diff --git a/spamblocker/complete.gz b/spamblocker/complete.gz new file mode 100644 index 0000000000000000000000000000000000000000..176fadd1d64a320a15839095d3120406564fc9f7 GIT binary patch literal 1093 zcmV-L1iJeliwFn+00002|6^}$aBO9CWdPM!TXW(z6n@XI(0KZg%n;WXjB(xwq20^^ z*-17tJMFd|VGE-oOCCvvbwd989vMR}>#TWedBC!cbUq#FI~SS96J*6$lT=7bly!j~ zPY|*&WAOSXydvx7^M}#xozs z&sRj!IjshtS9}*$lAORvB*X3Q-$U0ls}9Po*ZMM{9J)b`l2E)=cu!wtYV@NNvo$W& zD?4bnSwkqd=i>#?42RS0RZ7NoFkzt-ep|5TDk1C6%d|j~Dt}iA+^mbWCek2Tf4e=${rWX|>^=Qry&nFJ;nV>2-N<`A zG7$;+T;|5`H;|)muyccJHOO~>O*##b2~n}6d7Tz5mE&v;MF3q-&yCR+=w?2rF(h^b zq(hlRb0JZoDWe*C9TbZK#1g^rBPLQvmNZuAG$D+xDuuJXkuQo|P|K*g1eagdId-4_ zVPsx!!>{}C0&`AGak9o@y~9-Tf+Rr2%fpy45ij5DaxWVSKBs9l{Rc;>`Ewii^Sqw# z1!2GE9}$0p$>5Kh=>-~81qxkrsLyDZS`3{l8k6H<$7_zRu495LJgVU8Iv41Z6qzui z5MI9`O&Ed73$+L?4t2OS(9_J$?w<3XlG7AAr@bKb17{QZuHSPvk=qU3?k4iQz7uYu zuID)sH2rSqoEZ|k$3)`g{rKbg^pwwIvdk? zrs;-JU>cwXnqK4wRTFfprXL(1qr>6(<@grJgbN#Hg)C4EBj@I$KoV3P;E@sOHxcQE zUa;{z2urAJ(Z=_CJ@e?pBXl=i2OgneGmKy~j6(P9=x#5-8edN#His`rWN=ks zl<&e4oeqJEgr-<7I%on{Jxn|3qhL#{aR+@U6Znvr;iQ8Gi;N`Z_3VG_0rfu5R+sbXM+=2-Jvi7HRMy3ssZ}lhM5)u^7-tmJc!q-OIQH-3 zo@&ihiJJA@jU4ytD!Y#kudL_pw}R#-QS2t(bI(F%?9<(zq4Pz`>8)1OXr)$+J1VhJQMzTUwUPpt9!j z<{@X5ZdryXo)%**WV(CtmXF#*mK&ZQA2*(Z{Wm|ig`ej|z88`>@;k(Dv>1K4SPo%S z(4Vq|S($MPXfekR&t)(V&SEKRlW+IGQ-@ z9?{8UFrKdvCM$C)YE?suoTuH(s-fsSt-*qfLns(eY+qT+wDRJ}RmX%G5XiVoYd%*XAP zlqFRHea3e?u4F+!pa0&W2wu=K~n# z~ z_y{%4Fv4gUg?6`f(+iS}hx7OGbdK5_KZD3|RN+h_*9Q6n@;X?8a zDTxUm?o+DBlB6aK*Evn~vfHkIfY&^bT5TLit!D%2=n6^$?rM+Y&|pA0w{6Ogj7Dt;G~2(F_0p DQPEm= literal 0 HcmV?d00001 diff --git a/spamblocker/spamwall-in-strict.json b/spamblocker/rules-strict.json similarity index 68% rename from spamblocker/spamwall-in-strict.json rename to spamblocker/rules-strict.json index fdc4f0b..4807724 100644 --- a/spamblocker/spamwall-in-strict.json +++ b/spamblocker/rules-strict.json @@ -1,103 +1,9 @@ { "categories": { "all": [ - "OTHERS", "REGEX_RULES" ] }, - "contacts": { - "enabled": true, - "isExcusive": false, - "permissivePriority": 10, - "strictPriority": 0 - }, - "stir": { - "enabled": true, - "includeUnverified": false, - "strictPriority": 0 - }, - "repeatedCall": { - "enabled": true, - "times": 1, - "inXMin": 5 - }, - "dialed": { - "enabled": true, - "smsEnabled": true, - "always": false, - "inXDay": 7 - }, - "answered": { - "warningAcknowledged": true, - "enabled": true, - "minDuration": 15, - "inXDay": 7 - }, - "recentApps": { - "list": [ - { - "pkgName": "in.amazon.mShop.android.shopping" - }, - { - "pkgName": "com.flipkart.android" - }, - { - "pkgName": "com.myntra.android" - }, - { - "pkgName": "com.meesho.supply" - }, - { - "pkgName": "com.jio.jiomart" - }, - { - "pkgName": "in.swiggy.android" - }, - { - "pkgName": "com.application.zomato" - }, - { - "pkgName": "com.grofers.customerapp" - }, - { - "pkgName": "com.zeptoconsumerapp" - }, - { - "pkgName": "com.bigbasket.mobileapp" - }, - { - "pkgName": "com.ubercab" - }, - { - "pkgName": "com.rapido.passenger" - }, - { - "pkgName": "com.olacabs.customer" - }, - { - "pkgName": "com.phonepe.app" - }, - { - "pkgName": "net.one97.paytm" - }, - { - "pkgName": "com.google.android.apps.nbu.paisa.user" - }, - { - "pkgName": "com.jio.myjio" - }, - { - "pkgName": "com.paypal.android.p2pmobile" - }, - { - "pkgName": "com.transferwise.android" - }, - { - "pkgName": "in.gov.umang.negd.g2c" - } - ], - "inXMin": 120 - }, "numberRules": { "rules": [ { @@ -153,13 +59,13 @@ }, { "id": 201, - "pattern": "^(1725|2250|2269|3366|3368|3371|4071|7935|7969|7971)\\d{6}$", + "pattern": "^(657350|731361|914714|922807|942209|948470)\\d{4}$", "patternFlags": 8192, "patternModeType": 0, "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-CC-LANDLINE: Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad)", + "description": "spamwall IN-BULK-MOBILE: Bulk telemarketing mobile ranges", "priority": 5, "isBlacklist": true, "flags": 3, @@ -187,13 +93,13 @@ }, { "id": 203, - "pattern": "^(657350|731361|914714|922807|942209|948470)\\d{4}$", + "pattern": "^(1725|2250|2269|3366|3368|3371|4071|7935|7969|7971)\\d{6}$", "patternFlags": 8192, "patternModeType": 0, "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-BULK-MOBILE: Bulk telemarketing mobile ranges", + "description": "spamwall IN-CC-LANDLINE: Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad)", "priority": 5, "isBlacklist": true, "flags": 3, diff --git a/spamblocker/settings.gz b/spamblocker/settings.gz new file mode 100644 index 0000000000000000000000000000000000000000..893c703aaefff3cdf8a96a265af4eeca87e5a1bc GIT binary patch literal 529 zcmV+s0`C1EiwFn+00002|8r$@bZKs9a{!H0OKTf35Wf3YEItPj8$xJrp)vH*2Tcow z(!=cTSeaTcG+J-hA^*K2+p%M6M|;>s8qN0@X{4t~HEkfF_K}dM@2jUtRZYPd8UB)C zHU0Aa)(_bx$`4%z6SHrUEE#SX7>h6q3i(Ipt(g#$)QoWoxu ziDDXLd3L>B;}oe$uj1ExIZhPcl5&mdTKwVG7->n{#iQay)`$V6?)Jm3)=TV(>~>pb zd##_J$jS6(&(ad?0GIG=dGUV~Ob-K}7!~S!$Odos)ZnZ@f|y>AMSvY#iZDJMQM@SbLNG%y`w#j2Suylxu9VF^X+4bg z0isXMcKg*v1d=a8bo5J%tmNt>Z!ro*5wpRNyj)4{MgnTmHSh|Pvc4vRV=!Hfv4Ogn zCkCkXDgZM&jj;&u288!maS;$6y_2h}O0J#MCzyzTN3$vV=xNZ+}U#}j15 zSd&ypN|e<{k0%IOm@)YL6F!l3`{mgvSXGy^Zy@GAmDfg6?G}e1`r&6ah zmA_KOV^$>Oo-c@`Q(A65YkX6xBsqbXNG>+Fe@nWiS@}?IrR(c8<**DYDG9|JhPU`t zrba(gF*=7|(Eu@x+GFwl5PDY=e0 z7MVR|G@oOsx15a(*@|n44?j)_*kY?9&)KT+^uJV?zYGle`QrT0lsu;y{LorV&wCWtk7vf7+sVMXFDVJid<09 zs2YOH&#N4}%m1)5t*+6o*6|E;PE2vK#$vgZsp1()0E+#`h?t1yuWq@cT?jspK;?y61dT%#ZZ+`KqqFUE{!?)3Lg&;Cy zw%vBeUH4o+bp3VD^SVyB?)jeQ^kC}xp>uo)4)4dG&aZEWS7Qj_VZr9F(($Gxt>XB& zp!Dk-Qs)>OQfIFr9lpQ2LcgOA0vb)8L8xtens?<70~}YCbyG=gG%UjqO-6$;iZGwI n5QX1~lE@Z{q?lJtEc`&w5WW9nh^v1-ojm;jIt6zF!4d!f^G7(~ diff --git a/spamblocker/spamwall-in.gz b/spamblocker/spamwall-in.gz deleted file mode 100644 index a60db8c986025c56ef1db3686e1d5a2411ffb7dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1094 zcmV-M1iAYkiwFn+00002|8sC*ZFga8Y%OVS0M%GsbK*7>eb2AZc>0jc5Z5-?2Hqf{ z-OK{nA)A?f zY|kg7O79%P2n=zHWQBC%PHs-MuG`1BCGBD71N`YLZ9EsGPF`6x~ z)H}^ug>=oe#HTMO1Z=TYo@H!ZyZT=$%r6Cle!3QptyVNi)+gJ6VSgGG*Ka?;23pjr zBvQJ#^J2%Vj;@wtf-5|$;A%Nt^ht_T zm{|y~Uy&w^K;?y61P_NY+$!j)W@q=#`A^BI3Y|+g^!$zI`3^KeXVYv3foa;%gzl#0 zKofSFJ~S{Jc0%{+>@wxe&GoQ1z8&6;2VG>|(AVY_DG6eb78&IPL8VF{d0yTC7cot+ zoHx)2$_l0p^ii+{*0_N_tYdhzOmW;my?IJv^Lce%9^h4ZK-&SPosH={)3w5mZ#rNS zy1mx)KD_fV%VmzD11~5p@XSKFSw&>vhfRp%u<14fchhlO zq1)PYJg@D9n@-E~oDOvDR_L4`gZ;/*.txt. +"""Build the SpamBlocker import files from rules// and write patterns.md. Usage: python -I tools/build_spamblocker.py -Writes spamblocker/spamwall-.json, spamwall-.gz (default) and -spamwall--strict.gz (also blocks the optional list). +Writes spamblocker/{settings,rules-default,rules-strict,complete}.{gz,json} +and rules//patterns.md. Old spamwall-*.{gz,json} files are removed. """ import gzip import json @@ -27,7 +27,18 @@ def read_rules(path): continue pattern, _, note = line.partition("#") parts = [p.strip() for p in note.split("|")] - rules.append({"pattern": pattern.strip(), "id": parts[0], "what": parts[1] if len(parts) > 1 else ""}) + rules.append({ + "pattern": pattern.strip(), "id": parts[0], + "what": parts[1] if len(parts) > 1 else "", + "source": parts[2] if len(parts) > 2 else "", + }) + return rules + + +def read_dir(path): + rules = [] + for f in sorted(path.glob("*.txt")): + rules += read_rules(f) return rules @@ -43,36 +54,62 @@ def rule(idx, r, blacklist): } -def build(cc, strict): - d = ROOT / "rules" / cc - allow, block = read_rules(d / "allow.txt"), read_rules(d / "block.txt") - if strict: - block += read_rules(d / "optional-block.txt") - rules = [rule(i + 100, r, False) for i, r in enumerate(allow)] - rules += [rule(i + 200, r, True) for i, r in enumerate(block)] +def settings(d): return { - "categories": {"all": ["OTHERS", "REGEX_RULES"]}, + "categories": {"all": ["OTHERS"]}, "contacts": {"enabled": True, "isExcusive": False, "permissivePriority": 10, "strictPriority": 0}, "stir": {"enabled": True, "includeUnverified": False, "strictPriority": 0}, "repeatedCall": {"enabled": True, "times": 1, "inXMin": 5}, "dialed": {"enabled": True, "smsEnabled": True, "always": False, "inXDay": 7}, "answered": {"warningAcknowledged": True, "enabled": True, "minDuration": 15, "inXDay": 7}, "recentApps": {"list": [{"pkgName": a["pattern"]} for a in read_rules(d / "allow-apps.txt")], "inXMin": 120}, - "numberRules": {"rules": rules}, } +def rules_part(d, strict): + allow, block = read_dir(d / "allow"), read_dir(d / "block") + if strict: + block += read_dir(d / "optional") + rules = [rule(i + 100, r, False) for i, r in enumerate(allow)] + rules += [rule(i + 200, r, True) for i, r in enumerate(block)] + return {"numberRules": {"rules": rules}} + + +def files(d): + s = settings(d) + default, strict = rules_part(d, False), rules_part(d, True) + return { + "settings": s, + "rules-default": {"categories": {"all": ["REGEX_RULES"]}, **default}, + "rules-strict": {"categories": {"all": ["REGEX_RULES"]}, **strict}, + "complete": {**s, "categories": {"all": ["OTHERS", "REGEX_RULES"]}, **default}, + } + + +def patterns_md(cc, d): + esc = lambda t: t.replace("|", "\\|") + rows = [] + for kind, prio in (("allow", ALLOW_PRIORITY), ("block", BLOCK_PRIORITY), ("optional", BLOCK_PRIORITY)): + for r in read_dir(d / kind): + rows.append(f"| {r['id']} | {kind} | `{esc(r['pattern'])}` | {esc(r['what'])} | {esc(r['source'])} | {prio} |") + head = ("\n" + f"# {cc.upper()} patterns\n\n" + "| ID | Type | Regex | What | Source | Priority |\n|---|---|---|---|---|---|\n") + return head + "\n".join(rows) + "\n" + + def main(): OUT.mkdir(exist_ok=True) - for cc_dir in sorted((ROOT / "rules").iterdir()): - cc = cc_dir.name - for strict in (False, True): - name = f"spamwall-{cc}{'-strict' if strict else ''}" - data = json.dumps(build(cc, strict), indent=1, ensure_ascii=False) + for old in list(OUT.glob("spamwall-*")): + old.unlink() + for cc_dir in sorted(p for p in (ROOT / "rules").iterdir() if p.is_dir()): + for name, obj in files(cc_dir).items(): + data = json.dumps(obj, indent=1, ensure_ascii=False) (OUT / f"{name}.json").write_text(data, encoding="utf-8", newline="\n") with gzip.GzipFile(OUT / f"{name}.gz", "wb", mtime=0) as f: f.write(data.encode("utf-8")) print("built", name) + (cc_dir / "patterns.md").write_text(patterns_md(cc_dir.name, cc_dir), encoding="utf-8", newline="\n") if __name__ == "__main__": diff --git a/tools/check.py b/tools/check.py index 29219bd..0cca1df 100644 --- a/tools/check.py +++ b/tools/check.py @@ -1,31 +1,64 @@ """CI checks: regexes compile, no allow/block overlap on official series, -no personal-looking data, and import files match the rule lists.""" +no personal-looking data, every pattern file is well formed, and generated +files match the rule sources.""" import json, re, subprocess, sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent errors = [] +ids = {} for txt in (ROOT / "rules").rglob("*.txt"): - for n, line in enumerate(txt.read_text(encoding="utf-8").splitlines(), 1): + folder = txt.parent.name + n_rules = 0 + text = txt.read_text(encoding="utf-8") + for n, line in enumerate(text.splitlines(), 1): s = line.split("#")[0].strip() if not s or txt.name == "allow-apps.txt": continue + n_rules += 1 try: re.compile(s) except re.error as e: errors.append(f"{txt}:{n} bad regex: {e}") - if txt.name == "block.txt" and re.match(s, "1600000000") or txt.name == "block.txt" and re.match(s, "1601000000"): + parts = [p.strip() for p in line.partition("#")[2].split("|")] + if len(parts) < 3 or not all(parts): + errors.append(f"{txt}:{n} needs a '# ID | what | source' comment") + continue + if parts[0] != txt.stem: + errors.append(f"{txt}:{n} ID {parts[0]} does not match file name") + if parts[0] in ids: + errors.append(f"{txt}:{n} duplicate ID {parts[0]}") + ids[parts[0]] = txt + if folder == "block" and (re.match(s, "1600000000") or re.match(s, "1601000000")): errors.append(f"{txt}:{n} blocks an official 1600/1601 number") + if folder in {"allow", "block", "optional"}: + if n_rules != 1: + errors.append(f"{txt}: must hold exactly one pattern line") + for key in ("Source:", "False-positive risk:"): + if f"# {key}" not in text: + errors.append(f"{txt}: header comment missing '{key}'") secret = re.compile(r"github_pat_|ghp_|sk-[A-Za-z0-9]{10}|Bearer |password=|api[_-]?key", re.I) for f in ROOT.rglob("*"): if f.is_file() and ".git" not in f.parts and f.suffix in {".txt", ".md", ".json", ".yml", ".py"}: t = f.read_text(encoding="utf-8", errors="ignore") if f.name != "check.py" and secret.search(t): errors.append(f"{f}: looks like a secret") -before = {p.name: p.read_bytes() for p in (ROOT / "spamblocker").glob("*")} + + +def gen(): + paths = list((ROOT / "spamblocker").glob("*")) + list((ROOT / "rules").rglob("patterns.md")) + return {str(p.relative_to(ROOT)): p.read_bytes() for p in paths} + + +before = gen() subprocess.run([sys.executable, "-I", str(ROOT / "tools" / "build_spamblocker.py")], check=True, capture_output=True) -after = {p.name: p.read_bytes() for p in (ROOT / "spamblocker").glob("*")} +after = gen() if before != after: - errors.append("spamblocker/ is out of date: run tools/build_spamblocker.py and commit") + errors.append("generated files are out of date: run tools/build_spamblocker.py and commit") +d = json.loads((ROOT / "spamblocker" / "complete.json").read_text(encoding="utf-8")) +rl = d["numberRules"]["rules"] +shared = {r["priority"] for r in rl if r["isBlacklist"]} & {r["priority"] for r in rl if not r["isBlacklist"]} +if shared: + errors.append(f"allow and block share priority {shared}") print("\n".join(errors) or "all checks passed") sys.exit(1 if errors else 0) From b333dd90d89c113a812cab2c0ec301c93534ad5f Mon Sep 17 00:00:00 2001 From: Wasim Akram <55689108+wasimness@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:25:52 +0530 Subject: [PATCH 2/2] feat: SpamWall display name, per-type import files, caveats Co-Authored-By: Claude Opus 5.5 --- .github/ISSUE_TEMPLATE/unblock-request.yml | 4 +- CHANGELOG.md | 2 + README.md | 15 +++-- assets/banner.svg | 4 +- docs/IMPORT.md | 13 ++++- rules/in/allow-apps.txt | 2 +- rules/in/allow/IN-1601.txt | 2 +- rules/in/allow/IN-AMAZON.txt | 2 +- rules/in/block/IN-140.txt | 2 +- rules/in/block/IN-BULK-MOBILE.txt | 2 +- rules/in/block/IN-CC-BLR.txt | 2 +- rules/in/block/IN-CC-LANDLINE.txt | 2 +- rules/in/optional/IN-1600.txt | 2 +- spamblocker/complete.gz | Bin 1093 -> 1093 bytes spamblocker/complete.json | 12 ++-- spamblocker/rules-default.gz | Bin 651 -> 651 bytes spamblocker/rules-default.json | 12 ++-- spamblocker/rules-strict.gz | Bin 721 -> 722 bytes spamblocker/rules-strict.json | 14 ++--- spamblocker/types/IN-140.gz | Bin 0 -> 413 bytes spamblocker/types/IN-140.json | 62 +++++++++++++++++++++ spamblocker/types/IN-1600.gz | Bin 0 -> 450 bytes spamblocker/types/IN-1600.json | 62 +++++++++++++++++++++ spamblocker/types/IN-BULK-MOBILE.gz | Bin 0 -> 472 bytes spamblocker/types/IN-BULK-MOBILE.json | 62 +++++++++++++++++++++ spamblocker/types/IN-CC-BLR.gz | Bin 0 -> 450 bytes spamblocker/types/IN-CC-BLR.json | 62 +++++++++++++++++++++ spamblocker/types/IN-CC-LANDLINE.gz | Bin 0 -> 499 bytes spamblocker/types/IN-CC-LANDLINE.json | 62 +++++++++++++++++++++ tools/build_spamblocker.py | 18 +++++- tools/check.py | 2 +- 31 files changed, 381 insertions(+), 41 deletions(-) create mode 100644 spamblocker/types/IN-140.gz create mode 100644 spamblocker/types/IN-140.json create mode 100644 spamblocker/types/IN-1600.gz create mode 100644 spamblocker/types/IN-1600.json create mode 100644 spamblocker/types/IN-BULK-MOBILE.gz create mode 100644 spamblocker/types/IN-BULK-MOBILE.json create mode 100644 spamblocker/types/IN-CC-BLR.gz create mode 100644 spamblocker/types/IN-CC-BLR.json create mode 100644 spamblocker/types/IN-CC-LANDLINE.gz create mode 100644 spamblocker/types/IN-CC-LANDLINE.json diff --git a/.github/ISSUE_TEMPLATE/unblock-request.yml b/.github/ISSUE_TEMPLATE/unblock-request.yml index d8e180f..1c5c901 100644 --- a/.github/ISSUE_TEMPLATE/unblock-request.yml +++ b/.github/ISSUE_TEMPLATE/unblock-request.yml @@ -1,5 +1,5 @@ name: Unblock request (blocked by mistake) -description: A legitimate business or service is blocked by a spamwall rule. +description: A legitimate business or service is blocked by a SpamWall rule. labels: [unblock] body: - type: input @@ -18,7 +18,7 @@ body: id: rule attributes: label: Rule ID that blocked it (if shown) - description: SpamBlocker shows it in the call log, for example "spamwall IN-CC-LANDLINE". + description: SpamBlocker shows it in the call log, for example "SpamWall IN-CC-LANDLINE". - type: textarea id: why attributes: diff --git a/CHANGELOG.md b/CHANGELOG.md index 100214b..a4e6e7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Added - Separate import files: `settings.gz` (Others), `rules-default.gz` and `rules-strict.gz` (Regex Settings), and `complete.gz` (both), each with a readable `.json` twin. +- Per-type import files `spamblocker/types/.gz` (one block rule plus the allow rules). - `docs/IMPORT.md`: which file to pick, step-by-step import, nuances and manual steps. - `rules/in/patterns.md`, a generated table of every pattern. - Checks for file header comments, IDs matching file names and shared priorities. ### Changed +- Display name is now SpamWall in prose, banner and rule descriptions. - Rule sources split into one file per pattern under `rules/in/allow/`, `block/` and `optional/`. - README Quick start shortened; added a Files table and a Releases line. - Removed `spamwall-in*.{gz,json}` (replaced by the files above). diff --git a/README.md b/README.md index fb3673b..2c3a897 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -# spamwall +# SpamWall -![spamwall: spam call and SMS block patterns for India](assets/banner.svg) +![SpamWall: spam call and SMS block patterns for India](assets/banner.svg) -**For Indian phone numbers (+91), calls and SMS.** spamwall is a set of pattern-based block rules you can import in one click. It is built for [SpamBlocker](https://github.com/aj3423/SpamBlocker) on Android; the plain regex lists work in any blocker that accepts regular expressions. +**For Indian phone numbers (+91), calls and SMS.** SpamWall is a set of pattern-based block rules you can import in one click. It is built for [SpamBlocker](https://github.com/aj3423/SpamBlocker) on Android; the plain regex lists work in any blocker that accepts regular expressions. It blocks whole number ranges used by telemarketers and call centres instead of single numbers. Every rule filters both calls and SMS. Calls and messages from shopping, delivery, ride and payment apps, from your contacts, and from official service lines are never blocked. > SMS filtering works only when **SMS** is switched on under *Settings > Screening* in SpamBlocker; follow the setup prompt it shows. ## The app: SpamBlocker -spamwall's import files are made for **[SpamBlocker](https://github.com/aj3423/SpamBlocker)**, a free, open-source call and SMS blocker for Android by aj3423. It is the app the maintainer uses every day with these rules. +SpamWall's import files are made for **[SpamBlocker](https://github.com/aj3423/SpamBlocker)**, a free, open-source call and SMS blocker for Android by aj3423. It is the app the maintainer uses every day with these rules. - Get it from [F-Droid](https://f-droid.org/packages/spam.blocker/) or the [GitHub releases page](https://github.com/aj3423/SpamBlocker/releases). - It runs on your phone with no account, and number checks happen on the device. - Questions about the app itself go to the [SpamBlocker repository](https://github.com/aj3423/SpamBlocker/issues); questions about these rules go [here](../../issues). -spamwall is a separate community project and is not made by or affiliated with SpamBlocker. +SpamWall is a separate community project and is not made by or affiliated with SpamBlocker. ## Quick start (SpamBlocker) @@ -31,11 +31,16 @@ spamwall is a separate community project and is not made by or affiliated with S | [`spamblocker/rules-default.gz`](spamblocker/rules-default.gz) | Only the Regex Settings category: allow rules and default block rules | | [`spamblocker/rules-strict.gz`](spamblocker/rules-strict.gz) | `rules-default` plus IN-1600 (bank and government service calls) | | [`spamblocker/complete.gz`](spamblocker/complete.gz) | `settings` plus `rules-default`, for a one-tap full setup | +| [`spamblocker/types/.gz`](spamblocker/types/) | One block pattern plus the allow rules (Regex Settings only), for blocking just one kind of call | | [`rules/in/`](rules/in/) | One file per pattern in `allow/`, `block/` and `optional/`, plus [`allow-apps.txt`](rules/in/allow-apps.txt) | | [`rules/in/patterns.md`](rules/in/patterns.md) | Table of every pattern, generated from the files | Each `.gz` has a readable `.json` twin. +**What can be combined:** `settings` + any ONE rules file (`rules-default`, `rules-strict` or one `types/` file) is fine. Two rules files do not stack: the second replaces the first, and also deletes your own number rules. `complete` already has settings and default rules. + +**Short version of the caveats:** settings never touch number rules; rules never touch settings. Importing `settings.gz` replaces your Recent Apps list and allow switches. Export a backup first, it is your undo. Not tested on every phone and SpamBlocker version, so report problems as issues. Details: [docs/IMPORT.md](docs/IMPORT.md). + **Releases:** download the files from the [latest release](../../releases/latest). ## How the rules are checked diff --git a/assets/banner.svg b/assets/banner.svg index 98a4519..017bd2e 100644 --- a/assets/banner.svg +++ b/assets/banner.svg @@ -1,5 +1,5 @@ - spamwall + SpamWall Pattern-based spam call and SMS blocking rules for Indian numbers @@ -10,7 +10,7 @@ ^140\d{7}$^(3366|2250)call centres - spamwall + SpamWall Spam call and SMS block patterns for India (+91) One-click import for SpamBlocker diff --git a/docs/IMPORT.md b/docs/IMPORT.md index a74539a..c2c52b7 100644 --- a/docs/IMPORT.md +++ b/docs/IMPORT.md @@ -1,8 +1,16 @@ # Import guide (SpamBlocker) +> **Read this first** +> +> - Settings and rules import separately. `settings.gz` only touches app settings (allow switches, Recent Apps) and never your number rules. `rules-*.gz` and `types/*.gz` only touch number rules. `complete.gz` does both. +> - Number-rule imports do not stack. Each import replaces ALL number rules, including your own and any earlier SpamWall import. Pick ONE: a single type file (blocks only that kind of call) OR `rules-default.gz` / `rules-strict.gz` (all types). For two or three types, import the all-types file, or import one type file and add the other patterns by hand with "New" in Number Rules, copying the regex from `rules/in/block/.txt`. +> - Importing `settings.gz` replaces your Recent Apps list and the allow switches. +> - Always export a backup first; importing it again is the undo. +> - The maintainer has not tested this on every phone and SpamBlocker version. Report problems as [issues](../../issues). + ## What you need -SpamBlocker for Android, from [F-Droid](https://f-droid.org/packages/spam.blocker/) or the [GitHub releases](https://github.com/aj3423/SpamBlocker/releases). Download the spamwall files from the [latest release](../../releases/latest). +SpamBlocker for Android, from [F-Droid](https://f-droid.org/packages/spam.blocker/) or the [GitHub releases](https://github.com/aj3423/SpamBlocker/releases). Download the SpamWall files from the [latest release](../../releases/latest). ## Which file to pick @@ -11,6 +19,7 @@ SpamBlocker for Android, from [F-Droid](https://f-droid.org/packages/spam.blocke | `complete.gz` | Settings plus default rules (both categories) | You want a full setup in one tap | | `settings.gz` | Only the "Others" category: contacts, STIR, repeated call, dialed, answered, Recent Apps (120 min) | You want the settings without touching your number rules | | `rules-default.gz` | Only the "Regex Settings" category: all allow rules and the default block rules | You want the rules without touching your settings | +| `types/.gz` | One block pattern (IN-140, IN-CC-LANDLINE, IN-CC-BLR, IN-BULK-MOBILE or IN-1600) plus the allow rules (IN-1601, IN-AMAZON). Regex Settings only | You want to block only that kind of call | | `rules-strict.gz` | Same as `rules-default.gz` plus IN-1600 | You also want bank, insurer and government service calls blocked (add your own bank and broker numbers to contacts first) | Each file also has a readable `.json` twin in `spamblocker/`. @@ -20,7 +29,7 @@ Each file also has a readable `.json` twin in `spamblocker/`. 1. In SpamBlocker, open **Settings > Backup > Export** and save a backup of your current setup first. 2. Download the file you picked to your phone. 3. Open **Settings > Backup > Import** and pick the file. -4. In the **Include Settings** dialog, tap a category to move it between Include and Exclude. Keep only the category the file has (Others for `settings.gz`, Regex Settings for `rules-*.gz`, both for `complete.gz`). +4. In the **Include Settings** dialog, tap a category to move it between Include and Exclude. Keep only the category the file has (Others for `settings.gz`, Regex Settings for `rules-*.gz` and `types/*.gz`, both for `complete.gz`). 5. Confirm the import. ## Nuances diff --git a/rules/in/allow-apps.txt b/rules/in/allow-apps.txt index 3ea42e7..354f121 100644 --- a/rules/in/allow-apps.txt +++ b/rules/in/allow-apps.txt @@ -1,4 +1,4 @@ -# spamwall - apps whose recent use should let any call through (SpamBlocker "Recent Apps", 120 min) +# SpamWall - apps whose recent use should let any call through (SpamBlocker "Recent Apps", 120 min) # Shopping / e-commerce / live commerce in.amazon.mShop.android.shopping # Amazon com.flipkart.android # Flipkart diff --git a/rules/in/allow/IN-1601.txt b/rules/in/allow/IN-1601.txt index 59c6651..9c63e02 100644 --- a/rules/in/allow/IN-1601.txt +++ b/rules/in/allow/IN-1601.txt @@ -1,4 +1,4 @@ -# spamwall India ALLOW pattern (national number without +91 or leading 0) +# SpamWall India ALLOW pattern (national number without +91 or leading 0) # Allows: official series for service and transactional calls from utilities, courier and logistics (your deliveries). # Source: TRAI Direction 10 Aug 2026 https://trai.gov.in/sites/default/files/2026-08/Direction_10082026.pdf # False-positive risk: low. Allowing is the safe side; a spammer using this series would break TRAI rules. diff --git a/rules/in/allow/IN-AMAZON.txt b/rules/in/allow/IN-AMAZON.txt index afd898c..a35c3ce 100644 --- a/rules/in/allow/IN-AMAZON.txt +++ b/rules/in/allow/IN-AMAZON.txt @@ -1,4 +1,4 @@ -# spamwall India ALLOW pattern (national number without +91 or leading 0) +# SpamWall India ALLOW pattern (national number without +91 or leading 0) # Allows: Amazon India customer service. # Source: public number. # False-positive risk: low. diff --git a/rules/in/block/IN-140.txt b/rules/in/block/IN-140.txt index 5db0f8c..f5008b2 100644 --- a/rules/in/block/IN-140.txt +++ b/rules/in/block/IN-140.txt @@ -1,4 +1,4 @@ -# spamwall India BLOCK pattern (national number without +91 or leading 0) +# SpamWall India BLOCK pattern (national number without +91 or leading 0) # Blocks: promotional and telemarketing calls and SMS from the 140 series. # Source: TRAI TCCCPR 2018 https://trai.gov.in/release-publication/directions ; RBI circular Jan 2025 https://www.rbi.org.in/scripts/NotificationUser.aspx?Id=12770 # False-positive risk: low. The series is for promotions only. diff --git a/rules/in/block/IN-BULK-MOBILE.txt b/rules/in/block/IN-BULK-MOBILE.txt index 85965ad..2e69a40 100644 --- a/rules/in/block/IN-BULK-MOBILE.txt +++ b/rules/in/block/IN-BULK-MOBILE.txt @@ -1,4 +1,4 @@ -# spamwall India BLOCK pattern (national number without +91 or leading 0) +# SpamWall India BLOCK pattern (national number without +91 or leading 0) # Blocks: mobile number blocks used for bulk telemarketing. # Source: clustered from community spam reports. # False-positive risk: medium. Mobile blocks can be reassigned to ordinary users. diff --git a/rules/in/block/IN-CC-BLR.txt b/rules/in/block/IN-CC-BLR.txt index 4e761fb..aecd51f 100644 --- a/rules/in/block/IN-CC-BLR.txt +++ b/rules/in/block/IN-CC-BLR.txt @@ -1,4 +1,4 @@ -# spamwall India BLOCK pattern (national number without +91 or leading 0) +# SpamWall India BLOCK pattern (national number without +91 or leading 0) # Blocks: narrow Bengaluru call-centre blocks (not all of 080). # Source: clustered from community spam reports. # False-positive risk: medium. Delivery apps call from other 080 numbers, which are not blocked. diff --git a/rules/in/block/IN-CC-LANDLINE.txt b/rules/in/block/IN-CC-LANDLINE.txt index 9407792..2d47d3f 100644 --- a/rules/in/block/IN-CC-LANDLINE.txt +++ b/rules/in/block/IN-CC-LANDLINE.txt @@ -1,4 +1,4 @@ -# spamwall India BLOCK pattern (national number without +91 or leading 0) +# SpamWall India BLOCK pattern (national number without +91 or leading 0) # Blocks: call-centre landline ranges in Chandigarh, Mumbai, Kolkata, Hyderabad and Ahmedabad. # Source: clustered from community spam reports. # False-positive risk: medium. Ranges are narrow but a real business in them would be blocked; use an unblock request. diff --git a/rules/in/optional/IN-1600.txt b/rules/in/optional/IN-1600.txt index 64e10c1..0481d45 100644 --- a/rules/in/optional/IN-1600.txt +++ b/rules/in/optional/IN-1600.txt @@ -1,4 +1,4 @@ -# spamwall India OPTIONAL BLOCK pattern (off by default; only in rules-strict) +# SpamWall India OPTIONAL BLOCK pattern (off by default; only in rules-strict) # Blocks: official BFSI and government service and transactional series. # Source: TRAI Direction, PIB https://pib.gov.in/PressReleasePage.aspx?PRID=2191647 # False-positive risk: high. Blocks real bank, insurer, broker and government calls. Add your own banks to contacts first. diff --git a/spamblocker/complete.gz b/spamblocker/complete.gz index 176fadd1d64a320a15839095d3120406564fc9f7..6db9c6fe236c4318bf7221aa0987699b8d69242c 100644 GIT binary patch delta 1060 zcmV+<1l#+?2*n7HFn`mXcH54yg;9|uk0ir7A^*Kc#*oW8Yu;KOu&g7UPe=OBMdtAY zSuxfm6_OHVU7*Jkge=S$y#4{N$h!IbVRURv6`J<(H%!-8E^A(YFPOHJ^72idbBqwkZ$#A>-_s})Xs)KUtwZ2R!hi*`#BouEI z-qTl^8htOtY>i9x%20s5!p6X`hQ?g2iF^iMW63E`2l0}NHQ=SMAsg1tD8DKs)>Igi z-Jp3LNn*nFAb-#Id@`!^&LNDz5VuUHI5T7dfQ>W!Ah?~~Ektf(o=8CxTR|rW1C6It z$W6+z$m}_z`4UUL(`;49O0Fe7d^#aui>-=0XJzZ`f2c6O3=I0=T-df+(=;s)wgbcZ zG_H={et-qEXjMt2m=mdN2puglA_1aR=Yix}KuD_MK!1f9O=nmwiMBH_ql_G)Q_P5r z@vLnf(2yUB-m0e_*r#2^P zVy9lb)qgM<{dHDzytd~mG)UH8ZqISQeoY>G zPd{0&hks!>H9&ng@?MWjL_$87xiS0=klRiMx{hx&|msm0K_qA@uxcD&~3 z>VG;WxWc0fuC8-|K1q=YGYaALGtz_+sJu{%;Nnn+TLV4K?CkD2|0y|5p>x^`LO*ae zq3`-VcN4kY(Cuy_&+9wkChB^g6G7AOhR&HGv3pD;Ufz#Co=uwhon z0>vU?Y13Z3!@@S9!Z9ELjL<68AC4Xta)pBz_N~XJ{{>h7n#Qs zWW`vMR7gscb%7pF5VA01@cJjbBJ1Y!htchw)u}qSqu)ng{<*y$kM1lG{B?q!ItD>- zjbpvnCmhchNuaA`L5!+J)#zJXD7qpbonxl9;+)8gDkJ_RDSz0YOBi;YYD{TKWBo$z z)XOPN<s&sRj!IjshtS9}*$lAORvB*X3Q-$U0ls}9Po*ZMM{9J)b`l2E)= zcu!wtYV@NNvo$W&D??f<05;C>gWz^{w-C9Fc_IZ(Yz3Vh3^bln zAvY<*2j7a1^qTd?OUA?wb|v_O+8e^&|Itc$fK(jZxXyFJJK`Zam% zJ^f<69{!Et)ByF}$a_695efNR=Em?hkfU#~bAxL&$ajEEIt`EsQL&_Xofa*X<7^E@ z09{YdjnNnAW{}C0&`AGak9o@y~9-Tf+Rr2%fpy45ij5DaxWVS zKBs9l{Rc;>`Ewii^Sqw#1!2GE9}$0p$>5Kh=>-~81qxkrsLyDZS`3{l8k6H<$7_zR zu76{KD?F;;>N*$blN6aSqYz%dB25^9$_up!E)I3LHPF+{&hDP`pOVuQI;XuL^aE!T z`mWz|H<8;7-R>sxyuK4|qORvT5j6d7=$si6yT?T0<^A~M`Q+yEdOW&7mjzqC;c#2W z5R|F(*r@cHsO&p_=sFwIc&6!wQD7RN27j7f4sjg@jM7isBF>3_j^6_=))s)H(duFpFj3nmu?0@V5^*<9QPu~F-m`x_$5C8y#JO4=l diff --git a/spamblocker/complete.json b/spamblocker/complete.json index bd4440c..00c7f7d 100644 --- a/spamblocker/complete.json +++ b/spamblocker/complete.json @@ -108,7 +108,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-1601: Official series for utilities, courier and logistics (deliveries)", + "description": "SpamWall IN-1601: Official series for utilities, courier and logistics (deliveries)", "priority": 15, "isBlacklist": false, "flags": 3, @@ -125,7 +125,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-AMAZON: Amazon India customer service", + "description": "SpamWall IN-AMAZON: Amazon India customer service", "priority": 15, "isBlacklist": false, "flags": 3, @@ -142,7 +142,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-140: Promotional / telemarketing series", + "description": "SpamWall IN-140: Promotional / telemarketing series", "priority": 5, "isBlacklist": true, "flags": 3, @@ -159,7 +159,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-BULK-MOBILE: Bulk telemarketing mobile ranges", + "description": "SpamWall IN-BULK-MOBILE: Bulk telemarketing mobile ranges", "priority": 5, "isBlacklist": true, "flags": 3, @@ -176,7 +176,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-CC-BLR: Bengaluru call-centre blocks", + "description": "SpamWall IN-CC-BLR: Bengaluru call-centre blocks", "priority": 5, "isBlacklist": true, "flags": 3, @@ -193,7 +193,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-CC-LANDLINE: Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad)", + "description": "SpamWall IN-CC-LANDLINE: Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad)", "priority": 5, "isBlacklist": true, "flags": 3, diff --git a/spamblocker/rules-default.gz b/spamblocker/rules-default.gz index 5bedf0c496e61f6916cb7f9d96378f89686d75e0..4e38616f529340666fed9a0c0631ba79726557dc 100644 GIT binary patch delta 619 zcmV-x0+juW1&alcD}SbMZ7EQ#?NG-Af&p?9H?``-mE#P?(*K=v=*Bkk4tep}-^-nx z`{b0n>w%R}%`&MtE3FaS^#Cj?1a3d$7OeH`&Ftg1_0?i_X`%3?2S*!&iYnhQwXVdU zD0MnCaYjLnrzp6NWB)!LsMbsss99g#$Z@Z))4S;S!g}g{Eq`cc5)Iwhd+J%rl)b+_ zFmygkIs2g%HF>QT{XSt^OiRj?m5Jg9&1G}b%LC0nU`b%U8kkFu;9|Sw38w-|X37Rz zsi4waaE&J$5?P_FfEFnTnekHdq=d7S34YTA^dBy%I2K;tnj(cKjh7QalfA$&l($rr z?Bv;=Uc*0~lYbp83T9AQ3;F#%XPN9+iYOizVo;8mf&(Z#ypWDLE z^CI61$uROe#BaPDf4W$WV4TyRvVeJ!atcXRYMCQ2#CgLL)-5_-dv^tnX)e;K<_eq< zyi+ol#*6Ls5;PMmr)tkMFS1j+wcu%|qgD0q;k32RS$`A~KXhv1yME->u^SLKsAJC? zI;4&R&vRll!+*)V$c+@V<7!DkS_7U z+Vik2@np{y*S;S`W*Oo_+&XY@A%-T2(Mw|D_B%JdAj!pe^=dI+VQ)?!K@>Qu2wvQ` zC7ex>Mana(b~Y?=)T7*nb1C*zQybpircBWdO>G$Oa+aEH|3Cf$PGf8D_zP8rLxk=M F008c#FJ1ru delta 619 zcmV-x0+juW1&alcD}SVKZ7EQ#?NDJ7f&p?9H?``-mE-IOOaFJyr5oGGJLJV@e=m1( z?vqpQz6VxHHOr;qtg?o1-vh9y5V-w{Td-Eschk>5R+sbXM+=2-Jvi7HRMy3ssZ}lh zM5)u^7-tmJc!q-OIQH-3o@&ihiJJA@jU4ytD!Y#kudL_pw||1>CQWgaSCZ&X;~mJ#CgqA)-5_-dv^tnX)e;K<_er4 zd{DBG#*6Ls8Z;BEplZi7FY{Bowcu%|qgDOy;k32RS$`A~KXe-6yME+0i5n0%XcEth z9nvI$=Q#SZ75^MC$7^N z;~5i>Bs2!mpotPcJen{#nmFtp(aB^mp05xlD|0GpRYQuNLCQ+47#s`OF_3;6NSAnF z<9XPY_+)2G8sCp1v&6U%w+S3vh@nXm^pb?Q{mxAD5zq`+myijpM-oTQYq+e1S4@sNsP7uH%ROz-()&SlsnM)l-d7VN@In9aM(2|L)mRkd!W;&&+{ym%~>6`?9==# zNVf^39XkHbaZr|cvqd}C4Fdh><0G_po`sK4(+newhEZsDTQ|KR$#^(_8&Bt`&G8e6 z9Dhd@&csoca56>~Da(jjn=r#sk1!K1B;SydnDFi{rHU*`YQk`x(^N0J?fM6J%>${` z#(~s&GLVkWuBPxB&Ls|-B1gE#ndTHLi-IKe&H8YYzJbv}y|9=JV^|WgF@cGqQdF6+ fRB}@fv6;LrQS|>Y;`+;^v;PgA`kR;03<3ZElDa&e delta 644 zcmV-~0(TuH(s-fsSt-*qfLns(eY+qT+wDRJ}RmX%G5XiVoYd%*XAPlqFRHea3e? zu4F&H8Gm9+@;ht^Oy@m)=mA`=RxDwJ zLqT=hU?mk)CF88boe7Do(5--o6u8V-QL?0flaz9Hdr0U$9a1rDe0i^%+!pa0&W2wu=K~n#qV0CJfg(P4%+du77~nJdj## z97wHa1L^4OY6@@RT;iZ9a)f)FX-=`SC`eM@tdBS8I~X0*3yaAxh9waj6PPF}MU@Fl eB{%gDo5|Y}MgJcouD?t=``@j_6eZCN0096L)-xgi diff --git a/spamblocker/rules-strict.json b/spamblocker/rules-strict.json index 4807724..d9556dc 100644 --- a/spamblocker/rules-strict.json +++ b/spamblocker/rules-strict.json @@ -14,7 +14,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-1601: Official series for utilities, courier and logistics (deliveries)", + "description": "SpamWall IN-1601: Official series for utilities, courier and logistics (deliveries)", "priority": 15, "isBlacklist": false, "flags": 3, @@ -31,7 +31,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-AMAZON: Amazon India customer service", + "description": "SpamWall IN-AMAZON: Amazon India customer service", "priority": 15, "isBlacklist": false, "flags": 3, @@ -48,7 +48,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-140: Promotional / telemarketing series", + "description": "SpamWall IN-140: Promotional / telemarketing series", "priority": 5, "isBlacklist": true, "flags": 3, @@ -65,7 +65,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-BULK-MOBILE: Bulk telemarketing mobile ranges", + "description": "SpamWall IN-BULK-MOBILE: Bulk telemarketing mobile ranges", "priority": 5, "isBlacklist": true, "flags": 3, @@ -82,7 +82,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-CC-BLR: Bengaluru call-centre blocks", + "description": "SpamWall IN-CC-BLR: Bengaluru call-centre blocks", "priority": 5, "isBlacklist": true, "flags": 3, @@ -99,7 +99,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-CC-LANDLINE: Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad)", + "description": "SpamWall IN-CC-LANDLINE: Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad)", "priority": 5, "isBlacklist": true, "flags": 3, @@ -116,7 +116,7 @@ "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": "spamwall IN-1600: Official BFSI + Government service/transactional series. Blocks REAL bank, insurer, broker and govt ca", + "description": "SpamWall IN-1600: Official BFSI + Government service/transactional series. Blocks REAL bank, insurer, broker and govt ca", "priority": 5, "isBlacklist": true, "flags": 3, diff --git a/spamblocker/types/IN-140.gz b/spamblocker/types/IN-140.gz new file mode 100644 index 0000000000000000000000000000000000000000..0c7a3a7c5fa76941d8b48e0aa176589cec5588b1 GIT binary patch literal 413 zcmV;O0b>3iiwFn+00002|4B|QF*Gm$)l|z)!!QuM_bXNw2at+LQYg?{K?PMR4;2uI zr(DNLS9R>lc6e3&ch)7mb4KdTJL4IxceI{0fC=tpZY)a2IxuShFs>9GZ|DeY*gNc9 zJq#}fy)#C@T?6J#66vxSNjognm&#VfLKhIiFeM<4qUL)!<=#uH31jzhJBn{_(^-4I z!hX^Ris!*-C*DndGDjwr=Py%9vKsuuuufBBnMx-tPCc4Mr)N`MT+&FO zf4m-=?!ZZwp+K&{$uKs^jD^ypLQho_geeKOz;z1B(r^rE+&YOY)qc|T?$mL2W zso$>6C@k0ZQZ3hJ)PYlL3KLjbuMO~0$%5O7^r-V{-D={gPsiKxpTns>$j1B)>}V_) HSOow8Av44* literal 0 HcmV?d00001 diff --git a/spamblocker/types/IN-140.json b/spamblocker/types/IN-140.json new file mode 100644 index 0000000..db0bffc --- /dev/null +++ b/spamblocker/types/IN-140.json @@ -0,0 +1,62 @@ +{ + "categories": { + "all": [ + "REGEX_RULES" + ] + }, + "numberRules": { + "rules": [ + { + "id": 100, + "pattern": "^1601\\d{6}$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-1601: Official series for utilities, courier and logistics (deliveries)", + "priority": 15, + "isBlacklist": false, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + }, + { + "id": 101, + "pattern": "^2263257863$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-AMAZON: Amazon India customer service", + "priority": 15, + "isBlacklist": false, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + }, + { + "id": 200, + "pattern": "^140\\d{7}$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-140: Promotional / telemarketing series", + "priority": 5, + "isBlacklist": true, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + } + ] + } +} \ No newline at end of file diff --git a/spamblocker/types/IN-1600.gz b/spamblocker/types/IN-1600.gz new file mode 100644 index 0000000000000000000000000000000000000000..2bf785671b3d30a3d641facc3df2197416823d18 GIT binary patch literal 450 zcmV;z0X_a7iwFn+00002|4B|QF*YzT0M%5>Zrd;ry!$H_L=P>hHj<3EiEnnH1O}W0 zuoJXs9tBNN%EAR+oxKeby zrX#RPcA9fSgI&3g>L&e2h5sl!2D<_*x(LAHu%;KJFEkjgnY<_Juow%1dMe*2-nKEMj z?3Fw0tI-9Po6o~$9lgviX~{25d)@T#%TcepNBIrT20t#&`!J~ZAERNUbL1du=S@X{ zQJhN@a=+3^Uu##qkL`*dwQG1X9l=L9HPjkiN$s}*9gwniTm+3>3qQj!c;;Y|4aP9z sdL994S6gW#m{~J#8d;j92fcm!{meavotEU#zTm50E$9_;%_QgyZBW?9R>EYlVTUV|Veas&e3@Bb+` z)H!YxV&3;4_Jg~-d>ijSc(2B!D zGUt{Vv2j8lCcWCw>I+%|)627F=n*W6LNGxkSl-wMg*H$-A%(-L4@}nx8=xu&sY_v< zU=~htF2%!vaQZT&5oo-7YD^lmn6MK`*;*nE;etxb+fLD5BW!DSPnF_LRNhQKK5JTb z&vT68Uo%!xv-O)>zF_BC6{0-+-gNf;_xS}K`4JL_WRMKw@QCso&&Rim%Mpw#`b#UA zs$5WDwRO6}z%b4S!T52dLprzXBpxK;z~3cd5XQkS4WcB7b}1o4KiQ=bA%2RVVU+l% z%@Rh(w1kuE*{8GlVltg&Bbd~34US7*QM2Yws1ho@5|V?Vs>BEBeVE-@I#d7WDBI_> OxBm@anG}771pom2h~j4e literal 0 HcmV?d00001 diff --git a/spamblocker/types/IN-BULK-MOBILE.json b/spamblocker/types/IN-BULK-MOBILE.json new file mode 100644 index 0000000..d4ba8a1 --- /dev/null +++ b/spamblocker/types/IN-BULK-MOBILE.json @@ -0,0 +1,62 @@ +{ + "categories": { + "all": [ + "REGEX_RULES" + ] + }, + "numberRules": { + "rules": [ + { + "id": 100, + "pattern": "^1601\\d{6}$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-1601: Official series for utilities, courier and logistics (deliveries)", + "priority": 15, + "isBlacklist": false, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + }, + { + "id": 101, + "pattern": "^2263257863$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-AMAZON: Amazon India customer service", + "priority": 15, + "isBlacklist": false, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + }, + { + "id": 200, + "pattern": "^(657350|731361|914714|922807|942209|948470)\\d{4}$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-BULK-MOBILE: Bulk telemarketing mobile ranges", + "priority": 5, + "isBlacklist": true, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + } + ] + } +} \ No newline at end of file diff --git a/spamblocker/types/IN-CC-BLR.gz b/spamblocker/types/IN-CC-BLR.gz new file mode 100644 index 0000000000000000000000000000000000000000..6c0c30c3e99fc2df4b829b86ec5eae57821c1bc0 GIT binary patch literal 450 zcmV;z0X_a7iwFn+00002|4B|QLqjb>Oi}>VR9$b{Fcf{~S6o?p012dgknr&ah)$Jg zk!Yt@Yq!ccPOxfhWIJpf<-hMbOWU=}^CX^*?>V_g*Z0Udw16<`c%hBpmW<)h0w7dM zJl^3E$ZGz1e*3WcvY1~HB)+xa*u^GQZr9wbO8M4h>Z0oN400kvA`F7=pK?c?<3=Gz zzK3ZL-rr}3^!SOqm(L_EywNZmMemgho$>3Z9Y^tl<@~2J)ccYK{>8AVr@=DgmKm{g zLRXVs?dbLfR|4mkJwNmqmU%9ipb{+iYlB=HD4mePVbukuOQa1@m4VcSuud=w?TkyY zuNpe9LmGjLcTavvNzDm6m6Sb7Y(qMy((+o#>ubby%{Eji?xP|L{o}>cvJKBLioch! zmYO|&xaBK1(<&E5^|@D$-GB278}f^yG>($NFpW+*68lP&$F6`ZR~P++BX zdW(T!oO{9eX{8f2zOME#hzDWt>>={dAB++Y7z#oJ`uZ6~$r*p=ffl(zq!Ny#qkk~2~-qnS6Jr|~?G4+C&0vAonq@Yis;waS-@2fRl?ws;So8tQz^J%5=fGu0;?N3<2Ns+~47j zSj&w<%=zlao_~AG4)N)k^EmxVlCmWl`;*{tW}z8>x8HG0KB3HiSVLM~rw6|$?5pXa zWW1(E?5xn|PH%Rk`hX*W*>co2J%#I{5L6HeHE+iTg*MPwA%(@r1*#i_4G_gZ>QdBJ z&>Dt}OL2EDxO!;P2pqiKw?m3LOw=zVp<9V%2p2@wyvr2bHNq~Y8=@3%rE=!_`#on( zH=Lmqe-C3VHQheB~4fA#Zw^b3MG45DNlhZm$@x=24=FQ<@JK3Bf}xyug7V8!C+OX-p`QfNF$f|LO*}bi{Q{X!*-^a(006lk@r?ig literal 0 HcmV?d00001 diff --git a/spamblocker/types/IN-CC-LANDLINE.json b/spamblocker/types/IN-CC-LANDLINE.json new file mode 100644 index 0000000..45dd12e --- /dev/null +++ b/spamblocker/types/IN-CC-LANDLINE.json @@ -0,0 +1,62 @@ +{ + "categories": { + "all": [ + "REGEX_RULES" + ] + }, + "numberRules": { + "rules": [ + { + "id": 100, + "pattern": "^1601\\d{6}$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-1601: Official series for utilities, courier and logistics (deliveries)", + "priority": 15, + "isBlacklist": false, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + }, + { + "id": 101, + "pattern": "^2263257863$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-AMAZON: Amazon India customer service", + "priority": 15, + "isBlacklist": false, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + }, + { + "id": 200, + "pattern": "^(1725|2250|2269|3366|3368|3371|4071|7935|7969|7971)\\d{6}$", + "patternFlags": 8192, + "patternModeType": 0, + "patternExtra": "", + "patternExtraFlags": 0, + "patternExtraModeType": 0, + "description": "SpamWall IN-CC-LANDLINE: Call-centre landline ranges (Chandigarh, Mumbai, Kolkata, Hyderabad, Ahmedabad)", + "priority": 5, + "isBlacklist": true, + "flags": 3, + "channel": "Low", + "schedule": "", + "blockType": 0, + "blockTypeConfig": "" + } + ] + } +} \ No newline at end of file diff --git a/tools/build_spamblocker.py b/tools/build_spamblocker.py index 668158c..cb17aca 100644 --- a/tools/build_spamblocker.py +++ b/tools/build_spamblocker.py @@ -47,7 +47,7 @@ def rule(idx, r, blacklist): return { "id": idx, "pattern": r["pattern"], "patternFlags": REGEX_FLAGS, "patternModeType": 0, "patternExtra": "", "patternExtraFlags": 0, "patternExtraModeType": 0, - "description": f"spamwall {r['id']}: {r['what']}"[:120], + "description": f"SpamWall {r['id']}: {r['what']}"[:120], "priority": BLOCK_PRIORITY if blacklist else ALLOW_PRIORITY, "isBlacklist": blacklist, "flags": FLAGS_CALL_AND_SMS, "channel": "Low", "schedule": "", "blockType": 0, "blockTypeConfig": "", @@ -75,6 +75,18 @@ def rules_part(d, strict): return {"numberRules": {"rules": rules}} +def type_files(d): + out = {} + allow = read_dir(d / "allow") + for kind in ("block", "optional"): + for f in sorted((d / kind).glob("*.txt")): + rs = read_rules(f) + rules = [rule(i + 100, r, False) for i, r in enumerate(allow)] + rules += [rule(i + 200, r, True) for i, r in enumerate(rs)] + out[f"types/{f.stem}"] = {"categories": {"all": ["REGEX_RULES"]}, "numberRules": {"rules": rules}} + return out + + def files(d): s = settings(d) default, strict = rules_part(d, False), rules_part(d, True) @@ -83,6 +95,7 @@ def files(d): "rules-default": {"categories": {"all": ["REGEX_RULES"]}, **default}, "rules-strict": {"categories": {"all": ["REGEX_RULES"]}, **strict}, "complete": {**s, "categories": {"all": ["OTHERS", "REGEX_RULES"]}, **default}, + **type_files(d), } @@ -100,7 +113,8 @@ def patterns_md(cc, d): def main(): OUT.mkdir(exist_ok=True) - for old in list(OUT.glob("spamwall-*")): + (OUT / "types").mkdir(exist_ok=True) + for old in list(OUT.glob("spamwall-*")) + list((OUT / "types").glob("*")): old.unlink() for cc_dir in sorted(p for p in (ROOT / "rules").iterdir() if p.is_dir()): for name, obj in files(cc_dir).items(): diff --git a/tools/check.py b/tools/check.py index 0cca1df..d5bf536 100644 --- a/tools/check.py +++ b/tools/check.py @@ -46,7 +46,7 @@ def gen(): - paths = list((ROOT / "spamblocker").glob("*")) + list((ROOT / "rules").rglob("patterns.md")) + paths = [p for p in (ROOT / "spamblocker").rglob("*") if p.is_file()] + list((ROOT / "rules").rglob("patterns.md")) return {str(p.relative_to(ROOT)): p.read_bytes() for p in paths}