Posted by admin on January 7, 2010 – 4:21 pm
Filed under ruby
Tagged as argument, code, command line argument, port, port scanner, portscanner, ruby, scanner, simple, snippet, socket
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Simple Port Scanner Using Ruby. Tested on Linux. Thanks to someone who’s inspired me to create this script. I forget the name my inspirator, sorry.
Usage: ruby port_scanner.rb <target> <startPort> <endPort>
#!/usb/bin/ruby
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
#
require 'socket'
require 'timeout'
class Scanner
def Scanning(host, startPort, endPort)
print "\nScanning ", host, "\n"
for port in startPort..endPort
begin
s = TCPSocket.open(host, port)
Timeout::timeout(1){s}
rescue
else
print "Port ",port,": Open\n"
s.close
end
end
end
end
class Msg
def hello
puts "-------------------------------------"
puts "Simple Port Scanner using Ruby"
puts "Author: slac3dork"
puts "I don't know who gives me inspiration to create this script"
puts "-------------------------------------"
end
end
if ARGV.length != 3
puts "\nUsage: ruby port_scanner.rb <target> <startPort> <endPort>"
exit(1)
end
target = ARGV[0]
startPort = ARGV[1].to_i
endPort = ARGV[2].to_i
host = Scanner.new
host.Scanning(target, startPort, endPort)

Posted by admin on November 4, 2009 – 5:17 pm
Author: slac3dork
Site: http://snippet.c0de.me
Summary: Python script to search file. Tested on Linux.
Usage: python filesearcher.py <TARGET_DIR>
#!/usr/bin/python
#
# _________ .__ .____ _______
# / _____/ ____ |__|_____ | | \ _ \ ____
# \_____ \ / \| \____ \| | / /_\ \ / ___\
# / \ | \ | |_> > |__\ \_/ \/ /_/ >
#/_______ /___| /__| __/|_______ \_____ /\___ /
# \/ \/ |__| \/ \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
from os import walk
from sys import argv
def searching(dir, target):
status = False
for rootdir, dirs, files in walk(dir):
for file in files:
if file == target:
status = True
path = rootdir+"/"
if status:
print target, "was found at:", path
else:
print target, "not found"
if __name__ == "__main__":
if len(argv) != 2:
print "Usage: python filesearcher.py <TARGET_DIR>"
exit()
filename = raw_input("target file: ")
dir_name = argv[1]
searching(dir_name, filename)

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
