Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hide editor param #23

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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("/")
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ window.onload = function () {
}
});

// check if hideEditor 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'));
Expand Down
6 changes: 2 additions & 4 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@
</div>
</div>
</div>

<div id="content-section" class="mx-10 mt-5">
<div class="grid lg:grid-cols-2 gap-4">
<div class="lg:col-span-1 self-start lg:px-2">
<div id="rule-grid" class="grid lg:grid-cols-2 gap-4">
<div id="rule-section" class="lg:col-span-1 self-start lg:px-2">
<p class="text-lg text-white font-bold">
<span class="px-3 py-2 border-x border-t rounded border-sigma-blue">
<i id="rule-share-btn" class="fas fa-share-nodes px-1 py-0 my-0 text-sm text-sigma-blue cursor-pointer"></i>
Expand Down Expand Up @@ -169,7 +168,6 @@
level: high</code></pre>
<pre onclick="focusSelect('pipeline-code')" class="border border-sigma-blue tab-code hidden"><code id="pipeline-code" class="language-yaml text-sm"></code></pre>
</div>

<div class="lg:col-span-1 self-start lg:px-2">
<p class="text-lg text-white font-bold">
<span class="px-3 py-2 border-x border-t rounded border-sigma-blue">
Expand Down