forked from p34709852/monkey
Minor fixes and improvements
This commit is contained in:
parent
7663615a4f
commit
9b350b8bf5
|
@ -13,9 +13,8 @@ class TelemetryPerformanceTestWorkflow(BasicTest):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
# TelemetryPerformanceTest(island_client=self.island_client).test_telemetry_performance()
|
TelemetryPerformanceTest(island_client=self.island_client).test_telemetry_performance()
|
||||||
performance_test = EndpointPerformanceTest(self.name, self.performance_config, self.island_client)
|
performance_test = EndpointPerformanceTest(self.name, self.performance_config, self.island_client)
|
||||||
assert performance_test.run()
|
assert performance_test.run()
|
||||||
finally:
|
finally:
|
||||||
pass
|
self.island_client.reset_env()
|
||||||
# self.island_client.reset_env()
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ from flask import jsonify
|
||||||
from monkey_island.cc.auth import jwt_required
|
from monkey_island.cc.auth import jwt_required
|
||||||
from monkey_island.cc.services.reporting.report import ReportService
|
from monkey_island.cc.services.reporting.report import ReportService
|
||||||
from monkey_island.cc.services.reporting.zero_trust_service import ZeroTrustService
|
from monkey_island.cc.services.reporting.zero_trust_service import ZeroTrustService
|
||||||
from monkey_island.cc.testing.profiler_decorator import profile
|
|
||||||
|
|
||||||
ZERO_TRUST_REPORT_TYPE = "zero_trust"
|
ZERO_TRUST_REPORT_TYPE = "zero_trust"
|
||||||
SECURITY_REPORT_TYPE = "security"
|
SECURITY_REPORT_TYPE = "security"
|
||||||
|
@ -22,7 +21,6 @@ __author__ = ["itay.mizeretz", "shay.nehmad"]
|
||||||
class Report(flask_restful.Resource):
|
class Report(flask_restful.Resource):
|
||||||
|
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
@profile()
|
|
||||||
def get(self, report_type=SECURITY_REPORT_TYPE, report_data=None):
|
def get(self, report_type=SECURITY_REPORT_TYPE, report_data=None):
|
||||||
if report_type == SECURITY_REPORT_TYPE:
|
if report_type == SECURITY_REPORT_TYPE:
|
||||||
return ReportService.get_report()
|
return ReportService.get_report()
|
||||||
|
|
|
@ -3,12 +3,10 @@ import json
|
||||||
|
|
||||||
from monkey_island.cc.auth import jwt_required
|
from monkey_island.cc.auth import jwt_required
|
||||||
from monkey_island.cc.services.reporting.zero_trust_service import ZeroTrustService
|
from monkey_island.cc.services.reporting.zero_trust_service import ZeroTrustService
|
||||||
from monkey_island.cc.testing.profiler_decorator import profile
|
|
||||||
|
|
||||||
|
|
||||||
class ZeroTrustFindingEvent(flask_restful.Resource):
|
class ZeroTrustFindingEvent(flask_restful.Resource):
|
||||||
|
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
@profile()
|
|
||||||
def get(self, finding_id: str):
|
def get(self, finding_id: str):
|
||||||
return {'events_json': json.dumps(ZeroTrustService.get_events_by_finding(finding_id), default=str)}
|
return {'events_json': json.dumps(ZeroTrustService.get_events_by_finding(finding_id), default=str)}
|
||||||
|
|
|
@ -109,8 +109,7 @@ class ZeroTrustService(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_all_findings():
|
def get_all_findings():
|
||||||
pipeline = [{'$match': {}},
|
pipeline = [{'$addFields': {'oldest_events': {'$slice': ['$events', EVENT_FETCH_CNT]},
|
||||||
{'$addFields': {'oldest_events': {'$slice': ['$events', EVENT_FETCH_CNT]},
|
|
||||||
'latest_events': {'$slice': ['$events', -1*EVENT_FETCH_CNT]},
|
'latest_events': {'$slice': ['$events', -1*EVENT_FETCH_CNT]},
|
||||||
'event_count': {'$size': '$events'}}},
|
'event_count': {'$size': '$events'}}},
|
||||||
{'$unset': ['events']}]
|
{'$unset': ['events']}]
|
||||||
|
@ -130,7 +129,7 @@ class ZeroTrustService(object):
|
||||||
elif overlap_count <= 0:
|
elif overlap_count <= 0:
|
||||||
return []
|
return []
|
||||||
else:
|
else:
|
||||||
return events[ -overlap_count :]
|
return events[-1 * overlap_count:]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __get_enriched_finding(finding):
|
def __get_enriched_finding(finding):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, {Component} from 'react';
|
import React from 'react';
|
||||||
import {Modal} from 'react-bootstrap';
|
import {Modal} from 'react-bootstrap';
|
||||||
import EventsTimeline from './EventsTimeline';
|
import EventsTimeline from './EventsTimeline';
|
||||||
import * as PropTypes from 'prop-types';
|
import * as PropTypes from 'prop-types';
|
||||||
|
@ -6,7 +6,7 @@ import saveJsonToFile from '../../utils/SaveJsonToFile';
|
||||||
import EventsModalButtons from './EventsModalButtons';
|
import EventsModalButtons from './EventsModalButtons';
|
||||||
import AuthComponent from '../../AuthComponent';
|
import AuthComponent from '../../AuthComponent';
|
||||||
import Pluralize from 'pluralize';
|
import Pluralize from 'pluralize';
|
||||||
import SkippedEventsTimeline from "./SkippedEventsTimeline";
|
import SkippedEventsTimeline from './SkippedEventsTimeline';
|
||||||
|
|
||||||
const FINDING_EVENTS_URL = '/api/zero-trust/finding-event/';
|
const FINDING_EVENTS_URL = '/api/zero-trust/finding-event/';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue