Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation



integrationblogcta.jpg

LeechProtect Module Documentation

Handling of cPanel's Leech Protect feature

The functions within this module may or may not be governed by a feature list. The required feature list may vary from function to function, to review a total list of the available features sets on a cPanel server, please see "Feature Manager" in WHM.

LeechProtect::setup

API Version: 1 - Click here for documentation
Syntax: LeechProtect::setup( dir, item, type )
Description: This function provides a method for querying values in the .leechprotect configuration file in a particular directory.
Parameters:  
  dir (string)
  The directory that contains the file to query.
  item (string)
  The item to query in the configuration file. Acceptable values include email, kill, numhits, and url.
  type (string)
  The format for the output. html retrieves HTML-encoded output. uri retrieves URI-encoded output. check or checkbox will return checked if the value is present.
Returns:  
 
The output will depend on the items chosen.

LeechProtect::showpasswdfile

API Version: 1 - Click here for documentation
Syntax: LeechProtect::showpasswdfile( dir )
Description: Retrieve the location of the passwd file for a specified directory.
Parameters:  
  dir (string)
  The directory for which to locate the passwd file.
Returns:  
 
The output should resemble the following:
/home/user/.htpasswds/public_html/test/passwd

LeechProtect::disable

API Version: 1 - Click here for documentation
Syntax: LeechProtect::disable( dir )
Description: Disable leech protection for a specified directory. This function requires access to the 'cpanelpro_leechprotect' or 'leechprotect' feature. In demo mode, this function requires access to the 'leechprotect' feature.
Parameters:  
  dir (string)
  The directory for which to disable leech protection.
Returns:  
 
This function does not produce any output when used in an array. Otherwise, the output should resemble the following:
LeechProtection disabled for /home/user/public_html/test

LeechProtect::status

API Version: 1 - Click here for documentation
Syntax: LeechProtect::status( dir )
Description: Print whether or not leech protection is enabled for a specific directory.
Parameters:  
  dir (string)
  The directory to query.
Returns:  
 
The output should resemble the following:

'enabled' or 'disabled'

LeechProtect::enable

API Version: 1 - Click here for documentation
Syntax: LeechProtect::enable( dir, numhits, badurl, email, killcompro )
Description: Enable leech protection for a specified directory. This function also keeps track of how many times a user logs into a protected directory over a 2-hour period. If the user accessing the directory exceeds a defined threshold, the function will take a specified action. This function requires access to the 'cpanelpro_leechprotect' or 'leechprotect' feature. In demo mode, this function requires access the 'leechprotect' feature.
Parameters:  
  dir (string)
  The directory to which to add leech protection.
  numhits (integer (optional))
  The number of times a user can log into a directory before triggering leech protection. This value defaults to 4.
  badurl (string)
  The URL to redirect users who exceed the leech protection threshold.
  email (string)
  The email address to which to send notices after leech protection is triggered.
  killcompro (boolean)
  Passing 1 to this function disables the offending account.
Returns:  
 
This function will not produce any output when used in an array. Otherwise, the output should resemble the following:
LeechProtection enabled for public_html/test


Topic revision: r2 - 27 Mar 2012 - 18:42:47 - Main.JenniferDoubrava