Skip to content

Instantly share code, notes, and snippets.

@youpy
Forked from ucnv/spam.rb
Created December 15, 2009 19:09
Show Gist options
  • Save youpy/257197 to your computer and use it in GitHub Desktop.
Save youpy/257197 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'mechanize'
def main
# e.g. http://youpy.jottit.com/dajare
url = ARGV.shift
a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = 'Mac FireFox'
}
a.get(url + '?m=edit') do |page|
page.form_with(:action => '') do |form|
form.fields[7].value = generate_spam
end.submit
end
end
def generate_spam
s = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
v = (0...5).map{|i| (0...(i == 0 ? 6 : 12)).map{ s[(rand * (i == 0 ? 62 : 26)).floor] }.join }
"#{v[0]} <a href=\"http://#{v[1]}.com/\">#{v[1]}</a>, [url=http://#{v[2]}.com/]#{v[2]}[/url], [link=http://#{v[2]}.com/]#{v[2]}[/link], http://#{v[3]}.com/"
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment