Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tavern/internal/www/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.ab02b817.css",
"main.js": "/static/js/main.09054de2.js",
"main.js": "/static/js/main.526613b8.js",
"react-syntax-highlighter/refractor-core-import.js": "/static/js/react-syntax-highlighter/refractor-core-import.d0cd1e85.chunk.js",
"react-syntax-highlighter_languages_refractor_abap.js": "/static/js/react-syntax-highlighter_languages_refractor_abap.a2bf84e3.chunk.js",
"react-syntax-highlighter_languages_refractor_actionscript.js": "/static/js/react-syntax-highlighter_languages_refractor_actionscript.fff5a604.chunk.js",
Expand Down Expand Up @@ -158,7 +158,7 @@
"static/media/eldrich.png": "/static/media/eldrich.a80c74e8249d2461e174.png",
"index.html": "/index.html",
"main.ab02b817.css.map": "/static/css/main.ab02b817.css.map",
"main.09054de2.js.map": "/static/js/main.09054de2.js.map",
"main.526613b8.js.map": "/static/js/main.526613b8.js.map",
"refractor-core-import.d0cd1e85.chunk.js.map": "/static/js/react-syntax-highlighter/refractor-core-import.d0cd1e85.chunk.js.map",
"react-syntax-highlighter_languages_refractor_abap.a2bf84e3.chunk.js.map": "/static/js/react-syntax-highlighter_languages_refractor_abap.a2bf84e3.chunk.js.map",
"react-syntax-highlighter_languages_refractor_actionscript.fff5a604.chunk.js.map": "/static/js/react-syntax-highlighter_languages_refractor_actionscript.fff5a604.chunk.js.map",
Expand Down Expand Up @@ -315,6 +315,6 @@
},
"entrypoints": [
"static/css/main.ab02b817.css",
"static/js/main.09054de2.js"
"static/js/main.526613b8.js"
]
}
2 changes: 1 addition & 1 deletion tavern/internal/www/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Tavern - Red Team Engagement Platform</title><script defer="defer" src="/static/js/main.09054de2.js"></script><link href="/static/css/main.ab02b817.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Tavern - Red Team Engagement Platform</title><script defer="defer" src="/static/js/main.526613b8.js"></script><link href="/static/css/main.ab02b817.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1 change: 0 additions & 1 deletion tavern/internal/www/build/static/js/main.09054de2.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tavern/internal/www/build/static/js/main.526613b8.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import {Heading} from "@chakra-ui/react";
import Select, { createFilter } from "react-select"
import { BeaconType, TomeTag } from "../../utils/consts";
import { SupportedPlatforms } from "../../utils/enums";

type Props = {
setFiltersSelected: (arg1: any) => void;
Expand All @@ -11,9 +12,20 @@ type Props = {
}
export const BeaconFilterBar = (props: Props) => {
const {setFiltersSelected, beacons, groups, services} = props;
const supportedPlatformsList = Object.values(SupportedPlatforms);

const getFormattedOptions = (beacons: Array<BeaconType>, groups: Array<TomeTag>, services: Array<TomeTag>) => {
return [
{
label: "Platform",
options: supportedPlatformsList.map(function(platform: string){
return {
value: platform,
label: platform,
kind: "platform"
};
})
},
{
label: "Service",
options: services.map(function(service: TomeTag){
Expand Down Expand Up @@ -51,7 +63,7 @@ export const BeaconFilterBar = (props: Props) => {

return (
<div>
<Heading size="sm" mb={2}> Filter by service, group, and beacon</Heading>
<Heading size="sm" mb={2}> Filter by platform, service, group, and beacon</Heading>
<Select
isSearchable={true}
isMulti
Expand Down
23 changes: 3 additions & 20 deletions tavern/internal/www/src/components/beacon-option/BeaconOption.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { Text, Stack, StackItem, Card, CardBody, Checkbox, Flex, Badge } from "@chakra-ui/react";
import { Card, CardBody, Checkbox } from "@chakra-ui/react";
import BeaconTile from "../BeaconTile";

export function areEqual(prevProps: any, nextProps: any) {
const beacon = prevProps.beaconsToDisplay[prevProps.index];
Expand All @@ -19,32 +20,14 @@ export const BeaconOption = (props: Props) => {
const {index, style, beaconsToDisplay, toggleCheck, beaconsSelected } = props;
// Your card component goes here
const beacon = beaconsToDisplay[index];
const group = (beacon?.host?.tags).find( (obj : any) => {
return obj?.kind === "group"
});
const service = (beacon?.host?.tags).find( (obj : any) => {
return obj?.kind === "service"
});
const isChecked = beaconsSelected[beacon.id];

return (
<div style={style} key={`beacon_option_${beacon.id}`}>
<Card>
<CardBody>
<Checkbox colorScheme={"purple"} size="lg" isChecked={isChecked} onChange={()=> toggleCheck(beacon.id)}>
<Stack ml={4} w={"xl"}>
<StackItem>
<Text fontSize={"md"}>{beacon.name}</Text>
</StackItem>
<StackItem>
<Flex direction="row" wrap={"wrap"} gap={2}>
{group?.name && <Badge>{group?.name}</Badge>}
{service?.name && <Badge>{service?.name}</Badge>}
{beacon?.host?.primaryIP && <Badge>{beacon?.host?.primaryIP}</Badge>}
{beacon?.principal && <Badge>{beacon?.principal}</Badge>}
</Flex>
</StackItem>
</Stack>
<BeaconTile beaconData={beacon} />
</Checkbox>
</CardBody>
</Card>
Expand Down
23 changes: 13 additions & 10 deletions tavern/internal/www/src/context/TagContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@ export const TagContextProvider = ({children}: {children: React.ReactNode}) => {
kind
},
beacons {
id
name
principal
host{
id
name
primaryIP
tags {
id
kind
principal
lastSeenAt
interval
host{
name
}
primaryIP
platform
tags {
id
kind
name
}
}
}
}
}
`;
const PARAMS = {
Expand Down
15 changes: 14 additions & 1 deletion tavern/internal/www/src/hooks/useBeaconFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export const useBeaconFilter = (beacons: Array<BeaconType>, selectedBeacons: any
if(currentValue.kind === "beacon"){
accumulator.beacon.push(currentValue.value);
}
else if(currentValue.kind === "platform"){
accumulator.platform.push(currentValue.value);
}
else if(currentValue.kind === "service"){
accumulator.service.push(currentValue.value);
}
Expand All @@ -25,7 +28,8 @@ export const useBeaconFilter = (beacons: Array<BeaconType>, selectedBeacons: any
{
"beacon": [],
"service": [],
"group": []
"group": [],
"platform": []
});
};

Expand Down Expand Up @@ -75,6 +79,15 @@ export const useBeaconFilter = (beacons: Array<BeaconType>, selectedBeacons: any
}
}

if(searchTypes.platform.length > 0){
if(searchTypes.platform.indexOf(beacon?.host?.platform) > -1){
match = true;
}
else{
return false;
}
}

return match;
});
},[typeFilters]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const QuestForm = () => {
const {submitQuest, loading, error, reset} = useSubmitQuest();

const steps = [
{ name: 'Select a tome', description: 'Step 1', href: '#', step: 0 },
{ name: 'Select agent beacons', description: 'Step 2', href: '#', step: 1 },
{ name: 'Select agent beacons', description: 'Step 1', href: '#', step: 0 },
{ name: 'Select a tome', description: 'Step 2', href: '#', step: 1 },
];

const formik = useFormik({
Expand All @@ -27,9 +27,9 @@ export const QuestForm = () => {
function getStepView(step: number){
switch(step) {
case 0:
return <SelectTome setCurrStep={setCurrStep} formik={formik} />
case 1:
return <SelectBeacons setCurrStep={setCurrStep} formik={formik} />
case 1:
return <SelectTome setCurrStep={setCurrStep} formik={formik} />
default:
return <div>An error has occured</div>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const SelectBeacons = (props: Props) => {
}
}
formik.setFieldValue('beacons', beaconToSubmit);
formik.handleSubmit();
setCurrStep(1);
}

return (
Expand All @@ -45,22 +45,12 @@ export const SelectBeacons = (props: Props) => {
<BeaconView beacons={data?.beacons || []} groups={data?.groupTags || []} services={data?.serviceTags || []} selectedBeacons={selectedBeacons} setSelectedBeacons={setSelectedBeacons} />
)}
<div className="flex flex-row gap-2">
<button
className="inline-flex items-center rounded-md bg-gray-50 py-3 px-4 text-sm font-semibold text-purple-600 shadow-sm hover:bg-purple-100"
onClick={()=> setCurrStep(0)}
>
Back
</button>
<button
className="btn-primary"
onClick={(event) => {
event.preventDefault();
handleClickContinue(selectedBeacons);
}}
onClick={() => handleClickContinue(selectedBeacons)}
disabled={!hasBeaconSelected}
type="submit"
>
Submit
Continue
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const GET_TOMES = gql`

export const SelectTome = (props: Props) => {
const { loading, error, data } = useQuery(GET_TOMES);
const step = 0;
const { setCurrStep, formik } = props;

const handleSelectTome = (tome: Tome) => {
Expand All @@ -38,12 +37,6 @@ export const SelectTome = (props: Props) => {
formik.setFieldValue('name', name);
}

// PARAM-DEFS FORMAT: JSON STRING List<TomeParams>: '[ {"name": "blah", ... } ]'
// * This is what is defined on a tome
//
// PARAMS SUBMITTED FOR CREATE QUEST FORMAT: JSON STRING Dict<string, string>: '{"blah": "some value"}'
// * This is what is submitted for creating a quest

const hasAllParamsSet = formik?.values?.params.filter((param: TomeParams) => {
return param?.value && param?.value !== "";
});
Expand Down Expand Up @@ -79,12 +72,22 @@ export const SelectTome = (props: Props) => {
})}

<div className="flex flex-row gap-2">
<button
className="inline-flex items-center rounded-md bg-gray-50 py-3 px-4 text-sm font-semibold text-purple-600 shadow-sm hover:bg-purple-100"
onClick={()=> setCurrStep(0)}
>
Back
</button>
<button
className="btn-primary"
onClick={() => setCurrStep(step + 1)}
onClick={(event) => {
event.preventDefault();
formik.handleSubmit();
}}
disabled={isContinueDisabled}
type="submit"
>
Continue
Submit
</button>
</div>
</div>
Expand Down
11 changes: 6 additions & 5 deletions tavern/internal/www/src/pages/tasks/FilterBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@apollo/client";
import React from "react"
import Select from 'react-select';
import { SupportedPlatforms } from "../../utils/enums";

import { GET_SEARCH_FILTERS } from "../../utils/queries";
import FreeTextSearch from "./FreeTextSearch";
Expand All @@ -22,11 +23,11 @@ const FilterBar = (props: Props) => {
}
}
const platformEnum = [
{ value: 'Windows', label: 'Windows' },
{ value: 'Linux', label: 'Linux' },
{ value: 'MacOS', label: 'MacOS' },
{ value: 'BSD', label: 'BSD' },
{ value: 'Unknown', label: 'Unknown' }
{ value: SupportedPlatforms.Windows, label: SupportedPlatforms.Windows },
{ value: SupportedPlatforms.Linux, label: SupportedPlatforms.Linux },
{ value: SupportedPlatforms.MacOS, label: SupportedPlatforms.MacOS },
{ value: SupportedPlatforms.BSD, label: SupportedPlatforms.BSD},
{ value: SupportedPlatforms.Unknown, label: SupportedPlatforms.Unknown }
];
const { data, loading, error } = useQuery(GET_SEARCH_FILTERS, PARAMS);

Expand Down
44 changes: 22 additions & 22 deletions tavern/internal/www/src/pages/tasks/useTasks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NetworkStatus, useQuery } from "@apollo/client";
import { useQuery } from "@apollo/client";
import { useCallback, useEffect, useState } from "react";
import { GET_TASK_QUERY } from "../../utils/queries";

Expand All @@ -16,41 +16,41 @@ export const useTasks = (defaultQuery?: TASK_PAGE_TYPE, id?: string) => {
const [hosts, setHosts] = useState<Array<string>>([]);
const [platforms, setPlatforms] = useState<Array<string>>([]);

const constructDefaultQuery = useCallback((searchText: string) => {
const constructDefaultQuery = useCallback((searchText?: string) => {
const query = {
"where": {
"and": [] as Array<any>
}
};
switch(defaultQuery){
case TASK_PAGE_TYPE.questIdQuery:
return {
"where": {
"and": [
{"hasQuestWith": {"id": id}},
{"outputContains": searchText},
]
}
};
const include = [{"hasQuestWith": {"id": id}}] as Array<any>;

if(searchText){include.push({"outputContains": searchText})};

query.where.and = include;
break;
case TASK_PAGE_TYPE.questDetailsQuery:
default:
return {
"where": {
"and": [
{
const text = searchText || "";
query.where.and = [{
"or": [
{"outputContains": searchText},
{"outputContains": text},
{"hasQuestWith": {
"nameContains": searchText
"nameContains": text
}
},
{"hasQuestWith":
{"hasTomeWith": {"nameContains": searchText}}}
{"hasTomeWith": {"nameContains": text}}}
]
},
]
}
};
}];
break;
}
return query;
},[defaultQuery, id]);

// get tasks
const { loading, error, data, refetch} = useQuery(GET_TASK_QUERY, {variables: constructDefaultQuery(""), notifyOnNetworkStatusChange: true});
const { loading, error, data, refetch} = useQuery(GET_TASK_QUERY, {variables: constructDefaultQuery(), notifyOnNetworkStatusChange: true});

const updateTaskList = useCallback(() => {
let fq = constructDefaultQuery(search) as any;
Expand Down
2 changes: 2 additions & 0 deletions tavern/internal/www/src/utils/consts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { string } from "yup";
import { SupportedPlatforms } from "./enums";

export type FormStep = {
name: string;
Expand Down Expand Up @@ -29,6 +30,7 @@ export type HostType = {
id: string;
name: string;
primaryIP: string;
platform: SupportedPlatforms;
tags: Array<TomeTag>;
}
export type BeaconType = {
Expand Down
Loading