Knowledge Base

Hook Script after file detection

cPGuard allows you to run a script after detecting a bad file, in which you can run necessary actions on the affected file. In hook script, you will get the following details as arguments.

  • The original path of the infected file
  • Path to Quarantined file or "not-quarantined" if the file is not quarantined
  • Virus Description


A sample hook script is available in the following locations for respective control panels and the sample content is also given below. You need to copy the file as “virus_hook.php” into the same directory with your customization. 

cPanel :-  /usr/local/cpanel/whostmgr/docroot/cgi/cpguard/scripts/virus_hook_sample.php

DirectAdmin :-  /usr/local/directadmin/plugins/cpguard/cpguard/scripts/virus_hook_sample.php


$original_path = $argv[1];      // Original path of infected file
$quarantine_path = $argv[2];    // Path to Quarantined file or "not-quarantined" if file was not quarantined
$virus_definition = $argv[3];   // Virus Description


Please contact our support if you need any additional details or want any additional features with the hook script. 

Please rate this article to help us improve our Knowledge Base.

0 0