Skip to content

Commit

Permalink
LAN: reduce duplication
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
gwarser committed Oct 11, 2020
1 parent 3eda381 commit 69a2392
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions lan-block.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
[uBlock Origin]
! Title: Block access to LAN
! Expires: 30 days
! Description: Block access to 3p local LAN resourcess, experimental, incomplete.
! Description: Block internet pages from accessing LAN resourcess. Experimental, incomplete.
! Requested here: https://github.com/uBlockOrigin/uAssets/issues/4318
! Homepage: https://github.com/gwarser/filter-lists
!
! Regular expressions are not efficient in general. uBO avoids performance problems by executing
! them only when URL contains specific string of characters extracted from Regular Expression at
! filter parsing time. This process is called tokenization.
! uBO can tokenize Regular Expression filter when:
! - they contain `reRegexToken` /[%0-9A-Za-z]{2,}/g,
! - above token is not preceded by `reRegexTokenAbort` /[([]/,
! - not directly preceded by `reRegexBadPrefix` /(^|[^\\]\.|[*?{}\\])$/,
! - and not directly followed by `reRegexBadSuffix` /^([^\\]\.|\\[dw]|[([{}?*.]|$)/.
! Commonly used tokens are discarded - `badTokens`.
! See `extractTokenFromRegex` function in `src/js/static-net-filtering.js`.
! Filters in this list should be tokenized by first IP octet.
! Tool for tokenization check would be handy.
! Tools:
! http://gamon.webfactional.com/regexnumericrangegenerator/
! http://www.analyticsmarket.com/freetools/ipregex
Expand All @@ -26,20 +14,22 @@
! ——— LAN
! https://en.wikipedia.org/wiki/Private_network
!
/^https?://10\.(?:(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))\.){2}(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))[:/]/$third-party,~websocket
/^https?://172\.(?:1[6-9]|2[0-9]|3[01])(?:\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))){2}[:/]/$third-party,~websocket
/^https?://192\.168(?:\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))){2}[:/]/$third-party,~websocket
/^wss?://10\.(?:(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))\.){2}(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))[:/]/$third-party,websocket
/^wss?://172\.(?:1[6-9]|2[0-9]|3[01])(?:\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))){2}[:/]/$third-party,websocket
/^wss?://192\.168(?:\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))){2}[:/]/$third-party,websocket
/^\w+://10\.(?:(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))\.){2}(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))[:/]/$third-party
/^\w+://172\.(?:1[6-9]|2[0-9]|3[01])(?:\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))){2}[:/]/$third-party
/^\w+://192\.168(?:\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))){2}[:/]/$third-party
! Includes link-local
/^(?:http|ws)s?://\[f(?:[cd][0-9a-f]|e[89a-f])[0-9a-f]:[0-9a-f:]+\][:/]/$third-party
!
! Ipv4 link-local addresses for network autoconfiguration #5
! TODO:
!
! Ipv6 from ipv4 transition addresses #6
! TODO:
!
! ——— localhost
! https://en.wikipedia.org/wiki/Localhost
!
/^https?://127\.(?:(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))\.){2}(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))[:/]/$third-party,~websocket
/^wss?://127\.(?:(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))\.){2}(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))[:/]/$third-party,websocket
/^\w+://127\.(?:(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))\.){2}(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5]))[:/]/$third-party
||[::1]^$third-party
||localhost^$third-party
!
Expand Down

1 comment on commit 69a2392

@gwarser
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.