You are here

function drush_httpbl_mbb in http:BL 8

Command handler. Make dummy blacklisted and banned hosts (for testing).

File

drush/httpbl.drush.inc, line 167
Drush integration for the httpbl module.

Code

function drush_httpbl_mbb($max = 255, $offset = 300, $pattern = '127.1.8.') {
  $limit = 255;
  $max <= $limit ?: ($max = $limit);
  $logMessage = t('Making @max blacklisted AND banned hosts to expire in @time seconds, with pattern @pat.', [
    '@max' => $max,
    '@time' => $offset,
    '@pat' => $pattern,
  ]);

  // Get Evaluator service and whitelist this IP.
  $httpblEvaluator = \Drupal::service('httpbl.evaluator');
  $command = $httpblEvaluator
    ->makeBannedHosts($max, $offset, $pattern);
  drush_log(dt($logMessage), 'ok');
  return $command;
}