menu_activity.php 19.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
<?php if (wfConfig::liveTrafficEnabled()): ?>
	<div id="wfLiveTrafficOverlayAnchor"></div>
	<div id="wfLiveTrafficDisabledMessage">
		<h2>Live Updates Paused<br /><small>Click inside window to resume</small></h2>
	</div>
<?php endif ?>
<div class="wrap wordfence">
	<h2 id="wfHeading">
		<div style="float: left;">
			Your Site Activity in Real-Time
		</div>
		<div class="wordfenceWrap" style="margin: 5px 0 0 15px; float: left;">
			<div class="wfOnOffSwitch" id="wfOnOffSwitchID">
				<input type="checkbox" name="wfOnOffSwitch" class="wfOnOffSwitch-checkbox"
				       id="wfLiveTrafficOnOff" <?php if (wfConfig::liveTrafficEnabled()) {
					echo ' checked ';
				} ?>>
				<label class="wfOnOffSwitch-label" for="wfLiveTrafficOnOff">
					<div class="wfOnOffSwitch-inner"></div>
					<div class="wfOnOffSwitch-switch"></div>
				</label>
			</div>
		</div>
	</h2>
	<a href="http://docs.wordfence.com/en/Live_traffic" target="_blank" class="wfhelp"></a><a href="http://docs.wordfence.com/en/Live_traffic" target="_blank">Learn more about Wordfence Live Traffic</a>

	<div class="wordfenceModeElem" id="wordfenceMode_activity"></div>
	<?php include('live_activity.php'); ?>
	<div class="wf-container-fluid">
		<div class="wf-row">
			<?php
			$rightRail = new wfView('marketing/rightrail');
			echo $rightRail;
			?>
			<div class="<?php echo wfStyle::contentClasses(); ?>">
			<?php
			$overridden = false;
			if (!wfConfig::liveTrafficEnabled($overridden)):
			?>
				<div id="wordfenceLiveActivityDisabled"><p><strong>Live activity is disabled<?php if ($overridden) { echo ' by the host'; } ?>.</strong> Login and firewall activity will still appear below.</p></div>
			<?php endif ?>
				<div class="wf-row wf-add-bottom-small">
					<div class="wf-col-xs-12" id="wf-live-traffic-legend-wrapper">
						<div id="wf-live-traffic-legend-placeholder"></div>
						<div id="wf-live-traffic-legend">
							<ul>
								<li class="wfHuman">Human</li>
								<li class="wfBot">Bot</li>
								<li class="wfNotice">Warning</li>
								<li class="wfBlocked">Blocked</li>
							</ul>
						</div>
					</div>
				</div>
				<div class="wf-row">
					<div class="wf-col-xs-12">
						<div id="wf-live-traffic" class="wfTabsContainer">
							<form data-bind="submit: reloadListings">
			
								<?php if (defined('WP_DEBUG') && WP_DEBUG && false): ?>
									<pre data-bind="text: 'DEBUG: ' + sql(), visible: sql"></pre>
								<?php endif ?>
			
								<div class="wfActEvent">
									<h2 style="float: left;padding: 0;margin: 0 10px 0 0;">Filter Traffic: </h2>
			
									<select id="wf-lt-preset-filters" data-bind="options: presetFiltersOptions, optionsText: presetFiltersOptionsText,
										value: selectedPresetFilter">
									</select>
									&nbsp;&nbsp;
									<label>
										<input data-bind="checked: showAdvancedFilters" type="checkbox">
										Show Advanced Filters
									</label>
								</div>
			
								<div class="wfActEvent" data-bind="visible: showAdvancedFilters" id="wf-lt-advanced-filters">
									<table>
										<tr>
											<td>
												<table>
													<tbody data-bind="foreach: filters">
													<tr>
														<td>
															<select name="param[]" class="wf-lt-advanced-filters-param" data-bind="options: filterParamOptions,
															optionsText: filterParamOptionsText, value: selectedFilterParamOptionValue, optionsCaption: 'Filter...'"></select>
														</td>
														<td data-bind="visible: selectedFilterParamOptionValue() && selectedFilterParamOptionValue().type() != 'bool'">
															<select name="operator[]" class="wf-lt-advanced-filters-operator"
																	data-bind="options: filterOperatorOptions,
															optionsText: filterOperatorOptionsText, value: selectedFilterOperatorOptionValue"></select>
														</td>
														<td data-bind="attr: {colSpan: (selectedFilterParamOptionValue() &&
															selectedFilterParamOptionValue().type() == 'bool' ? 2 : 1)}"
															class="wf-lt-advanced-filters-value-cell">
			
															<span
																data-bind="if: selectedFilterParamOptionValue() && selectedFilterParamOptionValue().type() == 'enum'">
																<select
																	data-bind="options: selectedFilterParamOptionValue().values,
																	optionsText: selectedFilterParamOptionValue().optionsText,
																	value: value"></select>
															</span>
			
															<span
																data-bind="if: selectedFilterParamOptionValue() && selectedFilterParamOptionValue().type() == 'text'">
																<input data-bind="value: value" type="text"/>
															</span>
			
															<span
																data-bind="if: selectedFilterParamOptionValue() && selectedFilterParamOptionValue().type() == 'bool'">
																<label>Yes <input data-bind="checked: value" type="radio"
																				  value="1"></label>
																<label>No <input data-bind="checked: value" type="radio"
																				 value="0"></label>
															</span>
			
														</td>
														<td>
															<button data-bind="click: $root.removeFilter" type="button"
																	class="wf-btn wf-btn-default">
																Remove
															</button>
														</td>
													</tr>
													</tbody>
													<tbody>
													<tr>
														<td colspan="3">
															<div class="wf-pad-small">
																<button type="button" class="wf-btn wf-btn-default" data-bind="click: addFilter">
																	Add Filter
																</button>
															</div>
														</td>
													</tr>
													</tbody>
												</table>
											</td>
											<td>
												<table>
													<tbody>
													<tr>
														<td>
															<label for="wf-live-traffic-from">From:&nbsp;</label>
														</td>
														<td><input placeholder="Start date" id="wf-live-traffic-from" type="text"
																   class="wf-datetime"
																   data-bind="value: startDate, datetimepicker: null, datepickerOptions: { timeFormat: 'hh:mm tt z' }">
														</td>
														<td>
															<button data-bind="click: startDate('')" class="wf-btn wf-btn-default wf-btn-sm"
																	type="button">
																Clear
															</button>
														</td>
													</tr>
													<tr>
														<td>
															<label for="wf-live-traffic-to">To:&nbsp;</label>
														</td>
														<td><input placeholder="End date" id="wf-live-traffic-to" type="text"
																   class="wf-datetime"
																   data-bind="value: endDate, datetimepicker: null, datepickerOptions: { timeFormat: 'hh:mm tt z' }">
														</td>
														<td>
															<button data-bind="click: endDate('')" class="wf-btn wf-btn-default wf-btn-sm"
																	type="button">
																Clear
															</button>
														</td>
													</tr>
													<tr>
														<td>
															<label for="wf-live-traffic-group-by">Group&nbsp;By:&nbsp;</label>
														</td>
														<td>
															<select id="wf-live-traffic-group-by" name="groupby"
																	class="wf-lt-advanced-filters-groupby"
																	data-bind="options: filterGroupByOptions,
																	optionsText: filterGroupByOptionsText, value: groupBy, optionsCaption: 'None'"></select>
														</td>
													</tr>
													</tbody>
												</table>
											</td>
										</tr>
									</table>
								</div>
							</form>
				
							<table data-bind="if: groupBy()" border="0" style="width: 100%">
								<tbody data-bind="foreach: listings">
								<tr>
									<td>
										<div data-bind="if: loc()">
											<img data-bind="attr: { src: '<?php echo wfUtils::getBaseURL() . 'images/flags/'; ?>' + loc().countryCode.toLowerCase() + '.png',
														alt: loc().countryName, title: loc().countryName }" width="16" height="11"
												 class="wfFlag"/>
											<a data-bind="text: (loc().city ? loc().city + ', ' : '') + loc().countryName,
														attr: { href: 'http://maps.google.com/maps?q=' + loc().lat + ',' + loc().lon + '&z=6' }"
											   target="_blank"></a>
										</div>
										<div data-bind="if: !loc()">
											An unknown location at IP <a
												data-bind="text: IP, attr: { href: WFAD.makeIPTrafLink(IP()) }" target="_blank"></a>
										</div>
			
										<div>
											<strong>IP:</strong>&nbsp;<a
												data-bind="text: IP, attr: { href: WFAD.makeIPTrafLink(IP()) }" target="_blank"></a>
											<span data-bind="if: blocked()">
												[<a data-bind="click: $root.unblockIP">unblock</a>]
											</span>
											<span data-bind="if: rangeBlocked()">
												[<a data-bind="click: $root.unblockNetwork">unblock this range</a>]
											</span>
											<span data-bind="if: !blocked() && !rangeBlocked()">
												[<a data-bind="click: $root.blockIP">block</a>]
											</span>
										</div>
										<div>
											&nbsp;<span class="wfReverseLookup"><span data-bind="text: IP"
																					  style="display:none;"></span></span>
										</div>
										<div>
											<span
												data-bind="attr: { 'data-timestamp': ctime, text: 'Last hit was ' + ctime() + ' ago.' }"
												class="wfTimeAgo wfTimeAgo-timestamp"></span>
										</div>
									</td>
									<td style="font-size: 28px; color: #999;">
										<span data-bind="text: hitCount"></span> hits
									</td>
								</tr>
								</tbody>
							</table>
				
							<div data-bind="if: !groupBy()">
								<div id="wf-lt-listings" data-bind="foreach: listings">
									<div data-bind="attr: { id: ('wfActEvent_' + id()), 'class': cssClasses }">
										<table border="0" cellpadding="1" cellspacing="0">
											<tr>
												<td>
													<span data-bind="if: action() != 'loginOK' && user()">
														<span data-bind="html: user.avatar" class="wfAvatar"></span>
														<a data-bind="attr: { href: user.editLink }, text: user().display_name"
														   target="_blank"></a>
													</span>
													<span data-bind="if: loc()">
														<span data-bind="if: action() != 'loginOK' && user()"> in</span>
														<img data-bind="attr: { src: '<?php echo wfUtils::getBaseURL() . 'images/flags/'; ?>' + loc().countryCode.toLowerCase() + '.png',
															alt: loc().countryName, title: loc().countryName }" width="16"
															 height="11"
															 class="wfFlag"/>
														<a data-bind="text: (loc().city ? loc().city + ', ' : '') + loc().countryName,
															attr: { href: 'http://maps.google.com/maps?q=' + loc().lat + ',' + loc().lon + '&z=6' }"
														   target="_blank"></a>
													</span>
													<span data-bind="if: !loc()">
														<span
															data-bind="text: action() != 'loginOK' && user() ? 'at an' : 'An'"></span> unknown location at IP <a
															data-bind="text: IP, attr: { href: WFAD.makeIPTrafLink(IP()) }"
															target="_blank"></a>
													</span>
													<span data-bind="if: referer()">
														<span data-bind="if: extReferer()">
															arrived from <a data-bind="text: referer, attr: { href: referer }"
																			target="_blank"
																			style="color: #A00; font-weight: bold;"></a> and
														</span>
														<span data-bind="if: !extReferer()">
															left <a data-bind="text: referer, attr: { href: referer }"
																	target="_blank"
																	style="color: #999; font-weight: normal;"></a> and
														</span>
													</span>
													<span data-bind="if: statusCode() == 404">
														tried to access <span style="color: #F00;">non-existent page</span>
													</span>
			
													<span data-bind="if: statusCode() == 200 && !action()">
														visited
													</span>
													<span data-bind="if: statusCode() == 403 || statusCode() == 503">
														was <span data-bind="text: firewallAction" style="color: #F00;"></span> at
													</span>
			
													<span data-bind="if: action() == 'loginOK'">
														logged in successfully as "<strong data-bind="text: username"></strong>".
													</span>
													<span data-bind="if: action() == 'logout'">
														logged out successfully.
													</span>
													<span data-bind="if: action() == 'lostPassword'">
														requested a password reset.
													</span>
													<span data-bind="if: action() == 'loginFailValidUsername'">
														attempted a failed login as "<strong data-bind="text: username"></strong>".
													</span>
													<span data-bind="if: action() == 'loginFailInvalidUsername'">
														attempted a failed login using an invalid username "<strong
															data-bind="text: username"></strong>".
													</span>
													<span data-bind="if: action() == 'user:passwordReset'">
														changed their password.
													</span>
													<a class="wf-lt-url"
													   data-bind="text: displayURL, attr: { href: URL, title: URL }"
													   target="_blank"></a>
												</td>
											</tr>
											<tr>
												<td><span data-bind="text: timeAgo, attr: { 'data-timestamp': ctime }"
														  class="wfTimeAgo wfTimeAgo-timestamp"></span>&nbsp;&nbsp;
													<strong>IP:</strong> <a
														data-bind="attr: { href: WFAD.makeIPTrafLink(IP()) }, text: IP"
														target="_blank"></a>
													<span data-bind="if: blocked()">
														[<a data-bind="click: $root.unblockIP">unblock</a>]
													</span>
													<span data-bind="if: rangeBlocked()">
														[<a data-bind="click: $root.unblockNetwork">unblock this range</a>]
													</span>
													<span data-bind="if: !blocked() && !rangeBlocked()">
														[<a data-bind="click: $root.blockIP">block</a>]
													</span>
													&nbsp;
													<span class="wfReverseLookup">
														<span data-bind="text: IP"
															  style="display:none;"></span>
													</span>
												</td>
											</tr>
			
											<tr data-bind="if: browser() && browser().browser != 'Default Browser'">
												<td>
													<strong>Browser:</strong>
													<span data-bind="text: browser().browser +
														(browser().version ? ' version ' + browser().version : '') +
														(browser().platform  && browser().platform != 'unknown' ? ' running on ' + browser().platform : '')
														">
													</span>
												</td>
											</tr>
											<tr>
												<td data-bind="text: UA" style="color: #AAA;"></td>
											</tr>
											<tr>
												<td>
													<span data-bind="if: blocked()">
														<a href="#" class="wf-btn wf-btn-default wf-btn-sm"
																data-bind="click: $root.unblockIP">
															Unblock this IP
														</a>
													</span>
													<span data-bind="if: rangeBlocked()">
														<a href="#" class="wf-btn wf-btn-default wf-btn-sm"
																data-bind="click: $root.unblockNetwork">Unblock this range
														</a>
													</span>
													<span data-bind="if: !blocked() && !rangeBlocked()">
														<a href="#" class="wf-btn wf-btn-default wf-btn-sm"
																data-bind="click: $root.blockIP">
															Block this IP
														</a>
													</span>
													<a class="wf-btn wf-btn-default wf-btn-sm"
															data-bind="attr: { href: 'admin.php?page=WordfenceTools&whoisval=' + IP() + '&wfnetworkblock=1#top#whois'}">
														Block this network
													</a>
													<a class="wf-btn wf-btn-default wf-btn-sm" data-bind="text: 'Run WHOIS on ' + IP(),
														attr: { href: 'admin.php?page=WordfenceTools&whoisval=' + IP() + '#top#whois' }"
															target="_blank"></a>
													<a class="wf-btn wf-btn-default wf-btn-sm"
															data-bind="attr: { href: WFAD.makeIPTrafLink(IP()) }" target="_blank">
														See recent traffic
													</a>
													<span data-bind="if: action() == 'blocked:waf'">
														<a href="#" class="wf-btn wf-btn-default wf-btn-sm"
																data-bind="click: function () { $root.whitelistWAFParamKey(actionData().path, actionData().paramKey, actionData().failedRules) }"
																title="If this is a false positive, you can exclude this parameter from being filtered by the firewall">
															Whitelist param from Firewall
														</a>
														<?php if (WFWAF_DEBUG): ?>
															<a href="#" class="wf-btn wf-btn-default wf-btn-sm"
																	data-bind="attr: { href: '<?php echo esc_js(home_url()) ?>?_wfsf=debugWAF&nonce=' + WFAD.nonce + '&hitid=' + id() }" target="_blank">
																Debug this Request
															</a>
														<?php endif ?>
													</span>
												</td>
											</tr>
										</table>
									</div>
								</div>
							</div>
							<div data-bind="if: !listings">
								No events to report yet.
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script type="text/x-jquery-template" id="wfWelcomeContent3">
	<div>
		<h3>Welcome to ALL Your Site Visits, Live!</h3>
		<strong><p>Traffic you've never seen before</p></strong>

		<p>
			Google Analytics and other Javascript analytics packages can't show you crawlers, RSS feed readers, hack
			attempts and other non-human traffic that hits your site.
			Wordfence runs on your server and shows you, in real-time, all the traffic that is hitting your server right
			now, including those non-human crawlers, feed readers and hackers that Analytics can't track.
		</p>
		<strong><p>Separated into the important categories</p></strong>

		<p>
			You'll notice that you can filter traffic. The options include "All Hits" to simply view everything that is
			hitting your server right now. We then sub-divide that into human visits, your site members, crawlers -
			which we further break down into Google crawlers - and various other choices.
		</p>

		<p>
			<strong>How to use this page when your site is being attacked</strong>
		</p>

		<p>
			Start by looking at "All Hits" because you may notice that a single IP address is generating most of your
			traffic.
			This could be a denial of service attack, someone stealing your content or a hacker probing for weaknesses.
			If you see a suspicious pattern, simply block that IP address. If they attack from a different IP on the
			same network, simply block that network.
			You can also run a WHOIS on any IP address to find the host and report abuse via email.
		</p>

		<p>
			If you don't see any clear patterns of attack, take a look at "Pages Not Found" which will show you IP
			addresses that are generating excessive page not found errors. It's common for an attacker probing for
			weaknesses to generate a lot of these errors. If you see one IP address that is generating many of these
			requests, and it's not Google or another trusted crawler, then you should consider blocking them.
		</p>

		<p>
			Next look at "Logins and Logouts". If you see a large number of failed logins from an IP address, block them
			if you don't recognize who they are.
		</p>

	</div>
</script>