Skip to content

Instantly share code, notes, and snippets.

@mping
Created January 21, 2014 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mping/8550577 to your computer and use it in GitHub Desktop.
Save mping/8550577 to your computer and use it in GitHub Desktop.
Login at https://m.caixadirecta.cgd.pt/ ebanking
require 'rubygems'
require 'mechanize'
cert_store = OpenSSL::X509::Store.new
cert_store.add_file 'cacert.pem' #get it at https://dl.dropboxusercontent.com/u/947497/cacert.pem
a = Mechanize.new do |agent|
agent.cert_store = cert_store
end
#get cookies
a.get('https://m.caixadirecta.cgd.pt/cdoMobile/login.seam')
#login
a.post('https://m.caixadirecta.cgd.pt/cdoMobile/login.seam', {
"loginForm" => "loginForm",
"loginForm:username" => "xxxxxx",
"loginForm:password" => "xxxxxx",
"loginForm:submit" => "Entrar",
"javax.faces.ViewState" => "j_id3:j_id4"
})
# loginForm:loginForm
# loginForm:username:xxxxxx
# loginForm:password:xxxxxx
# loginForm:submit:Entrar
# javax.faces.ViewState:j_id3:j_id4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment