Unix Programming - socket "sniffing" and redirection

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2004 > socket "sniffing" and redirection





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author socket "sniffing" and redirection
luc wastiaux

2004-10-03, 7:47 am

Hello,
I need to analyze a protocol that uses a simple TCP socket, and I don't
have root access on the system. I was wondering if there exists a
utility that listens on a certain port, prints (hexdump) the data it
reads, then forwards the data to a remote machine, thereby allowing me
to analyse the protocol without root access.

Thanks for any suggestions.

--
luc wastiaux
Heiko

2004-10-03, 5:55 pm

luc wastiaux wrote:

> I need to analyze a protocol that uses a simple TCP socket, and I don't
> have root access on the system. I was wondering if there exists a
> utility that listens on a certain port, prints (hexdump) the data it
> reads, then forwards the data to a remote machine, thereby allowing me
> to analyse the protocol without root access.


See if "netcat" (or "nc") is installed.
The actual program is usually called "nc", and "netcat" being a symlink
to it.

$ nc -l -p 19368 | hexdump

-l listen
-p 19368 port number to listen on

(see "man nc" or "man netcat")

Regards,

Heiko
Martijn Lievaart

2004-10-03, 5:55 pm

On Sun, 03 Oct 2004 16:14:23 +0200, Heiko wrote:

> luc wastiaux wrote:
>
>
> See if "netcat" (or "nc") is installed.
> The actual program is usually called "nc", and "netcat" being a symlink
> to it.
>
> $ nc -l -p 19368 | hexdump
>
> -l listen
> -p 19368 port number to listen on
>
> (see "man nc" or "man netcat")


Exactly the answer I was going to give, with the addition that this only
works on unprivileged ports. Otherwise you simply need root access.

As to forwarding to another machine, again netcat. If you need to make a
bi-directional pipe, some simple PERL is in order, stfw.

M4
--
Redundancy is a great way to introduce more single points of failure.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com