Koozali.org: home of the SME Server

Recovering quarantined files from a ClamAV false positive panic.

Offline jwab

  • *
  • 9
  • +0/-0
Re: Recovering quarantined files from a ClamAV false positive panic.
« Reply #15 on: January 13, 2010, 03:01:22 PM »
Thank you very much for the commenting. Has help me immensely and I'll use for reference.

The script copied the majority of the files, it had problems with folders and filenames with silly formats, but they were few enough to be manually moved.

I'm just wondering, is this perl? If so, it would explain why it looks so alien.

Thanks again.

Online Stefano

  • *
  • 10,894
  • +3/-0
Re: Recovering quarantined files from a ClamAV false positive panic.
« Reply #16 on: January 13, 2010, 03:10:39 PM »
Hi.

yes, it's perl :-)

google is full of "perl for dummies" guides ;-)

Ciao

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Recovering quarantined files from a ClamAV false positive panic.
« Reply #17 on: January 13, 2010, 11:00:50 PM »
I'm just wondering, is this perl? If so, it would explain why it looks so alien.
It is actually very straight forward (for a perl script), most of it is replacing characters in the filenames. But if you are used to M$ Visual Basic or the-like it might be pretty unreadable indeed. :)
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline whitepawn

  • 1
  • +0/-0
Re: Recovering quarantined files from a ClamAV false positive panic.
« Reply #18 on: May 24, 2012, 03:49:37 PM »
hi, try this for the error: cannot execute binary file

Code: [Select]
#!/usr/bin/perl

# open file
open (FILE, './mylog1.txt');

# loop through lines
while (<FILE>)
{
   if (/(.*)(: moved to )(.*)/)
    {
      # store "source" and "destination" in 2 new variables
      my $t3 = $3;
      my $t1 = $1;
      # in source line, remove the ' character at beginning of line
      $t3 =~ s/^'//;
      # again, remove the ' character at the end
      $t3 =~ s/'$//;
      # concatenate source and destination, separed by a tab
      my $stringa = $t3."\t".$t1;
      # replace all spaces " " with "\ "
      $stringa =~ s/ /\\ /g;
      # replace all ' with \'
      $stringa =~ s/'/\\'/g;
      # replace all ( with \(
      $stringa =~ s/\(/\\\(/g;
      # replace all ) with \)
      $stringa =~ s/\)/\\\)/g;
      #print the resulting line with "cp " at the beginning
      print 'cp -p  '.$stringa."\n";
      # call and execute the command
      # this line should be commented with # to check for errors
      system 'cp -p ' .$stringa."\n";
        }
}   
close (FILE);

good look  :-)