24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/misoni.rb', line 24
def self.auth
agent = Mechanize.new { |agent|
agent.user_agent_alias = 'Mac Safari'
}
begin
agent.get('http://auth.zokei.ac.jp:16978/') do |page|
login_result = page.form_with(:action => '/cgi-bin/adeflogin.cgi') do |form|
config = getConfig
form.field_with(:name => 'name').value = config["id"]
form.field_with(:name => 'pass').value = config["password"]
end.submit
isSuccess(login_result)
end
rescue SocketError => e
puts e.message
end
end
|