private static function doEarlyAccessLogging()
 {
     $wfLog = self::getLog();
     if ($wfLog->logHitOK()) {
         if (empty($wfFunc) && is_404()) {
             $wfLog->logLeechAndBlock('404');
         } else {
             $wfLog->logLeechAndBlock('hit');
         }
         if (wfConfig::liveTrafficEnabled()) {
             self::$hitID = $wfLog->logHit();
             add_action('wp_head', 'wordfence::wfLogHumanHeader');
         }
         /*
         if(wfConfig::get('perfLoggingEnabled', false)){
         	add_action('wp_head', 'wordfence::wfLogPerfHeader');
         }
         */
     }
 }
Exemple #2
0
    public static function wfLogHumanHeader()
    {
        self::$hitID = self::getLog()->logHit();
        if (self::$hitID) {
            $URL = home_url('/?wordfence_logHuman=1&hid=' . wfUtils::encrypt(self::$hitID));
            $URL = addslashes(preg_replace('/^https?:/i', '', $URL));
            #Load as external script async so we don't slow page down.
            echo <<<HTML
<script type="text/javascript">
(function(url){
\tif(/(?:Chrome\\/26\\.0\\.1410\\.63 Safari\\/537\\.31|WordfenceTestMonBot)/.test(navigator.userAgent)){ return; }
\tvar addEvent = function(evt, handler) {
\t\tif (window.addEventListener) {
\t\t\tdocument.addEventListener(evt, handler, false);
\t\t} else if (window.attachEvent) {
\t\t\tdocument.attachEvent('on' + evt, handler);
\t\t}
\t};
\tvar removeEvent = function(evt, handler) {
\t\tif (window.removeEventListener) {
\t\t\tdocument.removeEventListener(evt, handler, false);
\t\t} else if (window.detachEvent) {
\t\t\tdocument.detachEvent('on' + evt, handler);
\t\t}
\t};
\tvar evts = 'contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop keydown keypress keyup mousedown mousemove mouseout mouseover mouseup mousewheel scroll'.split(' ');
\tvar logHuman = function() {
\t\tvar wfscr = document.createElement('script');
\t\twfscr.type = 'text/javascript';
\t\twfscr.async = true;
\t\twfscr.src = url + '&r=' + Math.random();
\t\t(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(wfscr);
\t\tfor (var i = 0; i < evts.length; i++) {
\t\t\tremoveEvent(evts[i], logHuman);
\t\t}
\t};
\tfor (var i = 0; i < evts.length; i++) {
\t\taddEvent(evts[i], logHuman);
\t}
})('{$URL}');
</script>
HTML;
        }
    }
Exemple #3
0
 public static function templateRedir()
 {
     $wfFunc = get_query_var('_wfsf');
     $wfLog = self::getLog();
     if ($wfLog->logHitOK()) {
         if (empty($wfFunc) && is_404()) {
             $wfLog->logLeechAndBlock('404');
         } else {
             $wfLog->logLeechAndBlock('hit');
         }
         if (wfConfig::get('liveTrafficEnabled')) {
             self::$hitID = $wfLog->logHit();
             add_action('wp_head', 'wordfence::wp_head');
         }
     }
     if (!($wfFunc == 'diff' || $wfFunc == 'view' || $wfFunc == 'sysinfo' || $wfFunc == 'conntest' || $wfFunc == 'unknownFiles' || $wfFunc == 'IPTraf' || $wfFunc == 'viewActivityLog' || $wfFunc == 'testmem' || $wfFunc == 'testtime')) {
         return;
     }
     if (!wfUtils::isAdmin()) {
         return;
     }
     $nonce = $_GET['nonce'];
     if (!wp_verify_nonce($nonce, 'wp-ajax')) {
         echo "Bad security token. It may have been more than 12 hours since you reloaded the page you came from. Try reloading the page you came from. If that doesn't work, please sign out and sign-in again.";
         exit(0);
     }
     if ($wfFunc == 'diff') {
         self::wfFunc_diff();
     } else {
         if ($wfFunc == 'view') {
             self::wfFunc_view();
         } else {
             if ($wfFunc == 'sysinfo') {
                 require 'sysinfo.php';
             } else {
                 if ($wfFunc == 'conntest') {
                     require 'conntest.php';
                 } else {
                     if ($wfFunc == 'unknownFiles') {
                         require 'unknownFiles.php';
                     } else {
                         if ($wfFunc == 'IPTraf') {
                             self::wfFunc_IPTraf();
                         } else {
                             if ($wfFunc == 'viewActivityLog') {
                                 self::wfFunc_viewActivityLog();
                             } else {
                                 if ($wfFunc == 'testmem') {
                                     self::wfFunc_testmem();
                                 } else {
                                     if ($wfFunc == 'testtime') {
                                         self::wfFunc_testtime();
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     exit(0);
 }