mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
reports filter working
This commit is contained in:
parent
186c28cddc
commit
497449152b
5 changed files with 414 additions and 23 deletions
|
|
@ -87,11 +87,10 @@ function filterData(filter, value) {
|
|||
|
||||
// Base keys filtering (like plugin)
|
||||
const defaultFilters = getFilters.filter((f) => f.filter === "default");
|
||||
template = useFilter(template, defaultFilters);
|
||||
if (defaultFilters.length) template = useFilter(template, defaultFilters);
|
||||
|
||||
// Specific settings filtering from advanced template
|
||||
const filterSettings = getFilters.filter((f) => f.filter === "settings");
|
||||
|
||||
if (filterSettings.length) {
|
||||
template.forEach((plugin, id) => {
|
||||
// loop on plugin settings dict
|
||||
|
|
|
|||
|
|
@ -123,10 +123,12 @@ const builder = [
|
|||
},
|
||||
},
|
||||
{
|
||||
raw_data:
|
||||
'{"fesfesfsefesfesfesfesfesfesfesfesfesfsefes": "fesfs"}',
|
||||
type: "Text",
|
||||
data: {
|
||||
text: '{"fesfesfsefesfesfesfesfesfesfesfesfesfsefes": "fesfs"}',
|
||||
},
|
||||
type: "Text",
|
||||
},
|
||||
],
|
||||
[
|
||||
|
|
@ -188,10 +190,11 @@ const builder = [
|
|||
},
|
||||
},
|
||||
{
|
||||
raw_data: "{}",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "{}",
|
||||
},
|
||||
type: "Text",
|
||||
},
|
||||
],
|
||||
[
|
||||
|
|
@ -253,10 +256,11 @@ const builder = [
|
|||
},
|
||||
},
|
||||
{
|
||||
raw_data: "{}",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "{}",
|
||||
},
|
||||
type: "Text",
|
||||
},
|
||||
],
|
||||
[
|
||||
|
|
@ -318,10 +322,11 @@ const builder = [
|
|||
},
|
||||
},
|
||||
{
|
||||
raw_data: "{}",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "{}",
|
||||
},
|
||||
type: "Text",
|
||||
},
|
||||
],
|
||||
[
|
||||
|
|
@ -383,14 +388,187 @@ const builder = [
|
|||
},
|
||||
},
|
||||
{
|
||||
raw_data: "{}",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "{}",
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
date: "25/06/2024 07:40:23",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "25/06/2024 07:40:23",
|
||||
},
|
||||
},
|
||||
{
|
||||
ip: "111111",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "111111",
|
||||
},
|
||||
},
|
||||
{
|
||||
country: "fr",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "fr",
|
||||
},
|
||||
},
|
||||
{
|
||||
method: "POST",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "POST",
|
||||
},
|
||||
},
|
||||
{
|
||||
url: "/admin/login?id=e",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "/admin/login?id=e",
|
||||
},
|
||||
},
|
||||
{
|
||||
code: "403",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "403",
|
||||
},
|
||||
},
|
||||
{
|
||||
user_agent:
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||
},
|
||||
},
|
||||
{
|
||||
reason: " antibot",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: " antibot",
|
||||
},
|
||||
},
|
||||
{
|
||||
raw_data: "{}",
|
||||
type: "Text",
|
||||
data: {
|
||||
text: "{}",
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
filters: [],
|
||||
filters: [
|
||||
{
|
||||
filter: "table",
|
||||
filterName: "keyword",
|
||||
type: "keyword",
|
||||
value: "",
|
||||
keys: ["url", "ip", "date", "user_agent", "raw_data"],
|
||||
field: {
|
||||
id: "reports-keyword",
|
||||
value: "",
|
||||
type: "text",
|
||||
name: "reports-keyword",
|
||||
label: "reports_search",
|
||||
placeholder: "inp_keyword",
|
||||
isClipboard: false,
|
||||
popovers: [
|
||||
{
|
||||
text: "reports_search_desc",
|
||||
iconName: "info",
|
||||
},
|
||||
],
|
||||
columns: {
|
||||
pc: 3,
|
||||
tablet: 4,
|
||||
mobile: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
filter: "table",
|
||||
filterName: "country",
|
||||
type: "select",
|
||||
value: "all",
|
||||
keys: ["country"],
|
||||
field: {
|
||||
id: "reports-country",
|
||||
value: "all",
|
||||
values: ["all", "local", "fr"],
|
||||
name: "reports-country",
|
||||
onlyDown: true,
|
||||
label: "reports_country",
|
||||
popovers: [
|
||||
{
|
||||
text: "reports_country_desc",
|
||||
iconName: "info",
|
||||
},
|
||||
],
|
||||
columns: {
|
||||
pc: 3,
|
||||
tablet: 4,
|
||||
mobile: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
filter: "table",
|
||||
filterName: "method",
|
||||
type: "select",
|
||||
value: "all",
|
||||
keys: ["method"],
|
||||
field: {
|
||||
id: "reports-method",
|
||||
value: "all",
|
||||
values: ["all", "GET", "POST"],
|
||||
name: "reports-method",
|
||||
onlyDown: true,
|
||||
label: "reports_method",
|
||||
popovers: [
|
||||
{
|
||||
text: "reports_method_desc",
|
||||
iconName: "info",
|
||||
},
|
||||
],
|
||||
columns: {
|
||||
pc: 3,
|
||||
tablet: 4,
|
||||
mobile: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
filter: "table",
|
||||
filterName: "reason",
|
||||
type: "select",
|
||||
value: "all",
|
||||
keys: ["reason"],
|
||||
field: {
|
||||
id: "reports-reason",
|
||||
value: "all",
|
||||
values: ["all", "modsecurity", " antibot"],
|
||||
name: "reports-reason",
|
||||
onlyDown: true,
|
||||
label: "reports_reason",
|
||||
popovers: [
|
||||
{
|
||||
text: "reports_reason_desc",
|
||||
iconName: "info",
|
||||
},
|
||||
],
|
||||
columns: {
|
||||
pc: 3,
|
||||
tablet: 4,
|
||||
mobile: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -240,12 +240,15 @@ function isItemSelect(filters, item) {
|
|||
// Avoid non-primitive value
|
||||
if (typeof value !== "string" && typeof value !== "number") continue;
|
||||
// Value need to match exactly filter value
|
||||
if (value.toString().toLowerCase() === filterValue.toLowerCase()) {
|
||||
return true;
|
||||
if (
|
||||
value.toString().toLowerCase().trim() !==
|
||||
filterValue.toString().toLowerCase().trim()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -99,10 +99,11 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"raw_data": "{\"fesfesfsefesfesfesfesfesfesfesfesfesfsefes\": \"fesfs\"}",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "{\"fesfesfsefesfesfesfesfesfesfesfesfesfsefes\": \"fesfs\"}"
|
||||
},
|
||||
"type": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
@ -163,10 +164,11 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"raw_data": "{}",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "{}"
|
||||
},
|
||||
"type": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
@ -227,10 +229,11 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"raw_data": "{}",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "{}"
|
||||
},
|
||||
"type": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
@ -291,10 +294,11 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"raw_data": "{}",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "{}"
|
||||
},
|
||||
"type": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
|
|
@ -355,14 +359,210 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"raw_data": "{}",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "{}"
|
||||
},
|
||||
"type": "Text"
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"date": "25/06/2024 07:40:23",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "25/06/2024 07:40:23"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ip": "111111",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "111111"
|
||||
}
|
||||
},
|
||||
{
|
||||
"country": "fr",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "fr"
|
||||
}
|
||||
},
|
||||
{
|
||||
"method": "POST",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "POST"
|
||||
}
|
||||
},
|
||||
{
|
||||
"url": "/admin/login?id=e",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "/admin/login?id=e"
|
||||
}
|
||||
},
|
||||
{
|
||||
"code": "403",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "403"
|
||||
}
|
||||
},
|
||||
{
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
|
||||
}
|
||||
},
|
||||
{
|
||||
"reason": " antibot",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": " antibot"
|
||||
}
|
||||
},
|
||||
{
|
||||
"raw_data": "{}",
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"text": "{}"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"filters": []
|
||||
"filters": [
|
||||
{
|
||||
"filter": "table",
|
||||
"filterName": "keyword",
|
||||
"type": "keyword",
|
||||
"value": "",
|
||||
"keys": [
|
||||
"url",
|
||||
"ip",
|
||||
"date",
|
||||
"user_agent",
|
||||
"raw_data"
|
||||
],
|
||||
"field": {
|
||||
"id": "reports-keyword",
|
||||
"value": "",
|
||||
"type": "text",
|
||||
"name": "reports-keyword",
|
||||
"label": "reports_search",
|
||||
"placeholder": "inp_keyword",
|
||||
"isClipboard": false,
|
||||
"popovers": [
|
||||
{
|
||||
"text": "reports_search_desc",
|
||||
"iconName": "info"
|
||||
}
|
||||
],
|
||||
"columns": {
|
||||
"pc": 3,
|
||||
"tablet": 4,
|
||||
"mobile": 12
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"filter": "table",
|
||||
"filterName": "country",
|
||||
"type": "select",
|
||||
"value": "all",
|
||||
"keys": [
|
||||
"country"
|
||||
],
|
||||
"field": {
|
||||
"id": "reports-country",
|
||||
"value": "all",
|
||||
"values": [
|
||||
"all",
|
||||
"local",
|
||||
"fr"
|
||||
],
|
||||
"name": "reports-country",
|
||||
"onlyDown": true,
|
||||
"label": "reports_country",
|
||||
"popovers": [
|
||||
{
|
||||
"text": "reports_country_desc",
|
||||
"iconName": "info"
|
||||
}
|
||||
],
|
||||
"columns": {
|
||||
"pc": 3,
|
||||
"tablet": 4,
|
||||
"mobile": 12
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"filter": "table",
|
||||
"filterName": "method",
|
||||
"type": "select",
|
||||
"value": "all",
|
||||
"keys": [
|
||||
"method"
|
||||
],
|
||||
"field": {
|
||||
"id": "reports-method",
|
||||
"value": "all",
|
||||
"values": [
|
||||
"all",
|
||||
"GET",
|
||||
"POST"
|
||||
],
|
||||
"name": "reports-method",
|
||||
"onlyDown": true,
|
||||
"label": "reports_method",
|
||||
"popovers": [
|
||||
{
|
||||
"text": "reports_method_desc",
|
||||
"iconName": "info"
|
||||
}
|
||||
],
|
||||
"columns": {
|
||||
"pc": 3,
|
||||
"tablet": 4,
|
||||
"mobile": 12
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"filter": "table",
|
||||
"filterName": "reason",
|
||||
"type": "select",
|
||||
"value": "all",
|
||||
"keys": [
|
||||
"reason"
|
||||
],
|
||||
"field": {
|
||||
"id": "reports-reason",
|
||||
"value": "all",
|
||||
"values": [
|
||||
"all",
|
||||
"modsecurity",
|
||||
" antibot"
|
||||
],
|
||||
"name": "reports-reason",
|
||||
"onlyDown": true,
|
||||
"label": "reports_reason",
|
||||
"popovers": [
|
||||
{
|
||||
"text": "reports_reason_desc",
|
||||
"iconName": "info"
|
||||
}
|
||||
],
|
||||
"columns": {
|
||||
"pc": 3,
|
||||
"tablet": 4,
|
||||
"mobile": 12
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -57,6 +57,17 @@ reports = [
|
|||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||
"data": {},
|
||||
},
|
||||
{
|
||||
"url": "/admin/login?id=e",
|
||||
"ip": "111111",
|
||||
"reason": " antibot",
|
||||
"country": "fr",
|
||||
"status": 403,
|
||||
"method": "POST",
|
||||
"date": "25/06/2024 07:40:23",
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
||||
"data": {},
|
||||
},
|
||||
]
|
||||
|
||||
# Reoder reports to get in order "date", "ip", "country", "method", "url", "code", "user_agent", "reason", "data"
|
||||
|
|
@ -69,7 +80,7 @@ for report in reports:
|
|||
report["code"] = report.pop("status")
|
||||
report["user_agent"] = report.pop("user_agent")
|
||||
report["reason"] = report.pop("reason")
|
||||
report["data"] = report.pop("data")
|
||||
report["raw_data"] = report.pop("data")
|
||||
|
||||
|
||||
def get_reports_filter(reports):
|
||||
|
|
@ -103,7 +114,7 @@ def get_reports_filter(reports):
|
|||
"filterName": "keyword",
|
||||
"type": "keyword",
|
||||
"value": "",
|
||||
"keys": ["url", "ip", "date", "user_agent"],
|
||||
"keys": ["url", "ip", "date", "user_agent", "raw_data"],
|
||||
"field": {
|
||||
"id": "reports-keyword",
|
||||
"value": "",
|
||||
|
|
|
|||
Loading…
Reference in a new issue