如何使用mechanize(ruby)登录vBulletin 3.6
html如下所示,或者您可以在此处找到它如何使用mechanize(ruby)登录vBulletin 3.6,ruby,login,mechanize,Ruby,Login,Mechanize,html如下所示,或者您可以在此处找到它 vBulletin需要md5的密码,而不是实际密码。因此,如果您捕获webbrowser发送的内容,您可以使用该值。或者,您必须使用md5库(未测试)从任何密码中创建md5哈希 require 'rubygems' require 'mechanize' agent = WWW::Mechanize.new page = agent.get("http://www.vbulletin.org/forum/index.php") login_fo
vBulletin需要md5的密码,而不是实际密码。因此,如果您捕获webbrowser发送的内容,您可以使用该值。或者,您必须使用md5库(未测试)从任何密码中创建md5哈希
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
page = agent.get("http://www.vbulletin.org/forum/index.php")
login_form = page.form_with(:action => 'login.php?do=login')
login_form['vb_login_username'] = 'user name'
login_form['vb_login_password'] = ''
login_form['vb_login_md5password_utf'] = 'md5 hash from the password'
login_form['vb_login_md5password'] = 'md5 hash from the password'
page = agent.submit login_form
#Display welcome message if logged in
puts page.parser.xpath("/html/body/div/table/tr/td[2]/div/div").xpath('text()').to_s.strip
output = File.open("login.html", "w") {|f| f.write(page.parser.to_html) }
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
page = agent.get("http://www.vbulletin.org/forum/index.php")
login_form = page.form_with(:action => 'login.php?do=login')
login_form['vb_login_username'] = 'username'
login_form['vb_login_password]'] = 'password'
page = agent.submit login_form
#Display welcome message if logged in
puts page.parser.xpath("/html/body/div/table/tr/td[2]/div/div").xpath('text()').to_s.strip
output = File.open("login.html", "w") {|f| f.write(page.parser.to_html) }
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
page = agent.get("http://www.vbulletin.org/forum/index.php")
login_form = page.form_with(:action => 'login.php?do=login')
login_form['vb_login_username'] = 'user name'
login_form['vb_login_password'] = ''
login_form['vb_login_md5password_utf'] = 'md5 hash from the password'
login_form['vb_login_md5password'] = 'md5 hash from the password'
page = agent.submit login_form
#Display welcome message if logged in
puts page.parser.xpath("/html/body/div/table/tr/td[2]/div/div").xpath('text()').to_s.strip
output = File.open("login.html", "w") {|f| f.write(page.parser.to_html) }