Posted by admin on November 28, 2009 – 5:19 am
Filed under ruby
Tagged as code, crawler, domain, domain name, gem, http, ruby, spider, spidr, spidr gem, url, web crawler, web spider
Author: Kunto Aji
Site: http://www.railsmine.net
Summary: Ruby script to get all URLs from target site. You may need install Spidr gem first. This script is tested on Linux.
Usage: ruby filename.rb
#!/usb/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://www.railsmine.net
require 'rubygems'
require 'spidr'
i = 1
url_file = File.open('spider.txt', 'w')
Spidr.start_at('http://www.railsmine.net/') do |spider|
spider.every_url { |url|
puts "#{i}. #{url}"
if (url_file)
url_file.puts("#{i}. #{url}")
end
i = i + 1
}
end
url_file.close
puts "Done. All URLs has been saved to spider.txt"

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 July 26, 2009 – 3:12 pm
Author: slac3dork
Site: http://snippet.c0de.me
Summary:Ruby code to check domain name. This script need internet connection and create connection to http://www.who.is/. Tested on Linux.
Usage: ruby domainchecker.rb <domain_name> or ./domainchecker.rb <domain_name>
Update: This is New version, old version does not work anymore.
#!/usb/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork@gmail.com
#
# This script was written by slac3dork
# This script is available under the GPLv3 License.
# USE COMPLETELY ON YOUR OWN RISK.
# Tested on Linux
require 'open-uri'
if ARGV.size < 1
puts '[-] Usage ./domainchecker.rb <domain_name>'
exit 1
end
puts '------------------------------------------------'
puts '[+] Domain Checker tool Version 2'
puts '[+] Author: slac3dork'
puts "-----------------------------------------------\n\n"
begin
domain_name = ARGV[0]
open("http://www.who.is/whois/#{domain_name}/", "User-Agent" => "Mozilla/5.0") {|page|
page.each_line {|line|
if (line =~ /ERROR/)
puts '[-] ERROR! Please check your domain name'
exit 1
end
if (line =~ /REGISTRY WHOIS FOR/)
puts "[-] #{domain_name} is not available"
end
if (line =~ /IS AVAILABLE/)
puts "[+] #{domain_name} is available"
end
if (line =~ /available_domain/)
avail_domain = line.slice(/domain=[a-z]+[\.]{1}[a-z]{2,}/).slice(/[a-z]+[\.]{1}[a-z]{2,}/)
puts "[+] Available Domain: #{avail_domain}"
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
