Tag Archives: convert

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

Ruby – Domain Name to IP address

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

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

ruby,code,code,snippet

C – Celcius Temperature Converter

1
Filed under c
Tagged as , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: C code to convert celcius temperature to reamur and fahreinheit temperature. Tested on Linux.

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

http://snippet.c0de.me

slac3dork@gmail.com
*/

#include <stdio.h>

void converter(float temp, char temp_type) {
	float result;

	if (temp_type == 2) {
		result = ((9 * temp) / 5) + 32;
		printf("\nResult = %.2f Fahrenheit\n", result);
	} else {
		result = (temp / 5) * 4;
		printf("\nResult = %.2f Reamur\n", result);
	}
}

int main(void) {
	float c;
	int temp_type;

	printf("---------------------------------------------------\n");
	printf("celciusconv.c\n");
	printf("Convert Celcius temperature to Reamur or Fahrenheit\n");
	printf("Coded By slac3dork\n");
	printf("---------------------------------------------------\n\n");
	printf("Celcius temperature: ");
	scanf("%f", &c);
	printf("Convert to Reamur/Fahrenheit (1 / 2): ");
	scanf("%d", &temp_type);

	if ((temp_type == 1) || (temp_type == 2)) {
		converter(c, temp_type);
	} else {
		printf("\nUnknown...Plase input 1 or 2");
	}

	return 0;
}

c,logo,pixel badge,badge