template access plugin

*template access plugin.json
*now info is plugin desc
This commit is contained in:
Jordan Blasenhauer 2024-02-02 11:52:21 +01:00
parent 93fb398aa6
commit 1213b2f49f
21 changed files with 35 additions and 43 deletions

View file

@ -1,4 +1,4 @@
{% extends "base.html" %} {% block content %} {{ plugin }}
{% extends "base.html" %} {% block content %}
<div class="col-span-12 grid grid-cols-12 gap-4">
<!-- info-->
<div
@ -65,9 +65,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Anti-bot technology is designed to detect and mitigate suspicious or
malicious bots, preventing them from reaching an organization's websites
or IT ecosystem.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count: {

View file

@ -61,9 +61,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Basic Auth is a method for an HTTP user agent
(e.g. a web browser) to provide a user name and password when making a
request.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count: {

View file

@ -110,8 +110,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Ban IP generating too much 'bad' HTTP status
code in a period of time.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count: {

View file

@ -225,8 +225,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Deny access based on internal and external
IP/network/rDNS/ASN blacklists.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count_url: {

View file

@ -152,8 +152,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `BunkerNet is a crowdsourced database of malicious
requests shared between all BunkerWeb instances over the world. `,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
// value : active / inactive / unknown

View file

@ -63,8 +63,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Cross-Origin Resource Sharing lets you manage how your
service can be contacted from different origins.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count: {

View file

@ -105,9 +105,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `The country security feature allows you to apply
policy based on the country of the IP address of clients (blacklist /
whitelist).`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
blacklist_count: {

View file

@ -76,7 +76,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Custom certificates allow you to get HTTPS / SSL / TLS on your requests.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
items: {

View file

@ -103,9 +103,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `BunkerWeb securely stores its current configuration in
a backend database, which contains essential data for smooth
operation.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
driver: {

View file

@ -65,7 +65,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Deny access based on external DNSBL servers.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
items: {

View file

@ -65,7 +65,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Show number of occurences of each error code.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
items: {

View file

@ -225,8 +225,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Deny access based on internal and external
IP/network/rDNS/ASN greylists.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count_url: {

View file

@ -76,7 +76,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Let's encrypt certificates allow you to get HTTPS / SSL / TLS on your requests.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
items: {

View file

@ -71,7 +71,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Limit maximum number of requests and connections.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
items: {

View file

@ -110,7 +110,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Miscellaneous settings (methods, servers...).`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count_disabled_servers: {

View file

@ -65,12 +65,12 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx that is developed by Trustwave's SpiderLabs.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count: {
el: document.querySelector("[data-count]"),
value: `ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx that is developed by Trustwave's SpiderLabs.`,
value: 'unknown',
type: "text",
},
});

View file

@ -150,8 +150,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Redis server configuration when using BunkerWeb in
cluster mode.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
// value : active / inactive / unknown

View file

@ -67,10 +67,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Reverse scan is a feature designed to detect
open ports by establishing TCP connections with clients' IP addresses.
Consider adding this feature if you want to detect possible open proxies
or connections from servers.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
items: {

View file

@ -76,7 +76,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Selfsigned certificates allow you to get HTTPS / SSL / TLS on your requests.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
items: {

View file

@ -225,8 +225,7 @@
const setPlugin = new SetupPlugin({
info: {
el: document.querySelector("[data-info]"),
value: `Allow access based on internal and external
IP/network/rDNS/ASN whitelists.`,
value: "{{ plugin['description'] or ''}}",
type: "text",
},
count_url: {

View file

@ -1259,6 +1259,13 @@ def upload_plugin():
@app.route("/plugins/<plugin>", methods=["GET", "POST"])
@login_required
def custom_plugin(plugin: str):
plugins = app.config["CONFIG"].get_plugins()
curr_plugin = {}
for plug in plugins:
if plug["id"] == plugin:
curr_plugin = plug
break
message = ""
if not plugin_id_rx.match(plugin):
message = f'Invalid plugin id, "{plugin}" (must be between 1 and 64 characters, only letters, numbers, underscores and hyphens)'
@ -1276,6 +1283,7 @@ def custom_plugin(plugin: str):
dark_mode=app.config["DARK_MODE"],
username=current_user.get_id(),
current_endpoint=plugin,
plugin=curr_plugin,
**app.jinja_env.globals,
)
@ -1574,9 +1582,11 @@ def logs_container(container_id):
logs.append(
{
"content": log,
"type": "error"
if "[error]" in log_lower or "[crit]" in log_lower or "[alert]" in log_lower or "" in log_lower
else ("warn" if "[warn]" in log_lower or "⚠️" in log_lower else ("info" if "[info]" in log_lower or "" in log_lower else "message")),
"type": (
"error"
if "[error]" in log_lower or "[crit]" in log_lower or "[alert]" in log_lower or "" in log_lower
else ("warn" if "[warn]" in log_lower or "⚠️" in log_lower else ("info" if "[info]" in log_lower or "" in log_lower else "message"))
),
}
)