Author Archives: admin

Installing Ntop-NG1.1 Debian 6x or 7x

Installation

First, Install the following packages:
$ apt-get install subversion libpcap-dev libglib2.0-dev libgeoip-dev wget libxml2-dev libsqlite3-dev dh-autoreconf autoconf2.13 lua5.1

Once installed, you must edit and add  the following backports line to /etc/apt/sources.list
deb http://backports.debian.org/debian-backports squeeze-backports mainvisit website

Run update for backports
$ apt-get update

Once everything is installed, run the following to get the proper version of  redis-server:
$ apt-get -t squeeze-backports install redis-server

Now to download the latest build of Ntop-ng1.1 using subversion:
$ svn co https://svn.ntop.org/svn/ntop/trunk/ntopng/

Change into your ntopng directory and run the following commands:
$ ./autogen.sh
$ ./configure
$ make
$ make install
$ make geoip

Download ntopng-data-1.1_6932.tgz with wget:
wget http://downloads.sourceforge.net/project/ntop/ntopng/ntopng-data-1.1_6932.tgz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fntop%2Ffiles%2Fntopng%2F&ts=1407436613&use_mirror=hivelocity

$ tar xvfvz ntopng-data-1.1_6932.tgz
$ cd ntopng-data-1.1_6932
$ cp -r ./usr/* /usr

Configuration

$ mkdir -p /etc/ntopng/data

Create /etc/ntopng/ntopng.start and add the following:
–local-networks “192.168.1.0/24”
–interface eth0

Create /etc/ntopng/ntopng.conf and add the following:
-G=/var/run/ntopng.pid
–dump-flows=/etc/ntopng/data

Starting Ntop-NG

$ /usr/local/bin/ntopng –daemon &

Add the following to /etc/rc.local to start Ntop-NG on startup:
#Starts ntop-ng
/usr/local/bin/ntopng –daemon

Web GUI

http://hostname:3000/
Default Username: admin
Default Password: admin

How to read geotagged pictures commandline Linux

This is a quick and easy guide to help you install jhead and read data from geotagged pictures from the commandline.

First, lets go ahead and install jhead:

Redhat/Fedora:
$ yum install jhead

Debian/Ubuntu:
$ apt-get install jhead

Once installed, download a test geotagged picture to confirm jhead is working correctly:
wget http://www.geospatialexperts.com/images/geotagging%20flooding.JPG

Now lets test jhead to see if it works correctly:
jhead geotagging\ flooding.JPG

The output should be the same as the following:
File name : geotagging flooding.JPG
File size : 114275 bytes
File date : 2014:08:08 14:41:01
Camera make : RICOH
Camera model : Caplio 500SE
Date/Time : 2009:01:02 22:12:36
Resolution : 406 x 305
Flash used : No (auto)
Focal length : 8.6mm
Exposure time: 0.0013 s (1/760)
Aperture : f/5.4
ISO equiv. : 64
Whitebalance : Auto
Metering Mode: pattern
Exposure : program (auto)
GPS Latitude : N 45d 31m 53.1099s
GPS Longitude: W 98d 24m 46.4099s
GPS Altitude : 390.00m
Comment :

As you can see, the GPS coordinates are displayed form the pictures EXIF data.

Using ckermit to connect to serial console

First,  install ckermit as root or sudo:

Debian:
apt-get install ckermit

Redhat:
yum install ckermit

Once installed, run the following command to determine the tty:
dir /dev/tty*

If you are using USB serial connector like myself, then it will be /dev/ttyUSB0. Once the tty is found, run the following command to allow a non-root user to access ttyUSB0:
chmod a+rwx /dev/ttyUSB*

Start up ckermit with the follow command:
kermit

Once, kermit is loaded, enter the following settings into the kermit shell:
set port /dev/ttyUSB0
set speed 115200
set carrier-watch off
set flow-control none
connect

Once the connection is established, press the “enter” key a few times to wake the terminal connection. Enjoy using ckermit as your terminal client.

Supported Baud Rates:

  • 300
  • 1200
  • 2400
  • 4800
  • 9600
  • 14400
  • 19200
  • 28800
  • 38400
  • 57600 *commonly used for small embedded devices
  • 115200 *commonly used for PC
  • 230400

How to install psycopg2 on Linux

psycopg2 is a Python module for PostgreSQL. Various PostgreSQL and Python scripts require this. It can be a bit tricky to install. So here is how I was able to install psycopg2 on CentOS 5.x. PIP/Source installs should be applicable for any Linux OS.

Requirements:
– Postgresql
– Postqresql-devel
– Python

YUM Installation:
yum install python-psycopg2

Apt-Get Installation:
apt-get install python-psycopg2

PIP Installation:
PIP – A tool for installing and managing Python packages. This is required and is needed to install Python packages with pip. Clone pip from github:
cd ~
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py –no-check-certificate
python get-pip.py

Once pip is installed, then locate and export the directory that contains pg-config. X.Y specific to your pgsql install:
locate pg_config
export PATH=/usr/lib/postgresql/X.Y/bin/:$PATH

Now to install using pip:
pip install psycopg2

Source Installation:
Locate and export the directory that contains pg-config. X.Y specific to your pgsql install:
locate pg_config
export PATH=/usr/lib/postgresql/X.Y/bin/:$PATH

Now to install psycopg2 via source:
cd ~
wget http://initd.org/psycopg/tarballs/PSYCOPG-2-5/psycopg2-2.5.3.tar.gz
tar zxvf psycopg2-2.5.3.tar.gz
cd psycopg2-2.5.3/
python setup.py install

Please contact me if you have any issues. Enjoy!

How to build and install ATI video cards Fedora 20

The current ATI catalyst driver does not install on Fedora 20. I needs to patched in order to be installed successfully. Here are the how to instructions for building the beta ATI driver for the following:

OS: Fedora release 20 (Heisenbug)
Architecture: x86_64 (64-bit)
X Server: XServer 1.14.4
Kernel: 3.16.2-200.fc20.x86_64 #1 SMP Mon Sep 8 11:54:45 UTC 2014 x86_64 x86_64 x86_64 GNU/Linu

Make sure your kernel devel and headers are installed:
yum install kernel-devel kernel-headers

Next download the latest ATI driver:
cd /tmp
wget –referer=http://support.amd.com http://www2.ati.com/drivers/beta/linux-amd-catalyst-14.6-beta-v1.0-jul11.zip

Now unzip and extract the run binary:
unzip linux-amd-catalyst-14.6-beta-v1.0-jul11.zip
cd fglrx-14.20/
./amd-driver-installer-14.20-x86.x86_64.run –extract patched

Once the run binary is extracted, we need to download and patch firegl_public.c:
cd /tmp/fglrx-14.20/patched/common/lib/modules/fglrx/build_mod
wget http://devgurus.amd.com/servlet/JiveServlet/download/1304255-7665/firegl_public_c.patch.zip
unzip firegl_public_c.patch.zip
patch -u < firegl_public_c.patch Once the firegl_public.c is patched, then run the following to make it as root or using sudo:
./make.sh

Once built, go to the following directory and install everything:
cd /lib/modules/fglrx
make install

Everything should successfully install. Reboot and enjoy a working desktop. Remember, run the following to bring up the catalyst configuration tool:
amdcccle

Make Raspberry Pi SDcard Backups

Take the SDcard out of the Pi and insert into your Linux PC via a card reader:

Run the following command to find what the device ID:
dmesg

My SDcard is /dev/sdd. Run the following command to back up the SDcard:
sudo dd bs=4M if=/dev/sdd | gzip > ~/piBackup.gz

To restore the backup on SD card:
sudo gzip -dc ~/piBackup.gz | dd bs=4M of=/dev/sdd

Free Shell Accounts

Found a website that gives you a free shell account, no questions asked (other than username/password):

http://shell.cjb.net/

Enjoy your new shell. Not sure how limited it is, but its great for practising shell commands like awk and sed.

Build 32bit on 64bit Debian

Install the following:
apt-get install libc6-dev-i386 lib32ncurses5-dev

Run the following on the commandline to set the 32bit environment:
export LDFLAGS=’-m32 -L/usr/lib32′
export CFLAGS=’-m32′
export CXXFLAGS=’-m32′
export LDFLAGS=’-m32′

SSH Tip Of The Day

Change your default SSH port from 22 to 2222 and run netcat in a screen session in a while loop like so:

while true; do nc -l -v -p 22; done

Then when hackers attempt to connect into the SSH port, a connection to netcat is made instead. Netcat is setup so it does not time out, which will hang the hacking attempt. The hacker will more than likely move on to a different target as their scripts break due to netcat not timing out. Great way to stop hackers dead in their tracks