@@ -1148,8 +1148,12 @@ def tasks_report(request, task_id, report_format="json", make_zip=False):
1148
1148
resp = {"error" : True , "error_value" : "Task Report API is Disabled" }
1149
1149
return Response (resp )
1150
1150
1151
+ ALLOW_DL = False
1152
+ if hasattr (request .user , "userprofile" ) and request .user .userprofile .reports :
1153
+ ALLOW_DL = True
1154
+
1151
1155
# check if allowed to download to all + if no if user has permissions
1152
- if not settings .ALLOW_DL_REPORTS_TO_ALL and not request . user . userprofile . reports :
1156
+ if not settings .ALLOW_DL_REPORTS_TO_ALL and ALLOW_DL is False :
1153
1157
return render (
1154
1158
request ,
1155
1159
"error.html" ,
@@ -1787,39 +1791,6 @@ def tasks_surifile(request, task_id):
1787
1791
resp = {"error" : True , "error_value" : "No suricata files captured for task %s" % task_id }
1788
1792
return Response (resp )
1789
1793
1790
-
1791
- @csrf_exempt
1792
- @api_view (["GET" ])
1793
- def tasks_rollingsuri (request , window = 60 ):
1794
- window = int (window )
1795
-
1796
- if not apiconf .rollingsuri .get ("enabled" ):
1797
- resp = {"error" : True , "error_value" : "Suricata Rolling Alerts API is disabled" }
1798
- return Response (resp )
1799
- maxwindow = apiconf .rollingsuri .get ("maxwindow" )
1800
- if maxwindow > 0 :
1801
- if window > maxwindow :
1802
- resp = {"error" : True , "error_value" : "The Window You Specified is greater than the configured maximum" }
1803
- return Response (resp )
1804
-
1805
- gen_time = datetime .now () - timedelta (minutes = window )
1806
- dummy_id = ObjectId .from_datetime (gen_time )
1807
- result = list (
1808
- mongo_find (
1809
- "analysis" ,
1810
- {"suricata.alerts" : {"$exists" : True }, "_id" : {"$gte" : dummy_id }},
1811
- {"suricata.alerts" : 1 , "info.id" : 1 },
1812
- )
1813
- )
1814
- resp = []
1815
- for e in result :
1816
- for alert in e ["suricata" ]["alerts" ]:
1817
- alert ["id" ] = e ["info" ]["id" ]
1818
- resp .append (alert )
1819
-
1820
- return Response (resp )
1821
-
1822
-
1823
1794
@csrf_exempt
1824
1795
@api_view (["GET" ])
1825
1796
def tasks_procmemory (request , task_id , pid = "all" ):
0 commit comments