1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-FileCopyrightText: (C) 2021 Jason Ish <jason@codemonkey.net>
// SPDX-License-Identifier: MIT
use crate::{
actions, add_index, context::Context, prompt, term, SelectItem, EVEBOX_CONTAINER_NAME,
SURICATA_CONTAINER_NAME,
};
pub(crate) fn other(context: &Context) {
loop {
term::title("Simple-IDS: Other Menu Items");
let selections = vec![
SelectItem::new("rotate", "Force Log Rotation"),
SelectItem::new("suricata-shell", "Suricata Shell"),
SelectItem::new("evebox-shell", "EveBox Shell"),
SelectItem::new("return", "Return"),
];
let selections = add_index(&selections);
match inquire::Select::new("Select menu option", selections).prompt() {
Err(_) => return,
Ok(selection) => match selection.tag.as_ref() {
"return" => return,
"rotate" => {
actions::force_suricata_logrotate(context);
prompt::enter();
}
"suricata-shell" => {
let _ = context
.manager
.command()
.args([
"exec",
"-it",
"-e",
"PS1=[\\u@suricata \\W]\\$ ",
SURICATA_CONTAINER_NAME,
"bash",
])
.status();
}
"evebox-shell" => {
let _ = context
.manager
.command()
.args([
"exec",
"-it",
"-e",
"PS1=[\\u@evebox \\W]\\$ ",
EVEBOX_CONTAINER_NAME,
"/bin/sh",
])
.status();
}
_ => {}
},
}
}
}