On 23/07/2008, Ashish Shukla आशीष शुक्ल <[EMAIL PROTECTED]> wrote: > > I have a remote device that is generating data and is sending as a TCP > > packet to designated IP:Port. If I open and set a non standard port I > > am able to receive the packets using a listener. Problem is that the > > host where I have to move this project allows listening only on port > > 80 (apache) or port 25/110 (mail) or port 22 (ssh) > > > I'm a bit confused. Is your remote device say XYZ, sends TCP packets > to $IP:$PORT, and you want your listener app say ABC to listen on > $IP:$PORT to record all the data that XYZ is sending, hmm...? And your > listening app can only listen on 22,25,80,110 TCP ports, right ?
App can listen on all ports but firewall does not allow anything but these ports to be opened. > > How can I set up apache or iptables to log in incoming data packets > > while at the same time allow apache to serve web pages? > > Do you care about payload of those TCP packets or packet headers also > ? If former then you do that with netcat (listening on any of your > desired port). > - ---->8----->8----- > #!/bin/sh > > while true ; do > CAPFILE=/capdir/$(date +%d%m%Y_%H%M%S) > nc -p $DESIRED_PORT -l $IP_ADDRESS_I_WANT_TO_LISTEN_ON >$CAPFILE > done > - ---->8----->8----- > > And if you log packets headers also, you've two options: tcpdump (with > - -w switch) or iptables rule (with LOG target). > Thanks for info and pointers. My confusion is that with apache running web service on port 80 how will system distinguish between http request and tcp packet for listening. -- Regards, Sudev Barar Read http://blog.sudev.in for topics ranging from here to there. PS: I know most of people do not follow email niceties (mostly they are not aware) but if you follow bottom post/in-line post style of email conversations it becomes a whole lot easier to carry on meaningful dialogue and you can snip out what is not meaningful too. Most people just hit reply button and top post leaving prior message appended uselessly at bottom. See if you can adopt this style and persuade others. In case you are already doing this ..... great, spread the message. _______________________________________________ ilugd mailinglist -- ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi http://www.mail-archive.com/ilugd@lists.linux-delhi.org/