FreedomCoder Information for free-minded geeks

16Feb/091

Nmaports 0.3: Now with pdf support

Luego de un par ajustes al c?digo Nmaports sigue creciendo y agregando features.
Ahora , Nmaports tiene soporte para generar la tabla en formato PDF.

def create_pdf(list,name=nil)
require 'prawn'
require 'prawn/layout'
Prawn::Document.generate(name || "output.pdf") do

data = []
list.each do |k,v|
data << [k,(v.map { |k| k + "\n" }.to_s).strip]
end

table data,
:position => :center,
:headers => ["Port", "IP Adresses"],
:header_color => "0046f9",
:row_colors => :pdf_writer, #["ffffff","ffff00"],
:font_size => 10,
:vertical_padding => 2,
:horizontal_padding => 5
end
end

Para bajar la ultima versi?n del repositorio Git :

http://github.com/FreedomCoder/nmapports/tree/master

9Feb/0910

Download & install ruby-1.9.1

Viendo que algunos me preguntaban como bajar e instalar ruby 1.9 para probarlo. Aca les dejo un script en bash que baja, descomprime, configura e instala ruby con un prefijo -1.9.1 en el directorio /opt/local (Directorio comunmente usado en osx por macports.)

#!/bin/sh
curl ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz > /tmp/ruby-1.9.1-p0.tar.gz
cd /tmp
tar xvf ruby-1.9.1-p0.tar.gz
cd ruby-1.9.1-p0
autoconf
./configure --program-suffix=-1.9.1 --prefix=/opt/local
make
sudo make install

UPDATE: I just added another script to install directly from the svn repository. This is for those crazy people who like to live on the edge.

#!/bin/sh
if [ -z "$1" ]; then
echo "usage: $0 <install|update> "
echo "Author: Matias Pablo Brutti"
echo "Bye :) "
exit
fi

echo "This might not compile because it is download straight from"
echo "the svn repository. If it does not work either wait and try"
echo "again later or do your work and check why is not working."
echo "Happy hacking!"

if [ "$1" == install ]; then
echo "Downloading ruby from the svn repo"
svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby
cd ruby
fi

if [ "$1" == update ]; then
echo "Cleaning last install and updating repo"
cd ruby
make clean
svn update
fi

echo "Configuring && installing ..."
autoconf
./configure --program-suffix=-1.9 --prefix=/opt/local
make
sudo make install

Enjoy.