Tuesday, November 13, 2012

(Simple, pretty crappy) Banner Grabbing with Linux

HTTP Server Banner Grab

Using netcat (nc) to interact with an HTTP server. The output can be 'teeed' and 'grepped'

$ nc www.computerbiology.com 80
GET / HTTP/1.1
Host: computerbiology.com
User-Agent: commandline :-D
Referrer: google.com

[Enter key 2x]  and you get a response like this:

HTTP/1.1 301 Moved Permanently
Date: Tue, 07 May 2013 23:29:42 GMT
Server: Apache
X-Pingback: http://www.computerbiology.com/xmlrpc.php
Location: http://www.computerbiology.com/
Content-Length: 0
Content-Type: text/html; charset=UTF-8


Telnet Server

A simple netcat one liner can be used by itself or in scripts to perform banner grabbing.

Telnet banner grab and output to file:
nc -v host.com 23 | tee output.txt | sleep 3

This command opens a verbose netcat connection, tee grabs the stdout and sends the output to a file, and sleep for a few seconds to ensure connection was made and entire banner captured.

Note: output.txt can be changed to a $var for bash scripting to reduce disk I/O

Tuesday, January 10, 2012

Change playback speed/framerate of AVI file

I found a useful command while making time lapse videos with a digital camera.

I set the camera to take a picture once every 30 sec. It converts those pictures into an avi file.

The problem was the hour I spent testing the time lapse only produced 120 'frames' - the avi was playing back at 30 frames per second.. end result being a 4 second video that flashed by the screen.

My first attempts to slow this video down resulted in a 4 second video with a slower frame rate but it truncated the movie and most of the 'frames' were missing.

mencoder -speed .25 -ovc copy movie_in.avi -o movie_out.avi

The end result of this command is a longer video file, because the speed was slowed down, this way each picture 'frame' is on the screen longer. The -speed option is expressed in a percentage of the original speed.

Adjust the .25 to 1 and you have the output .avi the same speed as the original..if you set -speed to 3 the framerate is faster.