Making ARP packets with scapy

When I was starting to learn scapy library, and tried to make some ARP packets, it was a little bit hard to find what I needed in the documentation and Google. These are just a few notes that may help.

¿What are the parameters in an ARP packet?

We can see them creating a void ARP packet and then calling show() method. This is the output of Python CLI:


>>> x = ARP()
>>> x.show()
###[ ARP ]###
hwtype = 0x1
ptype = 0x800
hwlen = 6
plen = 4
op = who-has
hwsrc = 78:ac:c0:43:11:f8
psrc = 192.168.1.2
hwdst = 00:00:00:00:00:00
pdst = 0.0.0.0

The ARP operation is encoded in the op attribute, which may be set to "who-has" (ARP REQUEST) or "is-at" (ARP REPLY).

Example:


pkt = Ether() / ARP(psrc="10.0.0.2",pdst="10.0.0.1",op="is-at",hwsrc="00:1B:C9:21:08:7E")

Posted in Uncategorized | Leave a comment

solving MKVToolnix compile crash

When trying to compile mkvtoolnix 4.6 on Ubuntu 10.10, the compiler crashed with the following error message:


(in /home/agonzalez/src/mkvtoolnix-4.6.0)
CXX src/input/flac_common.cpp
cc1plus: internal compiler error: Segmentation fault
Please submit a full bug report, with preprocessed source if appropriate.

The solution is discussed at Gentoo’s BugZilla in bug 311595.

In a few words, the problem is solved by compiling the source files that give problems with a special command line. This line was, in my case:


g++ -O3 -march=barcelona -O2 -ftracer -ftree-vectorize -g -ggdb -fvisibility-inlines-hidden -DPACKAGE=\"mkvtoolnix\" -DVERSION=\"4.7.0\" -DMTX_LOCALE_DIR=\"/usr/share/locale\" -DMTX_PKG_DATA_DIR=\"/usr/share/mkvtoolnix\" -I. -Ilib -Ilib/avilib-0.6.10 -Ilib/utf8-cpp/source -Isrc -Ilib/libebml -MMD -c -o src/input/flac_common.o src/input/flac_common.cpp

This compiles src/input/flac_common.cpp into object file src/input/flac_common.o. I had to repeat this for src/common/curl.cpp, changing the corresponding filenames in the command line.

Posted in Uncategorized | Tagged , | Leave a comment

dvgrab micro-howto

In this post, basic usage of dvgrab is explained. Dvgrab is a CLI tool that allows the user to capture Digital Video (DV) data from a FireWire port.


Capture and save to .dv files

A first try would look like this:

# dvgrab –format raw –autosplit –size 100 source_

This tells dvgrab to capture data and save it in files source_001.dv, source_002.dv, etc, limiting the size of each file to 100 MB.
[Reference: Become a digital editing guru using linux tools ]

Capture and encode

Digital Video is not compressed very much, so it takes a lot of disk space to store .dv files.
We may want to encode the video as we capture it, for example using ffmpeg2theora.

# dvgrab –format raw – | ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o video.ogg


Taking one step ahead, we may stream this encoded video to an Icecast2 server, using oggfwd.

# dvgrab –format raw – | \
ffmpeg2theora -a 0 -v 5 -f dv -x 320 -y 240 -o /dev/stdout – | \

oggfwd www.myicecastserver.net 8000 passwd /mountpoint.ogg

[Reference: ffmpeg2theora examples ]

FireWire permissions

In some Linux distributions, the FireWire device (/dev/raw1394) has file access permissions only for the superuser.

In a terminal windows do as follows:

$ sudo /etc/udev/rules.d/40-permissions.rules

Where you can replace with: emacs, vi, nano, gedit, …

Find the line that says:

KERNEL==”raw1394″, GROUP=”disk”

and change it to:

KERNEL==”raw1394″, GROUP=”video”

This implies some security risks. Please read the reference for more information.

References:

Similar information can be found here:


sudo, ksudo and gksudo

Other possibility is to use sudo. Sudo allows you execute a command as other user, just writing ‘sudo’ before the command:

$ sudo dvgrab …

Tipically, sudo will prompt you to type your password in the terminal.

ksudo and gksudo are similar to sudo, but they are designed to be used in KDE or GNOME (respectively), and they ask for your password in a window, rather than in the terminal.
See also:



Posted in Uncategorized | Tagged , , , | Leave a comment

GStreamer Tutorials

In this post, I group some interesting tutorials and documentation related to GStreamer.

- Here is the official docummentation.

http://gstreamer.freedesktop.org/documentation/

- Here is also a good tutorial.

http://www.cin.ufpe.br/~cinlug/wiki/index.php/Introducing_GStreamer

GStreamer is a C library. But there are also binding for Python (PyGST). When I was trying to learn GStreamer, glib and GObject concepts became a stone in the way, since I hadn’t much experience with these libraries. So I think, if someone has some basic understanding of Python, maybe PyGST is a easier way to begin learning GStreamer concepts.

So, here are some Python GStreamer tutorials:

http://pygstdocs.berlios.de/

http://pygstdocs.berlios.de/pygst-tutorial/introduction.html

http://www.jonobacon.org/2006/08/28/getting-started-with-gstreamer-with-python/

http://pitivi.org/wiki/Introduction

Enlace

Posted in Uncategorized | Leave a comment

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

Posted in Uncategorized | Leave a comment