commit 14c904d: [Rules] Catch LTC addresses
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Oct 11 09:07:05 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-10-11 10:03:06 +0100
URL: https://github.com/rspamd/rspamd/commit/14c904d120fa5f4ce1feb2ce8c6c0f035c52ca61 (HEAD -> master)
[Rules] Catch LTC addresses
---
rules/bitcoin.lua | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua
index 431415d42..0b611796d 100644
--- a/rules/bitcoin.lua
+++ b/rules/bitcoin.lua
@@ -32,18 +32,27 @@ rspamd_config:register_symbol{
local rspamd_re = require "rspamd_regexp"
local hash = require "rspamd_cryptobox_hash"
- local wallet_re = rspamd_re.create_cached('^[13][1-9A-Za-z]{25,34}$')
+ local btc_wallet_re = rspamd_re.create_cached('^[13][1-9A-Za-z]{25,34}$')
+ local ltc_wallet_re = rspamd_re.create_cached('^[LM3][a-km-zA-HJ-NP-Z1-9]{26,33}$')
local words_matched = {}
local valid_wallets = {}
for _,part in ipairs(task:get_text_parts() or {}) do
- local pw = part:filter_words(wallet_re, 'raw', 3)
+ local pw = part:filter_words(btc_wallet_re, 'raw', 3)
if pw and #pw > 0 then
for _,w in ipairs(pw) do
words_matched[#words_matched + 1] = w
end
end
+
+ pw = part:filter_words(ltc_wallet_re, 'raw', 3)
+ if pw and #pw > 0 then
+ for _,w in ipairs(pw) do
+ -- Do not validate, LTC regexp is more strict than BTC one, maybe do it in future
+ valid_wallets[#valid_wallets + 1] = w
+ end
+ end
end
for _,word in ipairs(words_matched) do
More information about the Commits
mailing list