Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks I have the following requirement. I need to develop a perl program, which is used to log what are the files that are currently transferred from system to USB device and from USB device to system.

I also seen Device::USB, but I don't this it will solve my requirement

Any help??

Replies are listed 'Best First'.
Re: USB logging
by moritz (Cardinal) on Jun 13, 2009 at 09:32 UTC
    Which operation system should it work on? I could imagine that the approach to solving this is quite different depending on OS. (Even though I have to admit that currently I have no good idea how to solve that, except maybe patching a kernel level USB driver).
      I'm on linux and using Debian.
        If the USB devices are mounted by udev or a similar tool, you might try to install some hooks that set up an inotify listener, which then records all reads from the USB device.

        That way you wouldn't have to make sense of the USB traffic yourself, but you could use the more high-level file system and inotify interface.

        I think the easiest solution is to use Net::Pcap to capture all USB traffic. At least from what I understand, Wireshark can nowadays sniff USB traffic, and I presume that this feature comes from the libpcap library which is encapsulated for Perl by Net::Pcap.