add vcn
This commit is contained in:
parent
c82979c749
commit
612e3e22ed
1 changed files with 24 additions and 0 deletions
24
plugins/vcn.rb
Normal file
24
plugins/vcn.rb
Normal 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
|
Loading…
Reference in a new issue