This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot/plugins/safebrowsing.lua

36 lines
1.1 KiB
Lua
Raw Normal View History

2015-11-12 17:42:03 +01:00
-- This is a proprietary plugin, property of Andreas Bielawski, (c) 2015 <andi (dot) b (at) outlook (dot) de>
-- DO NOT USE WITHOUT PERMISSION
do
local BASE_URL = 'https://sb-ssl.google.com/safebrowsing/api'
local function check_malware (check_url, receiver)
local apikey = cred_data.google_apikey
local url = BASE_URL..'/lookup?client=brawlbot&key='..apikey..'&appver='..VERSION..'&pver=3.1&url='..check_url
local res,code = https.request(url)
if code > 204 then return send_msg(receiver, '❓ Fehler '..code, ok_cb, false) end
if res == "" then
send_msg(receiver, '', ok_cb, false)
else
send_msg(receiver, '🚫', ok_cb, false)
end
end
local function run(msg, matches)
local check_url = URL.escape(matches[1])
local receiver = get_receiver(msg)
check_malware(check_url, receiver)
end
return {
description = "Sendet URL an Safebrowsing-Service und pr<70>ft auf Malware.",
usage = "!safe [URL]: Pr<50>ft URL mit Google Safebrowsing auf Malware",
patterns = {
"^/safe (https?://[%w-_%.%?%.:,/%+=&-@]+)$",
"^/safe ([%w-_%.%?%.:,/%+=&-@]+)$"
},
run = run
}
end