No point in replicating work,
unless you want to, go to
www.monkey.org/~bugsong/dsniff.html
This is a suite of programs that are used for network troubleshooting, please respect them as such. There is a tool in the suite called tcpkill, you can download the source tar file, and tear it apart. He does some very cool stuff with networking here, I suggest a good read of the whole thing, very informative.
THis is also available from the BSD ports and packages collections.
You should be able to take the tcpkill code and work it into a script ( if you want to do that ) with lsof providing the input. Obviously you'll need to compile it, and I believe that it does depend on some of the other files for declarations and such, check the Makefile for exactly what you have for options.
HTH,
loadc