From 0543fc87e0d27b4ab4998990a6c9b04ae7067827 Mon Sep 17 00:00:00 2001 From: Nasreddine Bencherchali <8741929+nasbench@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:07:50 +0100 Subject: [PATCH 1/2] feat: add hide editor param --- run.py | 9 ++++++++- static/js/index.js | 9 +++++++++ templates/index.html | 6 ++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/run.py b/run.py index 36cd7b1..d85d3a6 100644 --- a/run.py +++ b/run.py @@ -4,7 +4,8 @@ import os import yaml import base64 -from flask import Flask, render_template, request, Response +import json +from flask import Flask, jsonify, render_template, request, Response from sigma.conversion.base import Backend from sigma.plugins import InstalledSigmaPlugins @@ -19,6 +20,7 @@ backends = plugins.backends pipeline_resolver = plugins.get_pipeline_resolver() pipelines = list(pipeline_resolver.list_pipelines()) +pipelines_names = [p[0] for p in pipelines] @app.route("/") @@ -41,6 +43,11 @@ def home(): ) +@app.route("/getpipelines", methods=["GET"]) +def get_pipelines(): + return jsonify(pipelines_names) + + @app.route("/sigma", methods=["POST"]) def convert(): # get params from request diff --git a/static/js/index.js b/static/js/index.js index 630d72e..48e2587 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -41,6 +41,15 @@ window.onload = function () { } }); + // check if rule parameter is in url + if(urlParameter.has('hideEditor')){ + let hideEditor = urlParameter.get('hideEditor') + if(hideEditor == 1){ + document.getElementById("rule-section").style.display = "none" + document.getElementById("rule-grid").setAttribute("class", "") + } + } + // check if rule parameter is in url if(urlParameter.has('rule')){ let rule = atob(urlParameter.get('rule')); diff --git a/templates/index.html b/templates/index.html index c473115..8ae3b8e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -78,10 +78,9 @@ -
-
-
+
+

@@ -169,7 +168,6 @@ level: high

-

From c1d08abdd54dace37720247d75eb1e272a5664a5 Mon Sep 17 00:00:00 2001 From: Nasreddine Bencherchali <8741929+nasbench@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:16:33 +0100 Subject: [PATCH 2/2] Update index.js --- static/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/index.js b/static/js/index.js index 48e2587..2bb9b5d 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -41,7 +41,7 @@ window.onload = function () { } }); - // check if rule parameter is in url + // check if hideEditor parameter is in url if(urlParameter.has('hideEditor')){ let hideEditor = urlParameter.get('hideEditor') if(hideEditor == 1){