Capturing FTP packets with Java
I've been banging my head against the wall for the better part of the day on figuring out how I would capture FTP packets between a source and destination.
I need to know the source, the destination, the file being transferred, and the port that content is transferred to. Pretty much the same information that I could get from a header in WireShark.
I've been trying to replicate this with Jnetpcap. It's given me some information (Time/Date), but I can't get everything that I'm wanting. IE: Is the packet that I captured an FTP packet? I only want to capture FTP. That's it.
Here is how the flow would go..
This portion of a larger program would continuously monitor traffic going out over FTP. It would not take in traffic from other protocols. It would monitor only one Network adaptor. It would only look at FTP packets. The derived strings of information would be formatted, placed into a data structure, then pushed on a linked list. When the transmission has completed, the asset will be pop'ed off of the linked list.
I know I can do the Data Structure components just fine in Java. The problem as stated earler is that I can't seem to derive this information from Jnetpcap. Is there another way I should be doing this? or am I approaching this wrong?
Thanks in advance!