openappsec / waf-comparison-project

Testing datasets and tools to compare WAF efficacy
https://www.openappsec.io
Apache License 2.0
144 stars 24 forks source link

Output files not in Output directory #8

Open dkegel-fastly opened 8 months ago

dkegel-fastly commented 8 months ago

How to say you're a windows developer without saying you're a windows developer :-)

drwxr-xr-x  2 dkegel  staff          64 Feb 19 23:48 Output
-rw-r--r--  1 dkegel  staff     3606795 Feb 19 23:48 Output\False Positive Rate.html
...
TuxInvader commented 4 months ago

This patch fixes it for me. It should work on windows too.

diff --git a/analyzer.py b/analyzer.py
index 64acb40..24eb247 100644
--- a/analyzer.py
+++ b/analyzer.py
@@ -1,6 +1,7 @@
 import plotly.express as px
 from pathlib import Path
 import pandas as pd
+import os

 from config import engine
 from helper import log, isTableExists
@@ -77,7 +78,7 @@ def create_graph(_df, metric, is_ascending):
     print(_df_sorted[['Position', 'WAF Name', metric]].to_string(index=False))

     Path("Output").mkdir(exist_ok=True)
-    fig.write_html(f"Output\\{metric}.html")
+    fig.write_html("Output" + os.sep + f"{metric}.html")

 def create_2d_graph(_df):
@@ -102,7 +103,7 @@ def create_2d_graph(_df):
     fig.update_traces(textposition="bottom center")

     Path("Output").mkdir(exist_ok=True)
-    fig.write_html(f"Output\\2d Graph True Negative Rate & True Positive Rate.html")
+    fig.write_html("Output" + os.sep + "2d Graph True Negative Rate & True Positive Rate.html")

 def analyze_results():