ClamWin Free Antivirus Forum Index
ClamWin Free Antivirus
Support and Discussion Forums
Reply to topic
Possible bug with command line virus checking
Luky


Joined: 15 Jan 2006
Posts: 3
Reply with quote
Installed ClamWin AntiVir today and must say it looks very good. Smile
But its necessary for me to be able to check for viruses through clamscan.exe because I'm running it on a server which should make emails and attachments virus-free. (Yeah, added already a ClamWin logo on my webbased mail service site Very Happy)

I moved the database files into the clamwin directory because it dont wanted to work in command promt with a path like "C:\Dokumente und Einstellungen\All Users\...".

Following Problem:
When opening command line prompt and typing in
C:\Programme\ClamWin\bin\clamscan.exe C:\testfile.txt --database=C:\Programme\ClamWin\clamwin\db
it works very well and checks that testfile.txt is clean.

But when I try to execute that command with PHP like:
Code:
<?php system ("C:\Programme\ClamWin\bin\clamscan.exe C:\testfile.txt --database=C:\Programme\ClamWin\clamwin\db"); ?>

it returns just an "empty" report which only conatains that:
Code:

----------- SCAN SUMMARY -----------
Known viruses: 0
Engine version: 0.88
Scanned directories: 0
Scanned files: 0
Infected files: 0
Data scanned: 0.00 MB
Time: 0.031 sec (0 m 0 s)

Tried to fix that over more hours without result.

What I also tried was to put the Command into a *.bat file and to start the bat file through PHP. That returned also an "empty" report.

The same problem occures when I try to configure http://www.sssolutions.net/mf/ Server Side Solutions - Mailfilter Pro (an addon to a mail server) with ClamWin.

Hope there is a reason for this.
Thanks. Wink
View user's profileSend private message
alch
Site Admin

Joined: 27 Nov 2005
Posts: 1748
Reply with quote
try this syntax:
<?php system ("\"C:\\Programme\\ClamWin\\bin\\clamscan.exe\" 'C:\\testfile.txt' --database='C:\\Programme\\ClamWin\\clamwin\db'"); ?>

with \" or ' quotes you can have spaces inside the path

(I think \t is a reserved sequence for TAB in PHP and that explains why it didn't scan the file)
View user's profileSend private message
Luky


Joined: 15 Jan 2006
Posts: 3
Reply with quote
Thanks for the fast response.
Thats one of the things I have tried already, by replacing all backslashes with chr(92) so i dont have to escape them.
But there must be a difference between the execution with system and the command line prompt.

When opening a .bat file through system-function of PHP I dont have to escape any chars.

So for example the content of test.bat is:
Code:
C:\Programme\ClamWin\bin\clamscan.exe C:\boot.ini --database='C:\Dokumente und Einstellungen\All Users\clamwin\db'


and the System command is:
system "D:\\test.bat";
(why do i get a "forbidden" screen when i type in some php code? Surprised )

it returns the empty result. But if I open the bat file directly it shows up that it was scanned successfuly.

Maybe some screenshots can help:
http://lukydeluxe.org/gfx/scr1.gif 1 | http://lukydeluxe.org/gfx/scr2.gif 2
View user's profileSend private message
alch
Site Admin

Joined: 27 Nov 2005
Posts: 1748
Reply with quote
this string
<?php system ("\"C:\\Programme\\ClamWin\\bin\\clamscan.exe\" 'C:\\testfile.txt' --database='C:\\Programme\\ClamWin\\clamwin\db'"); ?>
works here okay
View user's profileSend private message
Luky


Joined: 15 Jan 2006
Posts: 3
Reply with quote
Hi! Tried this String on 3 other machines with the same result, so tried to make a process connection and that method works:

(Too much to show here, so click http://lukydeluxe.org/Projekte/clamwin.php THIS)

Thanks for support! Maybe its a permission failure with system ()
View user's profileSend private message
Possible bug with command line virus checking
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic