Monthly Archives: July 2009

Ruby – Domain Name Checker

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

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

ruby,code,code,snippet

Bash – Show Computer Hardware Specification

0
Filed under bash
Tagged as , , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: This script will show information about processor, RAM, hard disk, VGA, audio, and Ethernet on your computer. Linux Only.

#!/bin/bash
#
#  _________      .__       .____   _______
# /   _____/ ____ |__|_____ |    |  \   _  \    ____
# \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
# /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
#/_______  /___|  /__|   __/|_______ \_____  /\___  /
#        \/     \/   |__|           \/     \//_____/
# http://snippet.c0de.me
# slac3dork@gmail.com

clear
echo '-----------------------------------------------------------'
echo 'simple bash script to show computer specification'
echo 'slac3dork[at]gmail[dot]com - http://snippet.c0de.me'
echo '-----------------------------------------------------------'
echo
user_id=`id -u`

if [ $user_id -ne 0 ]; then
  echo "Only root can run this script"
  exit
fi

echo === Computer Spesification ===
echo

# MAIN SPECIFICATION

# ========== PROSESOR ==========
core=`cat /proc/cpuinfo | grep -c "model name"`
model=`cat /proc/cpuinfo | grep "model name" | head -n1 | cut -f2 -d ":"`
cache=`cat /proc/cpuinfo | grep cache | head -n1 | cut -f2 -d ":"`

echo PROCESSOR
echo core" = $core"
echo model" = $model"
echo cache size" = $cache"
echo

# ========== RAM =========
memTotal=`cat /proc/meminfo | head -n1 | cut -f8 -d " "`
memTotalMB=`expr $memTotal / 1024`

echo RAM / Main Memory
echo Total Memory" = $memTotal KB = $memTotalMB MB"
echo

# ========== Harddisk =========
hdTotal=`cat /proc/partitions | head -n3 | tail -n1 | cut -f12 -d " "`
hdTotalMB=`expr $hdTotal / 1024`
hdTotalGB=`expr $hdTotalMB / 1024`

echo Harddisk
echo Total Capacity" = $hdTotalMB MB = $hdTotalGB GB"
echo

# ========== VGA ==========
vga=`lspci | grep VGA | cut -f3 -d":"`

echo VGA / Graphic Card
echo Model" = $vga"
echo

# ADDITIONAL Specification

# ========== AUDIO ==========
audio=`lspci | grep Audio | cut -f3 -d":"`

echo Audio
echo Model" = $audio"
echo

# ========== Ethernet ==========
eth=`lspci | grep Ethernet | cut -f3 -d":"`

echo Ethernet / LAN Card
echo Model" = $eth"
echo
echo

echo "Thanks for using this script. By slac3dork"



logo,snippet,badge,pixel badge,bash

Python – Get HTTP Server Information

0
Filed under python
Tagged as , , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: A python code that will print HTTP Server Response message. For educational purpose only. Tested on Linux.
Usage: python httpserverinfo.py <target_server>

#!/usr/bin/python
#
#  _________      .__       .____   _______
# /   _____/ ____ |__|_____ |    |  \   _  \    ____
# \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
# /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
#/_______  /___|  /__|   __/|_______ \_____  /\___  /
#        \/     \/   |__|           \/     \//_____/
# http://snippet.c0de.me
# slac3dork@gmail.com

import urllib2, sys, re
from time import sleep

def serverInfo(server):
	try:
		print "[-]building request"
		req = urllib2.Request(server)
		sleep(2)
		print "[-]sending request"
		url = urllib2.urlopen(req)
		print "[-]getting information...\n"
		server_info = url.info()
		sleep(2)
		return server_info
	except (urllib2.URLError):
		status = "address not found"
		return status

def welcomeBro():
	print "[+] --------------------------------"
	print "[+] Getting HTTP server infomation"
	print "[+] httserverinfo.py"
	print "[+] Coded By slac3dork"
	print "[+] Greetz to low1z"
	print "[+] --------------------------------\n"

def error():
	print "error bro!"
	print "hey, you don't know how to use this?"
	print "usage: python httpserverinfo.py <target>\n"
	print "target example: http://google.com"

if (__name__ == "__main__"):
	welcomeBro()

	if (len(sys.argv) == 2):
		server = sys.argv[1]
		if (not (re.search("http://", server))):
			server = "http://"+server
		print serverInfo(server)
	else:
		error()



python,logo,banner