Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.7.3 into main #94

Merged
merged 7 commits into from
Feb 22, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
- name: Run ESLint
run: yarn lint
- name: Run Prettier
run: yarn format --check
run: yarn format:check
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.7.3] - 2024-02-22

### Added

- Added buttons to reload sysinfo to agents pages
- Add info button on View tab to clarify what options do

### Changed

- Removed extra space being added in front of Task Input and Output by append/prepend new line
- Changed default sort on agents page to be "first seen" instead of "last seen"

## [2.7.2] - 2024-01-31

### Fixed
Expand Down Expand Up @@ -349,7 +361,9 @@ Including but not limited to:

- Initial Release

[Unreleased]: https://github.com/BC-SECURITY/Starkiller-Sponsors/compare/v2.7.2...HEAD
[Unreleased]: https://github.com/BC-SECURITY/Starkiller-Sponsors/compare/v2.7.3...HEAD

[2.7.3]: https://github.com/BC-SECURITY/Starkiller-Sponsors/compare/v2.7.2...v2.7.3

[2.7.2]: https://github.com/BC-SECURITY/Starkiller-Sponsors/compare/v2.7.1...v2.7.2

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "starkiller",
"version": "2.7.2",
"version": "2.7.3",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
"format": "prettier . --write"
"format": "prettier . --write",
"format:check": "prettier . --check"
},
"main": "background.js",
"dependencies": {
Expand Down
14 changes: 13 additions & 1 deletion src/components/ClickToEdit.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<template>
<v-row class="pb-5">
<v-col cols="4">
<v-col cols="4" class="d-flex align-center justify-start">
<span class="text--bold">{{ label }}</span>
<v-tooltip v-if="infoText" bottom>
<template #activator="{ on, attrs }">
<v-icon small class="ml-2" v-bind="attrs" v-on="on">
mdi-information-outline
</v-icon>
</template>
<span>{{ infoText }}</span>
</v-tooltip>
</v-col>
<v-col cols="6" :class="getColClass()" @click="clicked">
<template v-if="editing && editable">
Expand Down Expand Up @@ -116,6 +124,10 @@ export default {
type: [String, Number],
default: "",
},
infoText: {
type: String,
default: "",
},
dataType: {
type: String,
default: "string",
Expand Down
5 changes: 5 additions & 0 deletions src/components/agents/AgentForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<click-to-edit
v-model="form.listener"
label="Listener"
info-text="The listener to task the agent to use"
data-type="string"
:suggested-values="listeners.map((l) => l.name)"
:strict="true"
Expand All @@ -52,12 +53,14 @@
v-model="form.kill_date"
label="Kill Date"
data-type="date"
info-text="Date format: YYYY-MM-DD"
:editable="!readOnly"
@update="updateKillDate"
/>
<click-to-edit
v-model="form.working_hours"
label="Working Hours"
info-text="Format: 00:00-24:00"
:rules="workingHoursRules"
:editable="!readOnly"
@update="updateWorkingHours"
Expand All @@ -75,6 +78,7 @@
<click-to-edit
v-model="form.delay"
label="Delay"
info-text="Delay in seconds before the agent checks in"
data-type="number"
:rules="delayRules"
:editable="!readOnly"
Expand All @@ -83,6 +87,7 @@
<click-to-edit
v-model="form.jitter"
label="Jitter"
info-text="Randomness in delay as a decimal between 0 and 1"
data-type="number"
:rules="jitterRules"
:editable="!readOnly"
Expand Down
13 changes: 9 additions & 4 deletions src/components/agents/AgentTasksTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
show-expand
@update:options="handleOptionsChange"
>
<template #expanded-item="{ headers, item }">

Check warning on line 23 in src/components/agents/AgentTasksTable.vue

View workflow job for this annotation

GitHub Actions / lint

Variable 'headers' is already declared in the upper scope
<td :colspan="headers.length">
<div>
<div
Expand Down Expand Up @@ -62,9 +62,11 @@
"
>
{{
item.expandedInput
? expandedTasks[item.uniqueId].full_input
: item.input
addBlankLines(
item.expandedInput
? expandedTasks[item.uniqueId].full_input
: item.input,
)
}}
</p>
<p><b>Task Output:</b></p>
Expand Down Expand Up @@ -106,10 +108,10 @@
<!-- TODO Option for original output -->
<div
v-if="expandedTasks[item.uniqueId].htmlOutput"
v-html="expandedTasks[item.uniqueId].htmlOutput"

Check warning on line 111 in src/components/agents/AgentTasksTable.vue

View workflow job for this annotation

GitHub Actions / lint

'v-html' directive can lead to XSS attack
/>
<div v-else>
{{ item.output }}
{{ addBlankLines(item.output) }}
</div>
</div>
</div>
Expand Down Expand Up @@ -386,6 +388,9 @@
})
.catch((err) => this.$snack.error(`Error: ${err}`));
},
addBlankLines(text) {
return `\n${text}\n`;
},
addTag(task, tag) {
agentTaskApi
.addTag(task.agent_id, task.id, tag)
Expand Down
8 changes: 6 additions & 2 deletions src/components/agents/AgentTerminal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
:key="index"
:class="line.cssClasses"
style="white-space: pre-wrap"
v-html="ansiToHTML(line.content)"

Check warning on line 9 in src/components/agents/AgentTerminal.vue

View workflow job for this annotation

GitHub Actions / lint

'v-html' directive can lead to XSS attack
/>
</div>
<div class="terminal-input">
<span class="prompt" v-html="ansiToHTML(currentPrompt)" />

Check warning on line 13 in src/components/agents/AgentTerminal.vue

View workflow job for this annotation

GitHub Actions / lint

'v-html' directive can lead to XSS attack
<input
ref="inputField"
v-model="currentInput"
Expand Down Expand Up @@ -621,7 +621,10 @@
config = { print: true, attempts: 30, delay: 5000 },
) {
if (!config.attempts) config.attempts = 30;
if (!config.delay) config.delay = 5000;
if (!config.delay)
config.delay =
this.agent.delay != null ? this.agent.delay * 1000 : 5000;

let res = null;
let hasPrintedJobStarted = false;
let i = 0;
Expand Down Expand Up @@ -670,7 +673,7 @@
this.getDirectoryCommand(),
);

const complete = await this.pollForResult(response.id);
const complete = await this.pollForResult(response.id, { print: false });

if (complete) {
// eslint-disable-next-line prefer-destructuring
Expand All @@ -697,6 +700,7 @@

if (["cd", "set-location"].includes(stdin.toLowerCase().split(" ")[0])) {
this.updateCurrentDirectory();
return;
}

if (complete) {
Expand Down
20 changes: 19 additions & 1 deletion src/components/agents/AgentsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@
</v-list-item-title>
</v-list-item>
<v-divider class="pb-4" />
<v-list-item @click="reloadSysInfo(item)">
<v-list-item-title>
<v-icon>fa-sync</v-icon>
Reload SysInfo
</v-list-item-title>
</v-list-item>
<v-divider class="pb-4" />
<v-list-item key="delete" link @click="killAgent(item)">
<v-list-item-title>
<v-icon>fa-trash-alt</v-icon>
Expand All @@ -134,6 +141,7 @@ import TagViewer from "@/components/TagViewer.vue";
import * as agentApi from "@/api/agent-api";
import { useAgentStore } from "@/stores/agent-module";
import { useApplicationStore } from "@/stores/application-module";
import * as agentTaskApi from "@/api/agent-task-api";

export default {
name: "AgentsTable",
Expand Down Expand Up @@ -298,7 +306,7 @@ export default {
},
sortedAgents() {
let sorted = this.agents.slice();
sorted.sort((a, b) => -a.lastseen_time.localeCompare(b.lastseen_time));
sorted.sort((a, b) => a.checkin_time.localeCompare(b.checkin_time));
if (this.hideStaleAgents) {
sorted = sorted.filter((agent) => !agent.stale);
}
Expand Down Expand Up @@ -388,6 +396,16 @@ export default {
getAgents() {
this.agentStore.getAgents();
},
async reloadSysInfo(agent) {
try {
await agentTaskApi.sysinfo(agent.session_id);
this.$snack.success(`SysInfo reload queued for ${agent.name}`);
} catch (error) {
this.$snack.error(
`Error reloading SysInfo for ${agent.name}: ${error.message}`,
);
}
},
async killAgent(item) {
this.$emit("kill-agent", item);
},
Expand Down
15 changes: 9 additions & 6 deletions src/components/plugins/PluginTasksTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
show-expand
@update:options="handleOptionsChange"
>
<template #expanded-item="{ headers, item }">

Check warning on line 23 in src/components/plugins/PluginTasksTable.vue

View workflow job for this annotation

GitHub Actions / lint

Variable 'headers' is already declared in the upper scope
<td :colspan="headers.length">
<div>
<div
Expand Down Expand Up @@ -62,9 +62,11 @@
"
>
{{
item.expandedInput
? expandedTasks[item.uniqueId].full_input
: item.input
addBlankLines(
item.expandedInput
? expandedTasks[item.uniqueId].full_input
: item.input,
)
}}
</p>
<p><b>Task Output:</b></p>
Expand Down Expand Up @@ -106,11 +108,9 @@
<!-- TODO Option for original output -->
<div
v-if="expandedTasks[item.uniqueId].htmlOutput"
v-html="expandedTasks[item.uniqueId].htmlOutput"

Check warning on line 111 in src/components/plugins/PluginTasksTable.vue

View workflow job for this annotation

GitHub Actions / lint

'v-html' directive can lead to XSS attack
/>
<div v-else>
{{ item.output }}
</div>
<div v-else>addBlankLines(item.output)</div>
</div>
</div>
</td>
Expand Down Expand Up @@ -349,6 +349,9 @@
ansiToHtml(output) {
return new AnsiUp().ansi_to_html(output);
},
addBlankLines(text) {
return `\n${text}\n`;
},
deleteTag(task, tag) {
pluginApi
.deleteTag(task.plugin_id, task.id, tag.id)
Expand Down
17 changes: 16 additions & 1 deletion src/views/AgentEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
v-model="isRefreshTasks"
icon="fa-redo"
:button-text="isRefreshTasks ? 'On' : 'Off'"
text="Auto-refresh tasks"
text="Auto-refresh Tasks"
/>
<tooltip-button
icon="fa-calendar-times"
Expand Down Expand Up @@ -107,6 +107,11 @@
text="Unsubscribe from Notifications"
@click="unsubscribe"
/>
<tooltip-button
icon="fa-sync"
text="Reload SysInfo"
@click="reloadSysInfo"
/>
<tooltip-button
v-if="initialized && !archived"
icon="fa-trash-alt"
Expand Down Expand Up @@ -372,6 +377,16 @@ export default {
unsubscribe() {
this.agentStore.unsubscribe({ sessionId: this.id });
},
async reloadSysInfo() {
try {
await agentTaskApi.sysinfo(this.agent.session_id);
this.$snack.success(`SysInfo reload queued for ${this.agent.name}`);
} catch (error) {
this.$snack.error(
`Error reloading SysInfo for ${this.agent.name}: ${error.message}`,
);
}
},
toggleCollapsePane() {
if (this.paneSize > 95) {
this.paneSize = 50;
Expand Down
2 changes: 1 addition & 1 deletion src/views/PluginEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
v-model="isRefreshTasks"
icon="fa-redo"
:button-text="isRefreshTasks ? 'On' : 'Off'"
text="Auto-refresh tasks"
text="Auto-refresh Tasks"
/>
</template>
</edit-page-top>
Expand Down
Loading