From 8bc9e3a65f50016b10e1a98c0a66ba99fdcd4cc6 Mon Sep 17 00:00:00 2001
From: Itay Mizeretz
Date: Tue, 5 Dec 2017 17:01:47 +0200
Subject: [PATCH] Add warning message if watching report while monkeys are
running
---
.../cc/ui/src/components/pages/ReportPage.js | 27 +++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/monkey_island/cc/ui/src/components/pages/ReportPage.js b/monkey_island/cc/ui/src/components/pages/ReportPage.js
index 404d2e374..e29d9388f 100644
--- a/monkey_island/cc/ui/src/components/pages/ReportPage.js
+++ b/monkey_island/cc/ui/src/components/pages/ReportPage.js
@@ -30,16 +30,29 @@ class ReportPageComponent extends React.Component {
super(props);
this.state = {
report: {},
- graph: {nodes: [], edges: []}
+ graph: {nodes: [], edges: []},
+ allMonkeysAreDead: false
};
}
componentDidMount() {
this.getReportFromServer();
this.updateMapFromServer();
+ this.updateMonkeysRunning();
this.interval = setInterval(this.updateMapFromServer, 1000);
}
+ updateMonkeysRunning = () => {
+ fetch('/api')
+ .then(res => res.json())
+ .then(res => {
+ // This check is used to prevent unnecessary re-rendering
+ this.setState({
+ allMonkeysAreDead: (!res['completed_steps']['run_monkey']) || (res['completed_steps']['infection_done'])
+ });
+ });
+ };
+
componentWillUnmount() {
clearInterval(this.interval);
}
@@ -361,8 +374,18 @@ class ReportPageComponent extends React.Component {
Infection Monkey did not find any critical security issues.
)
}
+ {
+ this.state.allMonkeysAreDead ?
+ ''
+ :
+ (
+
+ Some monkeys are still running. To get the best report it's best to wait for all of them to finish
+ running.
+
)
+ }
-
+
To improve the monkey's success rate, try adding users and passwords, and enabling the "Local
network scan" config value under "Basic - Network"