-- 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://jack-dns-tools.p.mashape.com/dnstools.php'
local function get_domain_data (domain)
local apikey = cred_data.x_mashape_key
local url = BASE_URL..'?_method=DNS2IP&dns='..domain..'&mashape-key='..apikey
local res,code = https.request(url)
if code ~= 200 then return "HTTP-FEHLER" end
local data = json:decode(res)
return data
end
local function send_domain_data(data, receiver)
if domain == data.ip then
return
else
local text = data.ip
send_msg(receiver, text, ok_cb, false)
local function run(msg, matches)
domain = matches[1]
local data = get_domain_data(domain)
local receiver = get_receiver(msg)
send_domain_data(data, receiver)
return {
description = "Löst Domain nach IP auf.",
usage = "#dns [Domain]",
patterns = {"^#dns (.*)$"},
run = run
}