Monthly Archives: September 2009

SQL – Create and Insert Table

0
Filed under sql
Tagged as , , , , ,

Author: Rizky Ramadhan
Site: -
Summary: SQL syntax to create a table and insert to table.

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

Taken from: http://paste.c0de.me/pastebin.php?show=5
*/

/* create_table */
CREATE TABLE IF NOT EXISTS 'member' (
  'id' int(11) unsigned NOT NULL AUTO_INCREMENT,
  'namalengkap' varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  'email' varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  'password' tinyint(3) unsigned DEFAULT NULL,
  'gender' varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  'regdate' varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY ('id')
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

/* Insert_table */
INSERT INTO 'member' ('id', 'namalengkap', 'email', 'password', 'gender', 'regdate') VALUES
(1, 'Rizky Ramadhan', 'rizky05@cs.its.ac.id', 123, 'm', '2009-09-20 03:29:17');

badge,pixel badge,sql

Python – Show HTTP Status Code and HTTP Status Message

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

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Python script to get HTTP status code and HTTP status code. This script is very useful to check your REST Web Service status code and status message. Tested on Linux.
Usage: python httpstatus.py -m HTTP_METHOD -t YOUR_TARGET_HOST

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

import httplib, re
from optparse import OptionParser
from time import sleep

class HTTPStatus:
	def __init__(self):
		self.host = ""
		self.path = ""
		self.http_method = ""

		usage = "usage: %prog -m method -t target"
		parser = OptionParser(usage=usage)
		parser.add_option("-m", "--method", dest="method",
				help="HTTP method: GET, POST, PUT, DELETE", metavar="http_method")
		parser.add_option("-t", "--target", dest="target",
				help="Your target host", metavar="target_host")
		(opts, args) = parser.parse_args()

		if opts.target:
			self.host = opts.target

			if re.search("http://", self.host):
				self.host = self.host.split("http://", 1)
				self.host = self.host[1]

			# extract hostname & path
			try:
				self.host = self.host.split("/", 1)
				self.path = "/"+self.host[1]
				self.host = self.host[0]
			except:
				self.host = self.host[0]
				self.path = "/"

		if opts.method:
			self.http_method = opts.method

	def getTarget(self):
		return self.host+self.path

	def getHTTPMethod(self):
		method_name = ""
		if re.match("(GET|POST|PUT|DELETE)", self.http_method):
			method_name = self.http_method
		return method_name

	def sendRequest(self):
		try:
			print "[!] building Connection..."
			conn = httplib.HTTPConnection(self.host)
			sleep(1)
			print "[!] Sending Request..."
			conn.request(self.http_method, self.path)
			sleep(1)
			print "[!] Reading Response...\n"
			resp = conn.getresponse()
			sleep(1)
			print "[+] Summary"
			print "[+] ---------------------------"
			print "[+] Target: http://"+self.host+self.path
			print "[+] Status Code:", resp.status
			print "[+] Status Message:", resp.reason
			print "[+] ---------------------------\n"
			conn.close()
		except:
			print "[-] Error! Check Your Internet Connection and target host."

if __name__ == "__main__":
	print "\n[+] ---------------------------------------------------"
	print "[+] Show HTTP Status Code and HTTP Status Message"
	print "[+] httpstatus.py - slac3dork@gmail.com"
	print "[+] Coded by: slac3dork"
	print "[+] ---------------------------------------------------\n"
	sleep(2)
	obj = HTTPStatus()
	target = obj.getTarget()
	method = obj.getHTTPMethod()
	if target and method:
		obj.sendRequest()



python,logo,banner

Ruby – Whois

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

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




ruby,code,code,snippet