summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/phishing.lua
blob: 8021a006912e94df2def786d65ce8c65a9e0bc00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- Phishing detection interface for selecting phished urls and inserting corresponding symbol
--
--
local symbol = 'PHISHED_URL'

function phishing_cb (task)
	local urls = task:get_urls();

	if urls then
		for _,url in ipairs(urls) do
			if url:is_phished() then
				task:insert_result(symbol, 1, url:get_host())
			end
		end
	end
end


local opts =  rspamd_config:get_all_opt('phishing')
if opts then
    if opts['symbol'] then
        symbol = opts['symbol']
        
        -- Register symbol's callback
        rspamd_config:register_symbol(symbol, 1.0, 'phishing_cb')
    end
    -- If no symbol defined, do not register this module
end