/**
  * Generate SQL from the whitelist.  Uses the return format from wfLog::getWhitelistedIPs
  *
  * @see wfLog::getWhitelistedIPs
  * @param array $whitelisted_ips
  * @return string
  */
 public function getBlockedIPWhitelistWhereClause($whitelisted_ips = null)
 {
     if ($whitelisted_ips === null) {
         $whitelisted_ips = wordfence::getLog()->getWhitelistedIPs();
     }
     if (!is_array($whitelisted_ips)) {
         return false;
     }
     $where = '';
     /** @var array|wfUserIPRange|string $ip_range */
     foreach ($whitelisted_ips as $ip_range) {
         if (is_array($ip_range) && count($ip_range) == 2) {
             $where .= $this->db->prepare('IP BETWEEN %s AND %s', $ip_range[0], $ip_range[1]) . ' OR ';
         } elseif (is_a($ip_range, 'wfUserIPRange')) {
             $where .= $ip_range->toSQL('IP') . ' OR ';
         } elseif (is_string($ip_range) || is_numeric($ip_range)) {
             $where .= $this->db->prepare('IP = %s', $ip_range) . ' OR ';
         }
     }
     if ($where) {
         // remove the extra ' OR '
         $where = substr($where, 0, -4);
     }
     return $where;
 }
Exemple #2
0
 /**
  * Has correct user agent and PTR record points to .googlebot.com domain.
  *
  * @param string|null $ip
  * @param string|null $ua
  * @return bool
  */
 public static function isVerifiedGoogleCrawler($ip = null, $ua = null)
 {
     static $verified;
     if (!isset($verified)) {
         $verified = array();
     }
     if ($ip === null) {
         $ip = wfUtils::getIP();
     }
     if (array_key_exists($ip, $verified)) {
         return $verified[$ip];
     }
     if (self::isGoogleCrawler($ua)) {
         if (self::verifyCrawlerPTR(wordfence::getLog()->getGooglePattern(), $ip)) {
             $verified[$ip] = true;
             return $verified[$ip];
         }
         if (self::verifyGooglebotViaNOC1($ip)) {
             $verified[$ip] = true;
             return $verified[$ip];
         }
     }
     $verified[$ip] = false;
     return $verified[$ip];
 }
Exemple #3
0
    $newestItem = 0;
    $sumEvents = array();
    $timeOffset = 3600 * get_option('gmt_offset');
    foreach ($events as $e) {
        if (strpos($e['msg'], 'SUM_') !== 0) {
            if ($debugOn || $e['level'] < 4) {
                $typeClass = '';
                if ($debugOn) {
                    $typeClass = ' wf' . $e['type'];
                }
                echo '<div class="wfActivityLine' . $typeClass . '">[' . date('M d H:i:s', $e['ctime'] + $timeOffset) . ']&nbsp;' . $e['msg'] . '</div>';
            }
        }
        $newestItem = $e['ctime'];
    }
    echo '<script type="text/javascript">WFAD.lastALogCtime = ' . $newestItem . '; WFAD.processActArray(' . json_encode(wordfence::getLog()->getSummaryEvents()) . ');</script>';
} else {
    ?>
						A live stream of what Wordfence is busy with right now will appear in this box.

					<?php 
}
?>
			</div></div></div>
			<div style="position: relative; width: 803px;">
				&nbsp;
				<a href="#" target="_blank" class="wfALogViewLink" id="wfALogViewLink">View activity log</a>
			</div>
			<div style="margin: 0 0 20px 5px; width: 795px;">
				<strong>Docs:</strong> Our <a href="http://support.wordfence.com/" target="_blank">Support Site</a> can answer many common (and some less common) questions. It also includes our priority support ticketing system for Premium Wordfence users. 
				<?php 
Exemple #4
0
 /**
  * Has correct user agent and PTR record points to .googlebot.com domain.
  *
  * @return bool
  */
 public static function isVerifiedGoogleCrawler()
 {
     return self::isGoogleCrawler() && self::verifyCrawlerPTR(wordfence::getLog()->getGooglePattern(), wfUtils::getIP());
 }