Server IP : 195.201.23.43 / Your IP : 3.12.107.192 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/virtual-server/ |
Upload File : |
#!/usr/bin/perl # Runs clamdscan, and exits with 1 if the program reports a virus was found # or 0 if not was found or some error happened $prog = join(" ", map { quotemeta($_) } @ARGV); $temp = "/tmp/clamwrapper.$$"; unlink($temp); # Check if we are using the streaming client, which has slightly different # semantics $stream_client = $ARGV[0] =~ /clamd-stream-client/ ? 1 : 0; $fullprog = $prog; if (!$stream_client) { $fullprog .= " -"; } # Feed email to clamscan $SIG{'PIPE'} = 'ignore'; $clampid = open(INPUT, "|$fullprog >$temp"); while(read(STDIN, $buf, 32768) > 0) { print INPUT $buf; } # Wait at most 30 seconds for a response $timed_out = 0; $SIG{'ALRM'} = sub { $timed_out++ }; alarm(30); close(INPUT); alarm(0); if ($timed_out) { print STDERR "Virus scanner failed to response within 30 seconds\n"; kill('KILL', $clampid); unlink($temp); exit(0); } # Read back status from clamscan, and exit non-zero if a virus was found open(OUTPUT, "<".$temp); while(<OUTPUT>) { $out .= $_; } close(OUTPUT); unlink($temp); if ($stream_client && $out =~ /\S/) { # Using clamd-stream-client - output contains a virus name if found exit(1); } elsif (!$stream_client && $out =~ /FOUND/) { # Using clamscan or clamdscan - output contains FOUND if a virus # was detected exit(1); } else { exit(0); }Private