Skip to content

Commit ce1b932

Browse files
feat[frontend](agent-console): added shell switch for windows agents (powershell or cmd)
1 parent 2cf64e0 commit ce1b932

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
lines changed

frontend/src/app/shared/components/utm/util/utm-agent-console/utm-agent-console.component.html

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@
66
<div class="window-agent d-flex flex-column">
77
<!-- Header -->
88
<div class="command-header py-3 d-flex justify-content-between align-items-center">
9-
<span *ngIf="agent"
10-
[ngClass]="agent.status === agentStatusEnum.ONLINE ? 'text-success-800' : 'text-warning-800'"
11-
class="span-small-icon d-flex justify-content-start align-items-center ml-3">
12-
<i [ngClass]="'icon-circle2'" class="mr-2"></i>
13-
{{ agent.hostname }} ({{ agent.os }})
14-
</span>
9+
<div class="d-flex align-items-center">
10+
<span *ngIf="agent"
11+
[ngClass]="agent.status === agentStatusEnum.ONLINE ? 'text-success-800' : 'text-warning-800'"
12+
class="span-small-icon d-flex justify-content-start align-items-center ml-3">
13+
<i [ngClass]="'icon-circle2'" class="mr-2"></i>
14+
{{ agent.hostname }} ({{ agent.os }})
15+
</span>
16+
17+
<select *ngIf="agent && agent.os && agent.os.toLowerCase().includes('windows')"
18+
[(ngModel)]="websocketCommand.shell"
19+
class="ml-2 shell-select">
20+
<option value="cmd">cmd</option>
21+
<option value="powershell">powershell</option>
22+
</select>
23+
</div>
1524

1625
<button *ngIf="template === 'default'"
1726
(click)="closeConsole()"

frontend/src/app/shared/components/utm/util/utm-agent-console/utm-agent-console.component.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@
6969

7070
.command-header {
7171
background: #C6C6C6;
72+
73+
.shell-select {
74+
border: 1px solid #999;
75+
border-radius: 3px;
76+
font-size: 11px;
77+
background-color: #f8f8f8;
78+
color: #333;
79+
padding: 0 4px;
80+
height: 22px;
81+
cursor: pointer;
82+
83+
&:focus {
84+
outline: none;
85+
border-color: #666;
86+
}
87+
}
7288
}
7389

7490
.h-450px {

frontend/src/app/shared/components/utm/util/utm-agent-console/utm-agent-console.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class UtmAgentConsoleComponent implements OnInit, OnChanges, AfterViewIni
8080
this.agent = null;
8181
this.consoleSignal = `➜#`;
8282
this.websocketCommand.command = '';
83+
this.websocketCommand.shell = 'cmd';
8384
this.authorize = false;
8485
this.token = null;
8586
this.command = null;

frontend/src/app/shared/types/incident/incident-command.type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export class IncidentCommandType {
33
originType: string;
44
originId: string;
55
reason: string;
6+
shell?:string
67
}

frontend/tslint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@
7373
"directive-class-suffix": true
7474
}
7575
}
76+

0 commit comments

Comments
 (0)