diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-28 20:52:58 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-28 20:52:58 +0100 |
commit | 27684ea76cf936b3794fc97c64a7a2892c46c398 (patch) | |
tree | cbb7b45a5de46409daaa70734a87ee56807ca2da | |
parent | 922050a86faf173e8e82b3ab26200415dc30ed22 (diff) | |
download | rspamd-27684ea76cf936b3794fc97c64a7a2892c46c398.tar.gz rspamd-27684ea76cf936b3794fc97c64a7a2892c46c398.zip |
[Project] Add implicit bitcoincash prefix
-rw-r--r-- | rules/bitcoin.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua index cb6603e8c..c4a34d24f 100644 --- a/rules/bitcoin.lua +++ b/rules/bitcoin.lua @@ -144,14 +144,19 @@ local function is_segwit_bech32_address(task, word) if decoded then return verify_beach32_cksum(hrp, decoded) end - elseif semicolon_pos then + else -- Bitcoin cash address -- https://www.bitcoincash.org/spec/cashaddr.html local decoded = gen_bleach32_table(address_part) lua_util.debugm(N, task, 'check %s, %s decoded', word, decoded) if decoded and #decoded > 8 then - prefix = word:sub(1, semicolon_pos - 1) + if semicolon_pos then + prefix = word:sub(1, semicolon_pos - 1) + else + prefix = 'bitcoincash' + end + local polymod_tbl = {} fun.each(function(byte) local b = bit.band(string.byte(byte), 0x1f) @@ -170,7 +175,7 @@ local function is_segwit_bech32_address(task, word) end local normal_wallet_re = [[/\b[13LM][1-9A-Za-z]{25,34}\b/AL{sa_body}]] -local btc_bleach_re = [[/\b(?:bc1|[13]|(?:\w+:))[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}\b/AL{sa_body}]] +local btc_bleach_re = [[/\b(?:\w+:)?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}\b/AL{sa_body}]] config.regexp['BITCOIN_ADDR'] = { description = 'Message has a valid bitcoin wallet address', |