Skip to content

Commit

Permalink
Added Agent Terminal (#161)
Browse files Browse the repository at this point in the history
* Added agent terminal tab

* added sysinfo

* added ps and shell

* fixed formatting and added sc

* added basic module selection

* changed window formatting

* fixed up and down keys

* added color top module name, description, and options

* error when executing module

* add a try-catch

* updated module output for terminal

* Shifted responses in on the terminal.

* Updated coloring to ansi

* Fixed color for module options and description

* Added autocomplete for modules

* fixed tasking results returned

* Added sherlock

* removed unused null on execute command

* added socks command

* added localstorage for saving history of commands

* adjusted window size

* updated localstorage to be by agent

* updated localstorage to be by agent

* Updated colors to match

* Revert "Updated colors to match"

This reverts commit 290b367fa1fc5ec7b1f680c8843796c1f7daf1e0.

* Reverted changes to resolve printing issues.

* Updated colors to match ansi

* Updated colors to match ansi

* removed comments and ran lint

* Update src/components/agents/AgentTerminal.vue

Co-authored-by: Vincent Rose <[email protected]>

* added back function

* added suggestions for module options

* added sleep and jitter command

* removed extra space

* made changes for lint and vinnybod

* added help menu of modules

* removed ability to run main menu commmands from module menu

* add back and clear to help menu

* added autocomplete to unset and removed caps requirement

* fixed suggestions to work with modules

* allow scaling height with window size

* update to disallow changing agent option in modules

* cleaned up lint errors

* rm npm lockfile

* initial suggestions

* cleanup

* use green

* validate required fields are set

* updated handling of error and info messages

* updated arrow pointer to list icon

* css updates

* add shell menu

* Apply suggestions from code review

* changelog

---------

Co-authored-by: Vince Rose <[email protected]>
  • Loading branch information
Cx01N and vinnybod authored Sep 13, 2023
1 parent fbd35b0 commit f81a83f
Show file tree
Hide file tree
Showing 12 changed files with 1,415 additions and 445 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.exports = {
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
}],
'prefer-destructuring': ['error', { object: true, array: false }],
},
settings: {
...createAliasSetting({
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Add an Agent terminal to the Interact tab

## [2.5.3] - 2023-08-24

- Fix elevated process icon on agent page
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"semver": "^7.3.5",
"socket.io-client": "^4.1.2",
"splitpanes": "^2.3.8",
"table": "^6.8.1",
"uuid": "^8.3.2",
"vue": "2.7",
"vue-beautiful-chat": "^2.5.0",
Expand Down
8 changes: 8 additions & 0 deletions src/api/agent-task-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ export function shell(sessionId, command, literal = false) {
.catch((error) => Promise.reject(handleError(error)));
}

export function createSocksProxy(sessionId, portNumber) {
return axios.post(`/agents/${sessionId}/tasks/socks`, {
port: portNumber,
})
.then(({ data }) => data)
.catch((error) => Promise.reject(handleError(error)));
}

/**
* Task an agent to run sysinfo.
* @param {*} sessionId agent sessionId
Expand Down
36 changes: 33 additions & 3 deletions src/components/agents/AgentForm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template>
<div style="padding: 10px">
<tag-viewer
:tags="agent.tags"
@update-tag="updateTag"
@delete-tag="deleteTag"
@new-tag="addTag"
/>
<v-form
v-if="agent.session_id"
ref="form"
Expand Down Expand Up @@ -133,13 +139,15 @@

<script>
import Vue from 'vue';
import moment from 'moment';
import { mapState } from 'vuex';
import moment from 'moment';
import TagViewer from '@/components/TagViewer.vue';
import ClickToEdit from '@/components/ClickToEdit.vue';
import * as agentTaskApi from '@/api/agent-task-api';
import ClickToEdit from '../ClickToEdit.vue';
import * as agentApi from '@/api/agent-api';
export default {
components: { ClickToEdit },
components: { TagViewer, ClickToEdit },
props: {
/**
* The agent object to populate the form fields.
Expand Down Expand Up @@ -229,6 +237,28 @@ export default {
this.$store.dispatch('listener/getListeners');
},
methods: {
deleteTag(tag) {
agentApi.deleteTag(this.agent.session_id, tag.id)
.then(() => {
this.$emit('refresh-agent');
})
.catch((err) => this.$snack.error(`Error: ${err}`));
},
updateTag(tag) {
agentApi.updateTag(this.agent.session_id, tag)
.then(() => {
this.$emit('refresh-agent');
this.$snack.success('Tag updated');
})
.catch((err) => this.$snack.error(`Error: ${err}`));
},
addTag(tag) {
agentApi.addTag(this.agent.session_id, tag)
.then(() => {
this.$emit('refresh-agent');
})
.catch((err) => this.$snack.error(`Error: ${err}`));
},
async updateName() {
if (this.agent.name === this.form.name) return;
Expand Down
2 changes: 0 additions & 2 deletions src/components/agents/AgentTasksTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,7 @@ export default {
this.itemsPerPage = value.itemsPerPage;
if (value.sortBy.length > 0) {
// eslint-disable-next-line prefer-destructuring
this.sortBy = value.sortBy[0];
// eslint-disable-next-line prefer-destructuring
this.sortDesc = value.sortDesc[0];
} else {
this.sortBy = 'id';
Expand Down
Loading

0 comments on commit f81a83f

Please sign in to comment.