1

I'm working on a system to scan remote files for viruses. I'm downloading as a stream and would like to avoid saving unscanned files to disk for obvious reasons.

I can use clamscan for scanning the stream, but I'm not sure how to generate that stream in the command line. Both echo and the command line have the potential of playing games with what is actually being output if I did something like the following:

system("echo $data | clamscan -");

Are there any elegant solutions to achieving this that I am missing? Obviously I could probably filter the file dump with some stream editor before it hits clamscan, but that is definitely not elegant and prone to error, I would think.

Dan
  • 3,246
  • 1
  • 32
  • 52

1 Answers1

1

You could use popen(). However, it has its limitations. Anything more sophisticated will require you to play with your pipes and spawning of processes.

wilx
  • 17,697
  • 6
  • 59
  • 114