Created
November 26, 2008 13:42
-
-
Save timurvafin/29389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
gem 'mechanize', '>= 0.8.5' | |
require 'mechanize' | |
if ARGV[0].nil? || ARGV[1].nil? || ARGV[2].nil? | |
raise ArgumentError | |
end | |
domain = ARGV[0] | |
login = ARGV[1] | |
password = ARGV[2] | |
a = WWW::Mechanize.new | |
a.get("http://#{domain}/wp-login.php") do |page| | |
# Submit the login form | |
my_page = page.form_with(:action => 'wp-login.php') do |f| | |
f.log = login | |
f.pwd = password | |
end.click_button | |
my_page.links.each do |link| | |
text = link.text.strip | |
next unless text.length > 0 | |
puts text | |
end | |
end | |
http://mechanize.rubyforge.org/mechanize/ | |
ruby login.rb tatsoft.ru login password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment