Posted by admin on October 14, 2009 – 6:28 pm
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Simple bash script to update twitter status. You may need install cURL.
Usage: ./filename.sh “your tweet”
#!/bin/bash
#
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork@gmail.com
username="YOUR_TWITTER_USERNAME"
password="YOUR_TWITTER_PASSWORD"
tweet=$1
length=`echo $tweet | wc -m`
if [ $length -gt 140 ]; then
echo "Your tweet is longer than 140 characters"
else
xml=`curl -k -u $username:$password -d status="$tweet" https://twitter.com/statuses/update.xml`
echo "$xml"
fi

Posted by admin on September 11, 2009 – 2:43 pm
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

Posted by admin on August 8, 2009 – 3:23 pm
Filed under ruby
Tagged as API, attribute, class, cli, code, command line, command line argument, cURL, cURL like, http, method, net/http, NET::HTTP.post_form, option parse, optparse, rb, ruby, simple, simple cURL, snippet, status, Tweeby, tweet, twitter, twitter API, update, URI.parse
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Tweeby, a cURL alternative only to update twitter status. Just for fun. Tested on Linux.
#!/usb/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
require 'optparse'
require 'net/http'
class Tweeby
def initialize
puts '-------------------------------------------------------'
puts '[+] Tweeby - cURL alternative to update twitter status'
puts '[+] Tweeby.rb - http://snippet.c0de.me'
puts '[+] Author: slac3dork'
puts "-------------------------------------------------------\n\n"
end
def parseOptions
begin
options = {}
opts = OptionParser.new
opts.banner = "Usage: ./tweeby.rb -u your_username -p your_password -s your_status\nExample: ./tweeby.rb -u myuser -p mypassword -s 'this is my status'"
opts.on('-u your_username', '--user your_username', 'your_username = Your Twitter username') do |u|
@username = u
end
opts.on('-p your_password', '--password your_password', 'your_password = Your Twitter password') do |p|
@passwd = p
end
opts.on('-s your_status', '--status your_status', 'your_status = Your Twitter status message') do |s|
@status = s
end
opts.on('-v', '--verbose', 'Run verbosely') do |v|
@verbose = v
end
opts.parse!
if (!(@username and @passwd and @status))
puts opts
exit(1)
end
rescue OptionParser::ParseError
puts opts
exit(1)
end
end
def sendTweet
begin
puts '[+] Starting Tweeby...'
tweet = Net::HTTP.post_form(
URI.parse("http://#{@username}:#{@passwd}@twitter.com/statuses/update.xml"),
{"status"=>"#{@status}"})
if @verbose
puts tweet.body
else
puts '[+] Your status has been updated'
end
puts '[+] Done...'
rescue Exception
puts '[-] Error while tweeting, check your username, password, and internet connection'
end
end
end
# main
twitter = Tweeby.new
twitter.parseOptions
twitter.sendTweet
