-
+
@@ -148,24 +177,31 @@ class PcapPane extends Component {
POST /api/pcap/file
-
+ {this.state.fileStatusCode}
-
+
+
+
+
+ this.setState({uploadFlushAll: v})}/>
+ this.setState({uploadFlushAll: v})}/>
+
+
+
+
+
-
-
-
-
);
}
}
diff --git a/frontend/src/components/panels/RulePane.js b/frontend/src/components/panels/RulePane.js
new file mode 100644
index 0000000..fbc8785
--- /dev/null
+++ b/frontend/src/components/panels/RulePane.js
@@ -0,0 +1,166 @@
+import React, {Component} from 'react';
+import './RulePane.scss';
+import Table from "react-bootstrap/Table";
+import {Button, Col, Container, Row} from "react-bootstrap";
+import InputField from "../fields/InputField";
+import CheckField from "../fields/CheckField";
+import TextField from "../fields/TextField";
+import backend from "../../backend";
+import NumericField from "../fields/extensions/NumericField";
+import ColorField from "../fields/extensions/ColorField";
+import ChoiceField from "../fields/ChoiceField";
+import ButtonField from "../fields/ButtonField";
+
+class RulePane extends Component {
+
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ rules: [],
+ };
+ }
+
+ componentDidMount() {
+ this.loadRules();
+ }
+
+ loadRules = () => {
+ backend.getJson("/api/rules").then(res => this.setState({rules: res}));
+ };
+
+
+ render() {
+ let rules = this.state.rules.map(r =>
+
+ {r["id"].substring(0, 8)} |
+ {r["name"]} |
+ {r["notes"]} |
+ {/*{((new Date(s["completed_at"]) - new Date(s["started_at"])) / 1000).toFixed(3)}s | */}
+ {/*{formatSize(s["size"])} | */}
+ {/*{s["processed_packets"]} | */}
+ {/*{s["invalid_packets"]} | */}
+ {/*undefined | */}
+ {/*download*/}
+ {/* | */}
+
+ );
+
+ return (
+
+
+
+ GET /api/rules
+ 200 OK
+
+
+
+
+
+
+ id |
+ name |
+ notes |
+
+
+
+ {rules}
+
+
+
+
+
+
+
+ POST /api/rules
+
+
+
+
+
+
+
+
+ this.setState({test1: e})} inline />
+
+
+
+
+ filters:
+ this.setState({test: e})} validate={(e) => e%2 === 0} />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ patterns:
+
+
+
+
+ regex |
+ Aa |
+ .* |
+ \n+ |
+ UTF8 |
+ Uni_ |
+ min |
+ max |
+ direction |
+ actions |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ s", "s->c"]} value="both" /> |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+
+}
+
+export default RulePane;
diff --git a/frontend/src/components/panels/RulePane.scss b/frontend/src/components/panels/RulePane.scss
new file mode 100644
index 0000000..b030c6a
--- /dev/null
+++ b/frontend/src/components/panels/RulePane.scss
@@ -0,0 +1,16 @@
+
+.rule-pane {
+ .post-rules-actions {
+ display: flex;
+
+ .rules-options {
+ flex: 1;
+ }
+
+ button {
+ margin-left: 10px;
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/frontend/src/index.scss b/frontend/src/index.scss
index 5d1bbfa..9dcc692 100644
--- a/frontend/src/index.scss
+++ b/frontend/src/index.scss
@@ -21,118 +21,6 @@ pre {
font-size: 14px;
}
-.btn {
- border-radius: 0;
- background-color: $color-primary-2;
- border: none;
- border-bottom: 5px solid $color-primary-1;
- color: $color-primary-4;
- outline: none;
- padding: 5px 12px;
- font-weight: 500;
-
- &:hover,
- &:active {
- background-color: $color-primary-1;
- color: $color-primary-4;
- }
-
- &:focus,
- &:active {
- outline: none !important;
- box-shadow: none !important;
- }
-}
-
-.btn-sm {
- border: none;
- font-size: 12px;
-}
-
-.btn-red {
- color: $color-red-light;
- background-color: $color-red;
- border-bottom: 5px solid $color-red-dark;
-
- &:hover,
- &:active {
- color: $color-red-light;
- background-color: $color-red-dark;
- }
-}
-
-.btn-pink {
- color: $color-pink-light;
- background-color: $color-pink;
- border-bottom: 5px solid $color-pink-dark;
-
- &:hover,
- &:active {
- color: $color-pink-light;
- background-color: $color-pink-dark;
- }
-}
-
-.btn-purple {
- color: $color-purple-light;
- background-color: $color-purple;
- border-bottom: 5px solid $color-purple-dark;
-
- &:hover,
- &:active {
- color: $color-purple-light;
- background-color: $color-purple-dark;
- }
-}
-
-.btn-deep-purple {
- color: $color-deep-purple-light;
- background-color: $color-deep-purple;
- border-bottom: 5px solid $color-deep-purple-dark;
-
- &:hover,
- &:active {
- color: $color-deep-purple-light;
- background-color: $color-deep-purple-dark;
- }
-}
-
-.btn-indigo {
- color: $color-indigo-light;
- background-color: $color-indigo;
- border-bottom: 5px solid $color-indigo-dark;
-
- &:hover,
- &:active {
- color: $color-indigo-light;
- background-color: $color-indigo-dark;
- }
-}
-
-.btn-blue {
- color: $color-blue-light;
- background-color: $color-blue;
- border-bottom: 5px solid $color-blue-dark;
-
- &:hover,
- &:active {
- color: $color-blue-light;
- background-color: $color-blue-dark;
- }
-}
-
-.btn-green {
- color: $color-green-light;
- background-color: $color-green;
- border-bottom: 5px solid $color-green-dark;
-
- &:hover,
- &:active {
- color: $color-green-light;
- background-color: $color-green-dark;
- }
-}
-
a {
color: $color-primary-4;
@@ -190,3 +78,7 @@ textarea.form-control {
.text-muted {
color: $color-primary-4 !important;
}
+
+.popover-header {
+ color: $color-primary-1;
+}
\ No newline at end of file
diff --git a/frontend/src/views/Connections.js b/frontend/src/views/Connections.js
index da8958b..f3fec64 100644
--- a/frontend/src/views/Connections.js
+++ b/frontend/src/views/Connections.js
@@ -25,21 +25,21 @@ class Connections extends Component {
this.scrollBottomThreashold = 0.99999;
this.maxConnections = 500;
this.queryLimit = 50;
-
- this.handleScroll = this.handleScroll.bind(this);
- this.connectionSelected = this.connectionSelected.bind(this);
- this.addServicePortFilter = this.addServicePortFilter.bind(this);
}
componentDidMount() {
this.loadConnections({limit: this.queryLimit})
.then(() => this.setState({loaded: true}));
+ if (this.props.initialConnection != null) {
+ this.setState({selected: this.props.initialConnection.id});
+ // TODO: scroll to initial connection
+ }
}
- connectionSelected(c) {
+ connectionSelected = (c) => {
this.setState({selected: c.id});
this.props.onSelected(c);
- }
+ };
componentDidUpdate(prevProps, prevState, snapshot) {
if (this.state.loaded && prevProps.location.search !== this.props.location.search) {
@@ -49,7 +49,7 @@ class Connections extends Component {
}
}
- handleScroll(e) {
+ handleScroll = (e) => {
let relativeScroll = e.currentTarget.scrollTop / (e.currentTarget.scrollHeight - e.currentTarget.clientHeight);
if (!this.state.loading && relativeScroll > this.scrollBottomThreashold) {
this.loadConnections({from: this.state.lastConnection.id, limit: this.queryLimit,})
@@ -59,13 +59,13 @@ class Connections extends Component {
this.loadConnections({to: this.state.firstConnection.id, limit: this.queryLimit,})
.then(() => console.log("Previous connections loaded"));
}
- }
+ };
- addServicePortFilter(port) {
+ addServicePortFilter = (port) => {
let urlParams = new URLSearchParams(this.props.location.search);
urlParams.set("service_port", port);
this.setState({queryString: "?" + urlParams});
- }
+ };
async loadConnections(params) {
let url = "/api/connections";
@@ -75,7 +75,7 @@ class Connections extends Component {
}
this.setState({loading: true, prevParams: params});
- let res = await backend.get(`${url}?${urlParams}`);
+ let res = await backend.getJson(`${url}?${urlParams}`);
let connections = this.state.connections;
let firstConnection = this.state.firstConnection;
@@ -115,7 +115,7 @@ class Connections extends Component {
let flagRule = this.state.flagRule;
let rules = this.state.rules;
if (flagRule === null) {
- rules = await backend.get("/api/rules");
+ rules = await backend.getJson("/api/rules");
flagRule = rules.filter(rule => {
return rule.name === "flag";
})[0];
diff --git a/frontend/src/views/Header.js b/frontend/src/views/Header.js
index e2d0e6a..a022636 100644
--- a/frontend/src/views/Header.js
+++ b/frontend/src/views/Header.js
@@ -72,7 +72,9 @@ class Header extends Component {
-
+
+
+
diff --git a/frontend/src/views/MainPane.js b/frontend/src/views/MainPane.js
index ce755d1..9d3f7b7 100644
--- a/frontend/src/views/MainPane.js
+++ b/frontend/src/views/MainPane.js
@@ -5,24 +5,25 @@ import ConnectionContent from "../components/ConnectionContent";
import {Route, Switch, withRouter} from "react-router-dom";
import PcapPane from "../components/panels/PcapPane";
import backend from "../backend";
+import RulePane from "../components/panels/RulePane";
class MainPane extends Component {
constructor(props) {
super(props);
this.state = {
- selectedConnection: null
+ selectedConnection: null,
+ loading: false
};
}
componentDidMount() {
- if ('id' in this.props.match.params) {
- const id = this.props.match.params.id;
- backend.get(`/api/connections/${id}`).then(res => {
- if (res.status === 200) {
- this.setState({selectedConnection: res});
- }
- });
+ const match = this.props.location.pathname.match(/^\/connections\/([a-f0-9]{24})$/);
+ if (match != null) {
+ this.setState({loading: true});
+ backend.getJson(`/api/connections/${match[1]}`)
+ .then(connection => this.setState({selectedConnection: connection, loading: false}))
+ .catch(error => console.log(error));
}
}
@@ -32,12 +33,18 @@ class MainPane extends Component {
- this.setState({selectedConnection: c})} />
+ {
+ !this.state.loading &&
+ this.setState({selectedConnection: c})}
+ initialConnection={this.state.selectedConnection} />
+ }
} />
- } />
+ } />
+ } />
+ } />
--
cgit v1.2.3-70-g09d2