diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-21 20:49:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-21 20:49:57 +0100 |
commit | 09a299379df4921d4806469031cf4cc6bcaf7747 (patch) | |
tree | 6a41f8ee1cd307882d58299b48e7203bc6002d2e | |
parent | 456198fdac726db604d2bbab85a0668b5c9dfa83 (diff) | |
download | rspamd-09a299379df4921d4806469031cf4cc6bcaf7747.tar.gz rspamd-09a299379df4921d4806469031cf4cc6bcaf7747.zip |
[Rules] Allow prefix for bitcoin cash addresses
-rw-r--r-- | rules/bitcoin.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua index 4331d8382..e674795a3 100644 --- a/rules/bitcoin.lua +++ b/rules/bitcoin.lua @@ -118,6 +118,11 @@ local function gen_bleach32_table(input) end local function is_segwit_bech32_address(word) + local semicolon_pos = string.find(word, ':') + if semicolon_pos then + word = string.sub(word, semicolon_pos + 1) + end + local prefix = word:sub(1, 3) if prefix == 'bc1' or prefix:sub(1, 1) == '1' or prefix:sub(1, 1) == '3' then @@ -168,7 +173,7 @@ rspamd_config:register_symbol{ local rspamd_re = require "rspamd_regexp" local btc_wallet_re = rspamd_re.create_cached('^[13LM][1-9A-Za-z]{25,34}$') - local segwit_wallet_re = rspamd_re.create_cached('^(?:bc1|[13])?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}$', 'i') + local segwit_wallet_re = rspamd_re.create_cached('^(?:bc1|[13]|(?:[^:]*:))?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}$', 'i') local words_matched = {} local segwit_words_matched = {} local valid_wallets = {} |