Skip to content

Commit

Permalink
Merge pull request #47 from target/customize-baseurl-path
Browse files Browse the repository at this point in the history
Adding Draft for Initial Testing
  • Loading branch information
phutelmyer authored Sep 8, 2023
2 parents dfaba48 + 712370e commit c20bb6e
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 28 deletions.
10 changes: 9 additions & 1 deletion app/blueprints/strelka.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,15 @@ def get_yara_hits(response: list) -> list:
yarahits = set()

for r in response:
for yarahit in r["scan"]["yara"]["matches"]:
matches = (r
.get("scan", {})
.get("yara", {})
.get("matches"))

if not isinstance(matches, list):
continue

for yarahit in matches:
yarahits.add(yarahit)
return list(yarahits)

Expand Down
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "ui",
"version": "0.1.0",
"private": true,
"homepage": ".",
"dependencies": {
"@ant-design/pro-form": "^1.69.4",
"@ant-design/pro-layout": "^6.38.9",
Expand Down
3 changes: 3 additions & 0 deletions ui/public/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
window.appConfig = {
baseUrl: '/strelkaui' // Change this to modify the base_url to be used as a prefix to routes.
};
1 change: 1 addition & 0 deletions ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script src="%PUBLIC_URL%/config.js"></script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
20 changes: 11 additions & 9 deletions ui/src/App.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React, { Component } from 'react';
import './App.css';
import React, { Component } from "react";
import "./App.css";

import { BrowserRouter } from 'react-router-dom'
import MainRouter from './routes/MainRouter'
import AuthenticationProvider from './providers/AuthProvider';
import { BrowserRouter } from "react-router-dom";
import MainRouter from "./routes/MainRouter";
import AuthenticationProvider from "./providers/AuthProvider";

class App extends Component {
const baseUrl = window.appConfig ? window.appConfig.baseUrl : "/";

class App extends Component {
render() {
return (
<div className="App">
<AuthenticationProvider>
<BrowserRouter>
<MainRouter/>
<BrowserRouter basename={baseUrl}>
<MainRouter />
</BrowserRouter>
</AuthenticationProvider>
</div>
);
}
}

export default App;
export default App;
19 changes: 12 additions & 7 deletions ui/src/components/SubmissionTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,18 @@ const SubmissionTable = ({ filesUploaded, page_size }) => {
width: 200,
render: (mime_types) => <TagSet items={mime_types} />,
},
{
title: "YARA Hits",
dataIndex: "yara_hits",
key: "yara_hits",
width: 200,
render: (yara_hits) => <TagSet items={yara_hits} />,
},
{
title: "YARA Hits",
dataIndex: "yara_hits",
key: "yara_hits",
width: 200,
render: (yara_hits = []) => {
if (!Array.isArray(yara_hits) || yara_hits.length === 0) {
return "No YARA Hits";
}
return <TagSet items={yara_hits} />;
},
},
{
title: "Scanners Run",
key: "scanners_run",
Expand Down
27 changes: 16 additions & 11 deletions ui/src/pages/SubmissionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,22 @@ const SubmissionsPage = (props) => {
})}
</div>
</Descriptions.Item>
<Descriptions.Item label="YARA Hits">
<div>
{data?.strelka_response[0]?.scan?.[
"scan_yara" in data.strelka_response[0] ? "scan_yara" : "yara"
].matches.map((type) => (
<Tag style={{ marginBottom: "4px" }} key={type}>
{type}
</Tag>
))}
</div>
</Descriptions.Item>
<Descriptions.Item label="YARA Hits">
<div>
{
data?.strelka_response?.[0]?.scan &&
(
"scan_yara" in data.strelka_response[0]
? data.strelka_response[0].scan.scan_yara
: data.strelka_response[0].scan.yara
)?.matches?.map((type, index) => (
<Tag style={{ marginBottom: "4px" }} key={type + '-' + index}>
{type}
</Tag>
))
}
</div>
</Descriptions.Item>
</Descriptions>
</PageHeader>

Expand Down

0 comments on commit c20bb6e

Please sign in to comment.