From ef16e26aa6e95f8534e25926df6b4a95a008cde8 Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Mon, 25 Apr 2022 14:25:22 +0200 Subject: Move ScanDetail to ScanView Since ScanView did not really do anything by itself --- src/components/ScanDetail.js | 153 ------------------------------------------- src/components/ScanView.js | 148 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 146 insertions(+), 155 deletions(-) delete mode 100644 src/components/ScanDetail.js (limited to 'src') diff --git a/src/components/ScanDetail.js b/src/components/ScanDetail.js deleted file mode 100644 index c489397..0000000 --- a/src/components/ScanDetail.js +++ /dev/null @@ -1,153 +0,0 @@ -import React from "react"; - -import Alert from "@mui/material/Alert"; -import Button from "@mui/material/Button"; -import Card from "@mui/material/Card"; -import Tooltip from "@mui/material/Tooltip"; - -import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; - -import dateFormat from "dateformat"; - -import { resultClassName } from "../util"; - -class ScanDetail extends React.Component { - render() { - return ( - -
- #{this.props._id} -
-

General info

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Domain{this.props.domain}
Endpoint{`${this.props.ip}:${this.props.port}`}
Hostname{this.props.ptr}
Owner{this.props.whois_description}
ASN{`${this.props.asn} (${this.props.asn_country_code})`}
Abuse mail{this.props.abuse_mail}
- - {this.props.description && ( - <> -
- {this.props.description} - - )} - -

Custom info

- - -

-
- Latest scan:     - {dateFormat( - this.props.timestamp_in_utc, - "isoUtcDateTime" - )} -
-
- -
-

- -
- {Object.entries(this.props.result) - // Sort by vulnerable, investigation_needed, reliability, name - .sort((a, b) => - a[1].display_name > b[1].display_name ? -1 : 1 - ) - .sort((a, b) => - a[1].reliability < b[1].reliability ? -1 : 1 - ) - .sort((a, b) => - a[1].vulnerable || a[1].investigation_needed - ? -1 - : 1 - ) - .sort((a, b) => (a[1].vulnerable ? -1 : 1)) - .map(([id, res]) => ( - - ))} -
-
- ); - } -} - -function Custom(props) { - return ( - - - {Object.entries(props).map( - ([key, { data, display_name, description }]) => ( - - ) - )} - -
- ); -} - -function CustomElement(props) { - return ( - - {props.display_name} - {props.data.toString()} - {props.description} - - ); -} - -function Result(props) { - return ( -
- - {props.display_name} - {props.description && ( - - - - )} - - {(props.vulnerable || props.investigation_needed) && ( - - {props.reliability} - - )} -
- ); -} - -export default ScanDetail; diff --git a/src/components/ScanView.js b/src/components/ScanView.js index a289cf7..4efb209 100644 --- a/src/components/ScanView.js +++ b/src/components/ScanView.js @@ -1,6 +1,15 @@ import React from "react"; -import ScanDetail from "./ScanDetail"; +import Alert from "@mui/material/Alert"; +import Button from "@mui/material/Button"; +import Card from "@mui/material/Card"; +import Tooltip from "@mui/material/Tooltip"; + +import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; + +import dateFormat from "dateformat"; + +import { resultClassName } from "../util"; class ScanView extends React.Component { constructor(props) { @@ -47,9 +56,144 @@ class ScanView extends React.Component { render() { return this.state.object === null ? null : ( - + +
+ + #{this.state.object._id} + +
+

General info

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Domain{this.state.object.domain}
Endpoint{`${this.state.object.ip}:${this.props.port}`}
Hostname{this.state.object.ptr}
Owner{this.state.object.whois_description}
ASN{`${this.state.object.asn} (${this.props.asn_country_code})`}
Abuse mail{this.state.object.abuse_mail}
+ + {this.state.object.description && ( + <> +
+ + {this.state.object.description} + + + )} + +

Custom info

+ + +

+
+ Latest scan:     + {dateFormat( + this.state.object.timestamp_in_utc, + "isoUtcDateTime" + )} +
+
+ +
+

+ +
+ {Object.entries(this.state.object.result) + // Sort by vulnerable, investigation_needed, reliability, name + .sort((a, b) => + a[1].display_name > b[1].display_name ? -1 : 1 + ) + .sort((a, b) => + a[1].reliability < b[1].reliability ? -1 : 1 + ) + .sort((a, b) => + a[1].vulnerable || a[1].investigation_needed + ? -1 + : 1 + ) + .sort((a, b) => (a[1].vulnerable ? -1 : 1)) + .map(([id, res]) => ( + + ))} +
+
); } } +function Custom(props) { + return ( + + + {Object.entries(props).map( + ([key, { data, display_name, description }]) => ( + + ) + )} + +
+ ); +} + +function CustomElement(props) { + return ( + + {props.display_name} + {props.data.toString()} + {props.description} + + ); +} + +function Result(props) { + return ( +
+ + {props.display_name} + {props.description && ( + + + + )} + + {(props.vulnerable || props.investigation_needed) && ( + + {props.reliability} + + )} +
+ ); +} + export default ScanView; -- cgit v1.1