Skip to content

Instantly share code, notes, and snippets.

@GeorgiPachov
Created July 10, 2014 13:04
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 GeorgiPachov/a3eee7ba6604ff4d32b1 to your computer and use it in GitHub Desktop.
Save GeorgiPachov/a3eee7ba6604ff4d32b1 to your computer and use it in GitHub Desktop.
A simple ruby bot for Sublime-giveaway
# You will need to install Tor in order for this to work.
# Install from Tor's official website.
# Set your own 'lucky' URL here
URL='http://sublimetexttips.com/giveaways/sublime-text-giveaway/?lucky=139418'
#Create temporary 10 min email address and fetch the address
require 'rubygems'
require 'json'
new_mail_json_result = `curl http://api.guerrillamail.com/ajax.php?f=get_email_address&ip=127.0.0.1&agent=Mozilla_foo_bar`
email_addr = JSON.parse(new_mail_json_result)["email_addr"];
# Here you will need the Tor browser started/running! (Use start-tor-browser!)
# Create and use headless browser
require 'watir-webdriver'
Selenium::WebDriver::Firefox::Binary.path='/home/georgi/Programs/Tor/tor-browser_en-US/start-tor-browser'
browser = Watir::Browser.new
browser.goto URL
browser.select_list(:id => 'giveaways_answer').select 'Sublime Text!!!'
browser.text_field(:id => 'giveaways_email').set email_addr
browser.button().click
puts browser.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment