This commit is contained in:
encrypt 2016-05-10 13:52:01 +00:00
parent c82979c749
commit 612e3e22ed

24
plugins/vcn.rb Normal file
View file

@ -0,0 +1,24 @@
require 'net/https'
require 'uri'
class VCN
include Cinch::Plugin
match "vcn"
def execute(m)
base_uri = "https://webmail.ventuordici.org/toolz/token"
uri = URI.parse(base_uri+"/generate")
Net::HTTP.start(uri.host, uri.port,
:use_ssl => uri.scheme == 'https',
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({"email" => ENV["ORTICHE_MAIL"], "password" => ENV["ORTICHE_PASS"], "type" => "vcn"})
response = https.request(request)
if response.body =~ /<span id='token'>(.*?)<\/span>/
m.reply base_uri+"/check/"+$1
end
end
end
end