Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../js
File: admin.liveTraffic.1722265817.js
(function($) {
[0] Fix | Delete
var __ = window.wfi18n.__;
[1] Fix | Delete
var sprintf = window.wfi18n.sprintf;
[2] Fix | Delete
[3] Fix | Delete
var LISTING_LIMIT = 50;
[4] Fix | Delete
[5] Fix | Delete
LiveTrafficViewModel = function(listings, filters) {
[6] Fix | Delete
var self = this;
[7] Fix | Delete
var listingIDTable = {};
[8] Fix | Delete
self.listings = ko.observableArray(listings);
[9] Fix | Delete
self.listings.subscribe(function(items) {
[10] Fix | Delete
listingIDTable = {};
[11] Fix | Delete
for (var i = 0; i < items.length; i++) {
[12] Fix | Delete
listingIDTable[items[i].id()] = 1;
[13] Fix | Delete
}
[14] Fix | Delete
//console.log(items);
[15] Fix | Delete
});
[16] Fix | Delete
self.hasListing = function(id) {
[17] Fix | Delete
return id in listingIDTable;
[18] Fix | Delete
};
[19] Fix | Delete
self.filters = ko.observableArray(filters);
[20] Fix | Delete
[21] Fix | Delete
var urlGroupBy = new GroupByModel('url', __('URL'));
[22] Fix | Delete
var groupBys = [
[23] Fix | Delete
new GroupByModel('type', __('Type')),
[24] Fix | Delete
new GroupByModel('user_login', __('Username')),
[25] Fix | Delete
new GroupByModel('statusCode', __('HTTP Response Code')),
[26] Fix | Delete
new GroupByModel('action', __('Firewall Response'), 'enum', ['ok', 'throttled', 'lockedOut', 'blocked', 'blocked:waf']),
[27] Fix | Delete
new GroupByModel('ip', __('IP')),
[28] Fix | Delete
urlGroupBy
[29] Fix | Delete
];
[30] Fix | Delete
[31] Fix | Delete
self.presetFiltersOptions = ko.observableArray([
[32] Fix | Delete
new PresetFilterModel(__('All Hits'), "all", []),
[33] Fix | Delete
new PresetFilterModel(__('Humans'), "humans", [new ListingsFilterModel(self, 'type', 'human')]),
[34] Fix | Delete
new PresetFilterModel(__('Registered Users'), "users", [new ListingsFilterModel(self, 'userID', '0', '!=')]),
[35] Fix | Delete
new PresetFilterModel(__('Crawlers'), "crawlers", [new ListingsFilterModel(self, 'type', 'bot')]),
[36] Fix | Delete
new PresetFilterModel(__('Google Crawlers'), "google", [new ListingsFilterModel(self, 'isGoogle', '1')]),
[37] Fix | Delete
new PresetFilterModel(__('Pages Not Found'), "404s", [new ListingsFilterModel(self, 'statusCode', '404')]),
[38] Fix | Delete
new PresetFilterModel(__('Logins and Logouts'), "logins", [
[39] Fix | Delete
new ListingsFilterModel(self, 'action', 'login', 'contains'),
[40] Fix | Delete
new ListingsFilterModel(self, 'action', 'logout', 'contains')
[41] Fix | Delete
]),
[42] Fix | Delete
//new PresetFilterModel('Top Consumers', "top_consumers", [new ListingsFilterModel(self, 'statusCode', '200')], urlGroupBy),
[43] Fix | Delete
//new PresetFilterModel('Top 404s', "top_404s", [new ListingsFilterModel(self, 'statusCode', '404')], urlGroupBy),
[44] Fix | Delete
new PresetFilterModel(__('Locked Out'), "lockedOut", [new ListingsFilterModel(self, 'action', 'lockedOut')]),
[45] Fix | Delete
new PresetFilterModel(__('Blocked'), "blocked", [new ListingsFilterModel(self, 'action', 'blocked', 'contains')]),
[46] Fix | Delete
new PresetFilterModel(__('Blocked By Firewall'), "blocked:waf", [new ListingsFilterModel(self, 'action', 'blocked:waf')])
[47] Fix | Delete
]);
[48] Fix | Delete
[49] Fix | Delete
self.showAdvancedFilters = ko.observable(false);
[50] Fix | Delete
self.showAdvancedFilters.subscribe(function(val) {
[51] Fix | Delete
if (val && self.filters().length == 0) {
[52] Fix | Delete
self.addFilter();
[53] Fix | Delete
}
[54] Fix | Delete
});
[55] Fix | Delete
[56] Fix | Delete
self.presetFiltersOptionsText = function(item) {
[57] Fix | Delete
return item.text();
[58] Fix | Delete
};
[59] Fix | Delete
[60] Fix | Delete
self.selectedPresetFilter = ko.observable();
[61] Fix | Delete
self.selectedPresetFilter.subscribe(function(item) {
[62] Fix | Delete
var clonedFilters = ko.toJS(item.filters());
[63] Fix | Delete
var newFilters = [];
[64] Fix | Delete
for (var i = 0; i < clonedFilters.length; i++) {
[65] Fix | Delete
newFilters.push(new ListingsFilterModel(self, clonedFilters[i].param, clonedFilters[i].value, clonedFilters[i].operator));
[66] Fix | Delete
}
[67] Fix | Delete
self.filters(newFilters);
[68] Fix | Delete
self.groupBy(item.groupBy());
[69] Fix | Delete
});
[70] Fix | Delete
[71] Fix | Delete
self.filters.subscribe(function() {
[72] Fix | Delete
self.checkQueryAndReloadListings();
[73] Fix | Delete
});
[74] Fix | Delete
[75] Fix | Delete
self.addFilter = function() {
[76] Fix | Delete
self.filters.push(new ListingsFilterModel(self));
[77] Fix | Delete
};
[78] Fix | Delete
[79] Fix | Delete
self.removeFilter = function(item) {
[80] Fix | Delete
self.filters.remove(item);
[81] Fix | Delete
};
[82] Fix | Delete
[83] Fix | Delete
var currentFilterQuery = '';
[84] Fix | Delete
var getURLEncodedFilters = function() {
[85] Fix | Delete
var dataString = '';
[86] Fix | Delete
ko.utils.arrayForEach(self.filters(), function(filter) {
[87] Fix | Delete
if (filter.getValue() !== false) {
[88] Fix | Delete
dataString += filter.urlEncoded() + '&';
[89] Fix | Delete
}
[90] Fix | Delete
});
[91] Fix | Delete
var groupBy = self.groupBy();
[92] Fix | Delete
if (groupBy) {
[93] Fix | Delete
dataString += 'groupby=' + encodeURIComponent(groupBy.param()) + '&';
[94] Fix | Delete
}
[95] Fix | Delete
var startDate = self.startDate();
[96] Fix | Delete
if (startDate) {
[97] Fix | Delete
dataString += 'startDate=' + encodeURIComponent(startDate) + '&';
[98] Fix | Delete
}
[99] Fix | Delete
var endDate = self.endDate();
[100] Fix | Delete
if (endDate) {
[101] Fix | Delete
dataString += 'endDate=' + encodeURIComponent(endDate) + '&';
[102] Fix | Delete
}
[103] Fix | Delete
if (dataString.length > 1) {
[104] Fix | Delete
return dataString.substring(0, dataString.length - 1);
[105] Fix | Delete
}
[106] Fix | Delete
return '';
[107] Fix | Delete
};
[108] Fix | Delete
[109] Fix | Delete
self.filterGroupByOptions = ko.observableArray(groupBys);
[110] Fix | Delete
[111] Fix | Delete
self.filterGroupByOptionsText = function(item) {
[112] Fix | Delete
return item.text() || item.param();
[113] Fix | Delete
};
[114] Fix | Delete
[115] Fix | Delete
self.groupBy = ko.observable();
[116] Fix | Delete
self.groupBy.subscribe(function() {
[117] Fix | Delete
self.checkQueryAndReloadListings();
[118] Fix | Delete
});
[119] Fix | Delete
[120] Fix | Delete
self.startDate = ko.observable();
[121] Fix | Delete
self.startDate.subscribe(function() {
[122] Fix | Delete
// console.log('start date change ' + self.startDate());
[123] Fix | Delete
self.checkQueryAndReloadListings();
[124] Fix | Delete
});
[125] Fix | Delete
[126] Fix | Delete
self.endDate = ko.observable();
[127] Fix | Delete
self.endDate.subscribe(function() {
[128] Fix | Delete
// console.log('end date change ' + self.endDate());
[129] Fix | Delete
self.checkQueryAndReloadListings();
[130] Fix | Delete
});
[131] Fix | Delete
[132] Fix | Delete
/**
[133] Fix | Delete
* Pulls down fresh traffic data and resets the list.
[134] Fix | Delete
*
[135] Fix | Delete
* @param options
[136] Fix | Delete
*/
[137] Fix | Delete
self.checkQueryAndReloadListings = function(options) {
[138] Fix | Delete
if (currentFilterQuery !== getURLEncodedFilters()) {
[139] Fix | Delete
self.reloadListings(options);
[140] Fix | Delete
}
[141] Fix | Delete
};
[142] Fix | Delete
self.reloadListings = function(options) {
[143] Fix | Delete
pullDownListings(options, function(listings) {
[144] Fix | Delete
var groupByKO = self.groupBy();
[145] Fix | Delete
var groupBy = '';
[146] Fix | Delete
if (groupByKO) {
[147] Fix | Delete
groupBy = groupByKO.param();
[148] Fix | Delete
WFAD.mode = 'liveTraffic_paused';
[149] Fix | Delete
}
[150] Fix | Delete
else {
[151] Fix | Delete
WFAD.mode = 'liveTraffic';
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
var newListings = [];
[155] Fix | Delete
for (var i = 0; i < listings.length; i++) {
[156] Fix | Delete
newListings.push(new ListingModel(listings[i], groupBy));
[157] Fix | Delete
}
[158] Fix | Delete
self.listings(newListings);
[159] Fix | Delete
})
[160] Fix | Delete
};
[161] Fix | Delete
[162] Fix | Delete
/**
[163] Fix | Delete
* Used in the infinite scroll
[164] Fix | Delete
*/
[165] Fix | Delete
self.loadNextListings = function(callback) {
[166] Fix | Delete
var lastTimestamp = self.filters[0];
[167] Fix | Delete
pullDownListings({
[168] Fix | Delete
since: lastTimestamp,
[169] Fix | Delete
limit: LISTING_LIMIT,
[170] Fix | Delete
offset: self.listings().length
[171] Fix | Delete
}, function() {
[172] Fix | Delete
self.appendListings.apply(this, arguments);
[173] Fix | Delete
typeof callback === 'function' && callback.apply(this, arguments);
[174] Fix | Delete
});
[175] Fix | Delete
};
[176] Fix | Delete
[177] Fix | Delete
self.getCurrentQueryString = function(options) {
[178] Fix | Delete
var queryOptions = {
[179] Fix | Delete
since: null,
[180] Fix | Delete
limit: LISTING_LIMIT,
[181] Fix | Delete
offset: 0
[182] Fix | Delete
};
[183] Fix | Delete
for (var prop in queryOptions) {
[184] Fix | Delete
if (queryOptions.hasOwnProperty(prop) && options && prop in options) {
[185] Fix | Delete
queryOptions[prop] = options[prop];
[186] Fix | Delete
}
[187] Fix | Delete
}
[188] Fix | Delete
currentFilterQuery = getURLEncodedFilters();
[189] Fix | Delete
var data = currentFilterQuery;
[190] Fix | Delete
for (prop in queryOptions) {
[191] Fix | Delete
if (queryOptions.hasOwnProperty(prop)) {
[192] Fix | Delete
var val = queryOptions[prop];
[193] Fix | Delete
if (val === null || val === undefined) {
[194] Fix | Delete
val = '';
[195] Fix | Delete
}
[196] Fix | Delete
data += '&' + encodeURIComponent(prop) + '=' + encodeURIComponent(val);
[197] Fix | Delete
}
[198] Fix | Delete
}
[199] Fix | Delete
return data;
[200] Fix | Delete
};
[201] Fix | Delete
[202] Fix | Delete
var pullDownListings = function(options, callback) {
[203] Fix | Delete
var data = self.getCurrentQueryString(options);
[204] Fix | Delete
[205] Fix | Delete
WFAD.ajax('wordfence_loadLiveTraffic', data, function(response) {
[206] Fix | Delete
if (!response || !response.success) {
[207] Fix | Delete
return;
[208] Fix | Delete
}
[209] Fix | Delete
callback && callback(response.data, response);
[210] Fix | Delete
self.sql(response.sql);
[211] Fix | Delete
});
[212] Fix | Delete
};
[213] Fix | Delete
[214] Fix | Delete
self.prependListings = function(listings, response) {
[215] Fix | Delete
for (var i = listings.length - 1; i >= 0; i--) {
[216] Fix | Delete
// Prevent duplicates
[217] Fix | Delete
if (self.hasListing(listings[i].id)) {
[218] Fix | Delete
continue;
[219] Fix | Delete
}
[220] Fix | Delete
var listing = new ListingModel(listings[i]);
[221] Fix | Delete
listing.highlighted(true);
[222] Fix | Delete
self.listings.unshift(listing);
[223] Fix | Delete
}
[224] Fix | Delete
[225] Fix | Delete
//self.listings.sort(function(a, b) {
[226] Fix | Delete
// if (a.ctime() < b.ctime()) {
[227] Fix | Delete
// return 1;
[228] Fix | Delete
// } else if (a.ctime() > b.ctime()) {
[229] Fix | Delete
// return -1;
[230] Fix | Delete
// }
[231] Fix | Delete
// return 0;
[232] Fix | Delete
//});
[233] Fix | Delete
};
[234] Fix | Delete
[235] Fix | Delete
self.appendListings = function(listings, response) {
[236] Fix | Delete
var highlight = 3;
[237] Fix | Delete
for (var i = 0; i < listings.length; i++) {
[238] Fix | Delete
// Prevent duplicates
[239] Fix | Delete
if (self.hasListing(listings[i].id)) {
[240] Fix | Delete
continue;
[241] Fix | Delete
}
[242] Fix | Delete
var listing = new ListingModel(listings[i]);
[243] Fix | Delete
listing.highlighted(highlight-- > 0);
[244] Fix | Delete
self.listings.push(listing);
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
//self.listings.sort(function(a, b) {
[248] Fix | Delete
// if (a.ctime() < b.ctime()) {
[249] Fix | Delete
// return 1;
[250] Fix | Delete
// } else if (a.ctime() > b.ctime()) {
[251] Fix | Delete
// return -1;
[252] Fix | Delete
// }
[253] Fix | Delete
// return 0;
[254] Fix | Delete
//});
[255] Fix | Delete
};
[256] Fix | Delete
[257] Fix | Delete
self.whitelistWAFParamKey = function(path, paramKey, failedRules) {
[258] Fix | Delete
WFAD.ajax('wordfence_whitelistWAFParamKey', {
[259] Fix | Delete
path: path,
[260] Fix | Delete
paramKey: paramKey,
[261] Fix | Delete
failedRules: failedRules
[262] Fix | Delete
}, function(response) {
[263] Fix | Delete
[264] Fix | Delete
});
[265] Fix | Delete
};
[266] Fix | Delete
[267] Fix | Delete
self.trimIP = function(ip) {
[268] Fix | Delete
if (ip && ip.length > 16) {
[269] Fix | Delete
return ip.substring(0, 16) + "\u2026";
[270] Fix | Delete
}
[271] Fix | Delete
return ip;
[272] Fix | Delete
};
[273] Fix | Delete
[274] Fix | Delete
$(window).on('wf-live-traffic-ip-blocked', function(e, ip) {
[275] Fix | Delete
ko.utils.arrayForEach(self.listings(), function(listing) {
[276] Fix | Delete
if (listing.IP() === ip) {
[277] Fix | Delete
listing.blocked(true);
[278] Fix | Delete
}
[279] Fix | Delete
});
[280] Fix | Delete
}).on('wf-live-traffic-ip-unblocked', function(e, ip) {
[281] Fix | Delete
ko.utils.arrayForEach(self.listings(), function(listing) {
[282] Fix | Delete
if (listing.IP() === ip) {
[283] Fix | Delete
listing.blocked(false);
[284] Fix | Delete
}
[285] Fix | Delete
});
[286] Fix | Delete
});
[287] Fix | Delete
[288] Fix | Delete
// For debuggering-a-ding
[289] Fix | Delete
self.sql = ko.observable('');
[290] Fix | Delete
};
[291] Fix | Delete
[292] Fix | Delete
LiveTrafficViewModel.truncateText = function(text, maxLength) {
[293] Fix | Delete
maxLength = maxLength || 100;
[294] Fix | Delete
if (text && text.length > maxLength) {
[295] Fix | Delete
return text.substring(0, Math.round(maxLength)) + "\u2026";
[296] Fix | Delete
// return text.substring(0, Math.round(maxLength / 2)) + " ... " + text.substring(text.length - Math.round(maxLength / 2));
[297] Fix | Delete
}
[298] Fix | Delete
return text;
[299] Fix | Delete
};
[300] Fix | Delete
[301] Fix | Delete
var ListingModel = function(data, groupBy) {
[302] Fix | Delete
var self = this;
[303] Fix | Delete
[304] Fix | Delete
self.id = ko.observable(0);
[305] Fix | Delete
self.ctime = ko.observable(0);
[306] Fix | Delete
self.IP = ko.observable('');
[307] Fix | Delete
self.jsRun = ko.observable(0);
[308] Fix | Delete
self.statusCode = ko.observable(200);
[309] Fix | Delete
self.isGoogle = ko.observable(0);
[310] Fix | Delete
self.userID = ko.observable(0);
[311] Fix | Delete
self.URL = ko.observable('');
[312] Fix | Delete
self.referer = ko.observable('');
[313] Fix | Delete
self.UA = ko.observable('');
[314] Fix | Delete
self.loc = ko.observable();
[315] Fix | Delete
self.type = ko.observable('');
[316] Fix | Delete
self.blocked = ko.observable(false);
[317] Fix | Delete
self.rangeBlocked = ko.observable(false);
[318] Fix | Delete
self.ipRangeID = ko.observable(-1);
[319] Fix | Delete
self.extReferer = ko.observable();
[320] Fix | Delete
self.browser = ko.observable();
[321] Fix | Delete
self.user = ko.observable();
[322] Fix | Delete
self.hitCount = ko.observable();
[323] Fix | Delete
self.username = ko.observable('');
[324] Fix | Delete
[325] Fix | Delete
// New fields/columns
[326] Fix | Delete
self.action = ko.observable('');
[327] Fix | Delete
self.actionDescription = ko.observable(false);
[328] Fix | Delete
self.actionData = ko.observable();
[329] Fix | Delete
[330] Fix | Delete
self.highlighted = ko.observable(false);
[331] Fix | Delete
self.showDetails = ko.observable(false);
[332] Fix | Delete
self.toggleDetails = function() {
[333] Fix | Delete
self.showDetails(!self.showDetails());
[334] Fix | Delete
};
[335] Fix | Delete
//self.highlighted.subscribe(function(val) {
[336] Fix | Delete
// if (val) {
[337] Fix | Delete
// _classes += ' highlighted';
[338] Fix | Delete
// self.cssClasses(_classes);
[339] Fix | Delete
// } else {
[340] Fix | Delete
// _classes.replace(/ highlighted(\s*|$)/, ' ');
[341] Fix | Delete
// self.cssClasses(_classes);
[342] Fix | Delete
// }
[343] Fix | Delete
//});
[344] Fix | Delete
[345] Fix | Delete
for (var prop in data) {
[346] Fix | Delete
if (data.hasOwnProperty(prop)) {
[347] Fix | Delete
if (prop === 'blocked' || prop === 'rangeBlocked') {
[348] Fix | Delete
data[prop] = !!data[prop];
[349] Fix | Delete
}
[350] Fix | Delete
self[prop] !== undefined && self[prop](data[prop]);
[351] Fix | Delete
}
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
if (data['lastHit'] !== undefined) {
[355] Fix | Delete
self['ctime'](data['lastHit']);
[356] Fix | Delete
}
[357] Fix | Delete
[358] Fix | Delete
self.timestamp = ko.pureComputed(function() {
[359] Fix | Delete
var date = new Date(self.ctime() * 1000);
[360] Fix | Delete
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
[361] Fix | Delete
}, self);
[362] Fix | Delete
[363] Fix | Delete
// Use the same format as these update.
[364] Fix | Delete
self.timeAgo = ko.pureComputed(function() {
[365] Fix | Delete
var serverTime = WFAD.serverMicrotime;
[366] Fix | Delete
return $(WFAD.showTimestamp(this.ctime(), serverTime)).text();
[367] Fix | Delete
}, self);
[368] Fix | Delete
[369] Fix | Delete
self.displayURL = ko.pureComputed(function() {
[370] Fix | Delete
return LiveTrafficViewModel.truncateText(self.URL(), 105);
[371] Fix | Delete
});
[372] Fix | Delete
[373] Fix | Delete
self.displayURLShort = ko.pureComputed(function() {
[374] Fix | Delete
var a = document.createElement('a');
[375] Fix | Delete
if (!self.URL()) {
[376] Fix | Delete
return '';
[377] Fix | Delete
}
[378] Fix | Delete
a.href = self.URL();
[379] Fix | Delete
if (a.host !== location.host) {
[380] Fix | Delete
return LiveTrafficViewModel.truncateText(self.URL(), 30);
[381] Fix | Delete
}
[382] Fix | Delete
var url = a.pathname + (typeof a.search === 'string' ? a.search : '');
[383] Fix | Delete
return LiveTrafficViewModel.truncateText(url, 30);
[384] Fix | Delete
});
[385] Fix | Delete
[386] Fix | Delete
self.firewallAction = ko.pureComputed(function() {
[387] Fix | Delete
//Grouped by firewall action listing
[388] Fix | Delete
if (groupBy == 'action') {
[389] Fix | Delete
switch (self.action()) {
[390] Fix | Delete
case 'lockedOut':
[391] Fix | Delete
return __('Locked out from logging in');
[392] Fix | Delete
case 'blocked:waf-always':
[393] Fix | Delete
return __('Blocked by the Wordfence Application Firewall and plugin settings');
[394] Fix | Delete
case 'blocked:wordfence':
[395] Fix | Delete
return __('Blocked by Wordfence plugin settings');
[396] Fix | Delete
case 'blocked:wfsnrepeat':
[397] Fix | Delete
case 'blocked:wfsn':
[398] Fix | Delete
return __('Blocked by the Wordfence Security Network');
[399] Fix | Delete
case 'blocked:waf':
[400] Fix | Delete
return __('Blocked by the Wordfence Web Application Firewall');
[401] Fix | Delete
case 'cbl:redirect':
[402] Fix | Delete
return __('Redirected by Country Blocking bypass URL');
[403] Fix | Delete
default:
[404] Fix | Delete
return __('Blocked by Wordfence');
[405] Fix | Delete
}
[406] Fix | Delete
}
[407] Fix | Delete
[408] Fix | Delete
//Standard listing
[409] Fix | Delete
var desc = '';
[410] Fix | Delete
switch (self.action()) {
[411] Fix | Delete
case 'lockedOut':
[412] Fix | Delete
return __('locked out from logging in');
[413] Fix | Delete
[414] Fix | Delete
case 'blocked:waf-always':
[415] Fix | Delete
case 'blocked:wordfence':
[416] Fix | Delete
case 'blocked:wfsnrepeat':
[417] Fix | Delete
desc = self.actionDescription();
[418] Fix | Delete
if (desc && desc.toLowerCase().indexOf('block') === 0) {
[419] Fix | Delete
return 'b' + desc.substring(1);
[420] Fix | Delete
}
[421] Fix | Delete
return sprintf(__('blocked for %s'), desc);
[422] Fix | Delete
[423] Fix | Delete
case 'blocked:wfsn':
[424] Fix | Delete
return __('blocked by the Wordfence Security Network');
[425] Fix | Delete
[426] Fix | Delete
case 'blocked:waf':
[427] Fix | Delete
var data = self.actionData();
[428] Fix | Delete
if (typeof data === 'object') {
[429] Fix | Delete
var paramKey = data.paramKey ? WFAD.base64_decode(data.paramKey) : null;
[430] Fix | Delete
var paramValue = data.paramKey ? WFAD.base64_decode(data.paramValue) : null;
[431] Fix | Delete
// var category = data.category;
[432] Fix | Delete
[433] Fix | Delete
var matches = paramKey !== null && paramKey.match(/([a-z0-9_]+\.[a-z0-9_]+)(?:\[(.+?)\](.*))?/i);
[434] Fix | Delete
desc = self.actionDescription();
[435] Fix | Delete
if (matches) {
[436] Fix | Delete
switch (matches[1]) {
[437] Fix | Delete
case 'request.queryString':
[438] Fix | Delete
desc = sprintf(__('%s in query string: %s'), self.actionDescription(), matches[2] + '=' + LiveTrafficViewModel.truncateText(encodeURIComponent(paramValue)));
[439] Fix | Delete
break;
[440] Fix | Delete
case 'request.body':
[441] Fix | Delete
desc = sprintf(__('%s in POST body: %s'), self.actionDescription(), matches[2] + '=' + LiveTrafficViewModel.truncateText(encodeURIComponent(paramValue)));
[442] Fix | Delete
break;
[443] Fix | Delete
case 'request.cookie':
[444] Fix | Delete
desc = sprintf(__('%s in cookie: %s'), self.actionDescription(), matches[2] + '=' + LiveTrafficViewModel.truncateText(encodeURIComponent(paramValue)));
[445] Fix | Delete
break;
[446] Fix | Delete
case 'request.fileNames':
[447] Fix | Delete
desc = sprintf(__('%s in file: %s'), self.actionDescription(), matches[2] + '=' + LiveTrafficViewModel.truncateText(encodeURIComponent(paramValue)));
[448] Fix | Delete
break;
[449] Fix | Delete
}
[450] Fix | Delete
}
[451] Fix | Delete
if (desc) {
[452] Fix | Delete
return sprintf(__('blocked by firewall for %s'), desc);
[453] Fix | Delete
}
[454] Fix | Delete
if (data.failedRules == 'blocked') {
[455] Fix | Delete
return __('blocked by real-time IP blocklist');
[456] Fix | Delete
}
[457] Fix | Delete
return __('blocked by firewall');
[458] Fix | Delete
}
[459] Fix | Delete
return sprintf(__('blocked by firewall for %s'), self.actionDescription());
[460] Fix | Delete
case 'cbl:redirect':
[461] Fix | Delete
desc = self.actionDescription();
[462] Fix | Delete
return desc;
[463] Fix | Delete
}
[464] Fix | Delete
return desc;
[465] Fix | Delete
});
[466] Fix | Delete
[467] Fix | Delete
self.cssClasses = ko.pureComputed(function() {
[468] Fix | Delete
var classes = 'wf-live-traffic-hit-type';
[469] Fix | Delete
if (self.statusCode() == 403 || self.statusCode() == 503) {
[470] Fix | Delete
classes += ' wfActionBlocked';
[471] Fix | Delete
}
[472] Fix | Delete
if (self.statusCode() == 404) {
[473] Fix | Delete
classes += ' wf404';
[474] Fix | Delete
}
[475] Fix | Delete
if (self.jsRun() == 1) {
[476] Fix | Delete
classes += ' wfHuman';
[477] Fix | Delete
}
[478] Fix | Delete
if (self.actionData() && self.actionData().learningMode) {
[479] Fix | Delete
classes += ' wfWAFLearningMode';
[480] Fix | Delete
}
[481] Fix | Delete
if (self.action() == 'loginFailValidUsername' || self.action() == 'loginFailInvalidUsername') {
[482] Fix | Delete
classes += ' wfFailedLogin';
[483] Fix | Delete
}
[484] Fix | Delete
// if (self.highlighted()) {
[485] Fix | Delete
// classes += ' highlighted';
[486] Fix | Delete
// }
[487] Fix | Delete
return classes;
[488] Fix | Delete
});
[489] Fix | Delete
[490] Fix | Delete
self.typeIconClass = ko.pureComputed(function() {
[491] Fix | Delete
var classes = 'wf-live-traffic-type-icon';
[492] Fix | Delete
if (self.statusCode() == 403 || self.statusCode() == 503) {
[493] Fix | Delete
classes += ' wf-icon-blocked wf-ion-android-cancel';
[494] Fix | Delete
} else if (self.statusCode() == 404 || self.action() == 'loginFailValidUsername' || self.action() == 'loginFailInvalidUsername') {
[495] Fix | Delete
classes += ' wf-icon-warning wf-ion-alert-circled';
[496] Fix | Delete
} else if (self.jsRun() == 1) {
[497] Fix | Delete
classes += ' wf-icon-human wf-ion-ios-person';
[498] Fix | Delete
} else {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function