Tag Archives: ip address

PHP – Redirecting Malicious IP Address

0
Filed under php
Tagged as , , , , ,

Author: slac3dork
site: http://snippet.c0de.me
summary: PHP code to redirect user from malicious IP address

<?php 

/**
  _________      .__       .____   _______
 /   _____/ ____ |__|_____ |    |  \   _  \    ____
 \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
 /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
/_______  /___|  /__|   __/|_______ \_____  /\___  /
        \/     \/   |__|           \/     \//_____/  

http://snippet.c0de.me

slac3dork@gmail.com
*/

/* Replace this with your IP address.. */
$malicious_ip = '127.0.0.1'

if ($_SERVER['REMOTE_ADDR'] == $malicious_ip) {
header("Location: http://www.example.com/");
}
?>



php,logo,pixel badge,badge

Ruby – IP Address to Domain Name

0
Filed under ruby
Tagged as , , , , , , , , , , , , , , , , , , , , , , , ,

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

ruby,code,code,snippet