Overview
Use this API to configure and update the brute force settings on your server.
Brute Force settings and Error message
Use this ApI to update Brute force settings ad the error message
Parameter
Sample Code
curl --insecure -d "save_settings=1" -d "max_retry=8" -d "lockout_time=30" -d "max_lockouts=6" -d "lockouts_extend=24" -d "reset_retries=24" -d "bf_log_reset=25" -d "email_noti=1" -d "send_email=e@e.com" -d "admin_panel_allowed_ips=" -d "fail_login=meessgae" -d "ip_blacklisted=meessgae" -d "attempt_left=meessgae" -d "lockout_err=meessgae" -d "minutes=meessgae" -d "hours=meessgae" -u "username:password" -X POST "https://Hostname or IP:2005/index.php?api=json&act=bruteforce_settings"
<?php
$user = 'root';
$pass = 'password';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@Hostname or Ip:2005/index.php?api=json&act=bruteforce_settings';
$post = array('save_settings' => 1,
'max_retry' => 7,
'lockout_time' => 30,
'max_lockouts' => 6,
'lockouts_extend' => 24,
'reset_retries' => 24,
'bf_log_reset' => 25,
'send_email' => 'd@c.com',
'email_noti' => 0,
'admin_panel_allowed_ips' => '',
'disable_brute' => 1,
'fail_login' => 'Incorrect Username or Password ',
'ip_blacklisted' => 'Your IP has been blacklisted',
'attempt_left' => 'attempt(s) left',
'lockout_err' => 'You have exceeded maximum login retries Please try after',
'minutes' => 'minute(s)',
'hours' => 'hour(s)'
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']);
echo "</pre>";
}else{
print_r($res['error']);
}
Use this API to blacklist and Whitelist IP's
Parameter
Sample code
To whitelist an IP, replace b_ip_start with w_ip_start and b_ip_end with w_ip_end
curl --insecure -d "save_ip_settings=1" -d "b_ip_start=start_ip" -d "b_ip_end=end_ip" -u "username:password" -X POST "https://Hostname or Ip:2005/index.php?api=json&act=bruteforce_settings"
<?php
$user = 'username';
$pass = 'password';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@Hostname/Ip:2005/index.php?api=json&act=bruteforce_settings';
$post = array('save_ip_settings' => 1,
'b_ip_start' => '15.23.23.23',
'b_ip_end' => '15.23.23.39'
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']);
echo "</pre>";
}else{
print_r($res['error']);
}
Output
The settings were saved successfully
Delete blacklist/whitelist IP's
Use this API for delete Blacklist and whitelist IP's and range of IP's
Parameter
Sample Code
curl --insecure -d "delete=all or index number" -d "key=whitelist/blacklist" -d "b_ip_end=end_ip" -u "username:password" -X POST "https://IP or Hostname:2005/index.php?api=json&act=bruteforce_settings"
<?php
$user = 'username';
$pass = 'password';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@IP or Hostname:2005/index.php?api=json&act=bruteforce_settings';
$post = array('delete' => 'all', // Or index number for a particular IP
'key' => 'blacklist' // for Whitelist pass 'whitelist'
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']);
echo "</pre>";
}else{
print_r($res['error']);
}