Posted by admin on September 11, 2009 – 2:43 pm
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Ruby Whois Tool. Tested on Linux.
Usage: ruby whois.rb <domain_name> or ./whois.rb <domain_name>
#!/usb/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
#
# Special Thanks to Beenu Aurora for the inspiration.
require 'open-uri'
if ARGV.size < 1
puts '[-] Usage ./whois.rb <domain_name>'
exit 1
end
puts '-----------------------------------------------'
puts '[+] Whois tool - whois.rb'
puts '[+] Thanks to Beenu'
puts '[+] Author: slac3dork'
puts "-----------------------------------------------\n\n"
begin
domain_name = ARGV[0]
open("http://reports.internic.net/cgi/whois?whois_nic=#{domain_name}&type=domain") {|page|
page.each_line {|line|
if (line =~ /Domain Name:/)
puts "[+]#{line}"
end
if (line =~ /Registrar:/)
puts "[+]#{line}"
end
if (line =~ /Name Server:/)
puts "[+]#{line}"
end
if (line =~ /Whois Server:/)
puts "[+]#{line}"
end
if (line =~ /Referral URL:/)
puts "[+]#{line}"
end
if (line =~ /Status:/)
puts "[+]#{line}"
end
if (line =~ /Updated Date:/)
puts "[+]#{line}"
end
if (line =~ /Creation Date:/)
puts "[+]#{line}"
end
if (line =~ /Expiration Date:/)
puts "[+]#{line}"
end
}
}
rescue OpenURI::HTTPError => error_msg
puts "[-] Ups! Got bad status code: #{error_msg}. Try again."
rescue Timeout::Error
puts '[-] 0ops! Timeout bro, check your internet connection.'
end

Posted by admin on August 6, 2009 – 10:13 am
Filed under ruby
Tagged as argument, ARGV, cli, close, close file, command line argument, convert, converter, domain, domain name, exception, file, http, ip, ip address, open, open file, open-uri, open-uri exception, OpenURI::HTTPError, ruby, snippet, Timeout::Error, uri, url
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Reverse IP tool. Ruby code to get domain name from ip address and save all results to ip2domain_result.txt. This script need internet connection and create connection to http://www.ip-adress.com/reverse_ip/. Tested on Linux.
Usage: ruby ip2domain.rb <domain_name> or ./ip2domain.rb <domain_name>
#!/usb/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
require 'open-uri'
if ARGV.size < 1
puts '[-] Usage ./ip2domain.rb <ip_address>'
exit 1
end
puts '-----------------------------------------------'
puts '[+] Reverse IP tool'
puts '[+] ip2domain.rb'
puts '[+] Author: slac3dork'
puts "-----------------------------------------------\n\n"
begin
status = false
filename = 'ip2domain_result.txt'
ip_addr = ARGV[0]
domain_file = File.new("#{filename}", "w")
open("http://www.ip-adress.com/reverse_ip/#{ip_addr}") {|page|
page.each_line {|line|
if (line =~ /.*<\/td>/)
domain_name = "#{line.slice(/\S.*/).slice(/([a-z0-9_-]+[\.]{1})+[a-z]{2,}/)}"
if (domain_name != '')
if (domain_file)
puts "[+] #{domain_name}"
domain_file.puts("#{domain_name}")
else
puts 'Unable to open file'
exit(1)
end
if (!status)
status = true
end
end
end
}
}
domain_file.close
if (!status)
puts '[-] Not found. Check your IP address.'
else
puts '--> All domain name results has been saved to ip2domain_result.txt'
end
rescue OpenURI::HTTPError => error_msg
puts "[-] Ups! Got bad status code: #{error_msg}. Try again"
rescue Timeout::Error
puts '[-] oops! Timeout bro, check your internet connection'
rescue Exception => e
puts "#{e.message}"
end

Posted by admin on August 4, 2009 – 8:18 pm
Filed under ruby
Tagged as code, convert, convert domain, convert domain name, converter, domain name to ip, domain name to ip address, domain to ip, domain to ip address, reverse, reverse dns, reverse dns lookup, reverse ip, ruby, snippet
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Reverse DNS lookup tool. Ruby code to get IP address from domain name. This script need internet connection and create connection to http://www.ip-adress.com/whois/. Tested on Linux.
Usage: ruby domain2ip.rb <domain_name> or ./domain2ip.rb <domain_name>
#!/usb/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
require 'open-uri'
if ARGV.size < 1
puts '[-] Usage ./domain2ip.rb <domain_name>'
exit 1
end
puts '-----------------------------------------------'
puts '[+] Reverse DNS Lookup tool'
puts '[+] domain2ip.rb'
puts '[+] Author: slac3dork'
puts "-----------------------------------------------\n\n"
begin
status = false
domain_name = ARGV[0]
open("http://www.ip-adress.com/whois/#{domain_name}") {|page|
page.each_line {|line|
if (line =~ /#{domain_name} IP address: /)
puts "[+] #{line.slice(/#{domain_name} IP address: ([0-9]{1,3}[\.]{1}){3}[0-9]{1,3}/)}"
status = true
end
}
}
if (!status)
puts '[-] Not found. Check your domain name.'
end
rescue OpenURI::HTTPError => error_msg
puts "[-] Ups! Got bad status code: #{error_msg}. Try again"
rescue Timeout::Error
puts '[-] oops! Timeout bro, check your internet connection'
rescue Exception => e
puts "#{e.message}"
end
