How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread king6c...@gmail.com
hi,
  This is a question not specific to Python,but its related somehow,and I
believe I can get some help from your fellow:)
  I am doing my work on a server service program on Linux that processes the
packages sent to the socket it listens.Their is already a old such service
listening on the port doing its job,and
I can't stop the old server service, and I need to get the packages sent to
the old server and send them to my new server service to make sure it works
well .How can I get the package and resent them to my new service? Is there
such a tool or is there some functionality that tools such as tcpdump
already provides?
Thanks:)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Matty Sarro
Its possible using TCPDUMP and wireshark. however its a bit of a
manual process (open the pcap in wireshark, select the correct tcp
stream, and extract the file). I did this to show a vulnerability in
how medical images were transmitted in a university hospital once :)

Here are some guides, maybe it can serve as a jumping off point?
http://packetlife.net/blog/2009/jul/13/quick-packet-capture-data-extraction/
http://wiki.wireshark.org/TCP_Reassembly

There are some C# libraries specifically for this:
http://www.codeproject.com/KB/IP/TcpRecon.aspx

Not sure if anything exists explicitly for python though.
-Matty

On Wed, Aug 31, 2011 at 9:35 AM, king6c...@gmail.com
king6c...@gmail.com wrote:
 hi,
   This is a question not specific to Python,but its related somehow,and I
 believe I can get some help from your fellow:)
   I am doing my work on a server service program on Linux that processes the
 packages sent to the socket it listens.Their is already a old such service
 listening on the port doing its job,and
 I can't stop the old server service, and I need to get the packages sent to
 the old server and send them to my new server service to make sure it works
 well .How can I get the package and resent them to my new service? Is there
 such a tool or is there some functionality that tools such as tcpdump
 already provides?
 Thanks:)

 --
 http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Grant Edwards
On 2011-08-31, Matty Sarro msa...@gmail.com wrote:

 Its possible using TCPDUMP and wireshark. however its a bit of a
 manual process (open the pcap in wireshark, select the correct tcp
 stream, and extract the file).

Presumably the OP knows the port IP address and port number on which
the server is listening, so wouldn't it be simpler to just capture TCP
traffic to/from that IP/port?

Then you can play it back using tcprewrite, tcpreplay, et al.

But, I don't see how that's going to work.  The OP seems to want to
capture a TCP session and then replay it so that the client from the
session ends up talking to a different server during the replay. The
chances of the new server starting up a connection with the same ACK
sequence number is practially nil isn't it?

 ?? This is a question not specific to Python,but its related
 somehow,and I believe I can get some help from your fellow:) ?? I am
 doing my work on a server service program on Linux that processes the
 packages sent to the socket it listens.Their is already a old such
 service listening on the port doing its job,and I can't stop the old
 server service, and I need to get the packages sent to the old server
 and send them to my new server service to make sure it works well
 .How can I get the package and resent them to my new service? Is
 there such a tool or is there some functionality that tools such as
 tcpdump already provides? Thanks:)

-- 
Grant Edwards   grant.b.edwardsYow! ... this must be what
  at   it's like to be a COLLEGE
  gmail.comGRADUATE!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Emile van Sebille

On 8/31/2011 6:35 AM king6c...@gmail.com said...

hi,
   This is a question not specific to Python,but its related somehow,and
I believe I can get some help from your fellow:)
   I am doing my work on a server service program on Linux that
processes the packages sent to the socket it listens.Their is already a
old such service listening on the port doing its job,and
I can't stop the old server service, and I need to get the packages sent
to the old server and send them to my new server service to make sure it
works well .How can I get the package and resent them to my new service?
Is there such a tool or is there some functionality that tools such as
tcpdump already provides?


I recently set up a standby spare fax server on a network that I also 
needed to test, and was able to tee the source transmissions to both 
systems.  That may be an option, particularly as it sounds like you've 
written a consumer of info and are not replying and interacting with the 
source.


Emile



--
http://mail.python.org/mailman/listinfo/python-list


Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread king6c...@gmail.com
In fact,UDP is enough for me,I heared that tcpdump and netcat can store and
resend the udp packages to get the replay effect,but I don't know how, or is
there some better way? I am working on a Linux server and only some basic
terminal tools are available :)

2011/8/31 Emile van Sebille em...@fenx.com

 On 8/31/2011 6:35 AM king6c...@gmail.com said...

  hi,
   This is a question not specific to Python,but its related somehow,and
 I believe I can get some help from your fellow:)
   I am doing my work on a server service program on Linux that
 processes the packages sent to the socket it listens.Their is already a
 old such service listening on the port doing its job,and
 I can't stop the old server service, and I need to get the packages sent
 to the old server and send them to my new server service to make sure it
 works well .How can I get the package and resent them to my new service?
 Is there such a tool or is there some functionality that tools such as
 tcpdump already provides?


 I recently set up a standby spare fax server on a network that I also
 needed to test, and was able to tee the source transmissions to both
 systems.  That may be an option, particularly as it sounds like you've
 written a consumer of info and are not replying and interacting with the
 source.

 Emile




 --
 http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to save the packages received by a network interface or some port in a file and resend the packages received when needed?

2011-08-31 Thread Emile van Sebille

On 8/31/2011 8:37 AM king6c...@gmail.com said...

In fact,UDP is enough for me,I heared that tcpdump and netcat can store
and resend the udp packages to get the replay effect,but I don't know
how,


That may be, but I've never tried that.



or is there some better way? I am working on a Linux server and
only some basic terminal tools are available :)


If appropriate, I'd try the iptables --tee option.

Emile

--
http://mail.python.org/mailman/listinfo/python-list