Created
August 14, 2012 11:32
-
-
Save mauriciofierrom/3348467 to your computer and use it in GitHub Desktop.
This little code logs in to Wowlatinoamerica's web site and then votes on every page automatically. It also checks for an internet connection 20 times before shutting down because I set it to run on boot in my machine.
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
require 'rubygems' | |
require 'mechanize' | |
require 'open-uri' | |
def internet_connection? | |
begin | |
true if open("http://www.google.com") | |
rescue | |
false | |
end | |
end | |
attempts = 1 | |
log = File.new("voting.log", "a") | |
log.puts Time.now | |
while not internet_connection? | |
puts "no internet connection" | |
log.puts "Attempt #{attempts}: No internet connection" | |
sleep(15) | |
attempts += 1 | |
if attempts >=20 then | |
log.puts "Attempt #{attempts}: Cant't vote. No internet connection" | |
log.close | |
abort "Cant't vote. No internet connection." | |
end | |
end | |
puts "Attempt #{attempts}: Internet Connection Found. Voting..." | |
log.puts "Attempt #{attempts}: Internet Connection Found. Voting..." | |
agent = Mechanize.new | |
page = agent.get('http://www.wowlatinoamerica.com/login') | |
pp page | |
#login_form = page.form('loginForm') | |
# get the login form, which doesn't have a "name" attribute anymore, | |
# but its the first, ergo the first in the Page#forms array of the | |
# page. | |
login_form = page.forms[0] | |
pp login_form | |
login_form.username = '' | |
login_form.password = '' | |
#pp page | |
page = agent.submit login_form | |
pp page | |
#page = agent.get('http://www.wowlatinoamerica.com/index.php?option=com_wla&view=votar&sitio=www.openwow.com%2F%3Fvote%3D2185&Itemid=4') | |
#page = agent.get('http://www.wowlatinoamerica.com/index.php?option=com_wla&view=votar&sitio=www.servidoreswow.es&Itemid=4') | |
#page = agent.get('http://www.wowlatinoamerica.com/index.php?option=com_wla&view=votar&sitio=www.gtop100.com%2Fin.php%3Fsite%3D70680&Itemid=4') | |
#page = agent.get('http://www.wowlatinoamerica.com/cuenta/votar?sitio=topg.org%2Fin-353283') | |
#page = agent.get('http://www.wowlatinoamerica.com/index.php?option=com_wla&view=votar&sitio=www.top100arena.com%2Fwow-private-server%2F&Itemid=4') | |
#page = agent.get('http://www.wowlatinoamerica.com/chat/votar?sitio=100ranking.com') | |
#page = agent.get('http://www.wowlatinoamerica.com/chat/votar?sitio=gratis-wow.es') | |
#page = agent.get('http://www.wowlatinoamerica.com/index.php?option=com_wla&view=votar&sitio=www.servidoreswow.es&Itemid=9') | |
#page = agent.get('http://www.wowlatinoamerica.com/cuenta/votar?sitio=www.wowtop.es') | |
#page = agent.get('http://www.wowlatinoamerica.com/cuenta/votar?sitio=wowranking.es') | |
#page = agent.get('http://www.wowlatinoamerica.com/chat/votar?sitio=100ranking.com&fb_source=message') | |
#new pages | |
page = agent.get('http://www.openwow.com/vote=2630') | |
page = agent.get('http://www.servidoreswow.es/index.php?a=rate&u=davealember') | |
page = agent.get('http://www.top100arena.com/in.asp?id=76450') | |
page = agent.get('http://www.xtremetop100.com/in.php?site=1132331552') | |
page = agent.get('http://wowranking.es/index.php?a=in&u=sadg&sid=p75Fk14x4E92Budj84GNQL8jhI2BYSV9') | |
puts "Voting achieved. Happy Credit Changing" | |
log.puts "Voting achieved. Happy Credit Changing" | |
log.close |
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
2013-06-11 22:58:38 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
2013-06-11 23:00:04 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
2013-06-11 23:02:31 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
2013-06-11 23:06:36 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
2013-06-11 23:09:53 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
Voting achieved. Happy Credit Changing | |
2013-06-11 23:11:29 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
Voting achieved. Happy Credit Changing | |
2013-06-11 23:22:17 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
Voting achieved. Happy Credit Changing | |
2013-06-11 23:27:14 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
Voting achieved. Happy Credit Changing | |
2013-06-11 23:29:31 -0500 | |
Attempt 1: Internet Connection Found. Voting... | |
Voting achieved. Happy Credit Changing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment