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
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ export class NetScanType {
registeredMode: AssetDiscoveryTypeEnum;
agent: boolean;
dataInputList: UtmDataInputStatus[];
assetOsPlatform?: string;
assetOsMinorVersion?: string;
assetOsMajorVersion?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,28 @@
[agent]="agent"
[asset]="asset">
</app-utm-agent-detail>
<div class="form-group mt-3" *ngIf="hasNoReason">
<div class="form-group mt-3" *ngIf="hasNoReason && agent.status === 'ONLINE'">
<label for="reportDesc">Provide the reason to run a command in the agent</label>
<textarea class="form-control" [(ngModel)]="websocketCommand.reason" id="reportDesc"
rows="3"></textarea>
</div>

<div class="d-flex justify-content-end">
<div *ngIf="agent.status === 'ONLINE'" class="d-flex justify-content-end">
<button class="btn utm-button utm-button-primary" (click)="connectToAgent = true"
[disabled]="!websocketCommand.reason && websocketCommand.reason === ''">
<i class="icon-terminal mr-1"></i>
Connect to console
</button>
</div>
</div>
<div class="alert alert-warning alert-styled-right mt-3 alert-dismissible">
<div *ngIf="agent.status === 'ONLINE'" class="alert alert-warning alert-styled-right mt-3 alert-dismissible">
<span class="font-weight-semibold">Warning! </span>
<span>You can cause damage to the infrastructure and services of your organization</span>
</div>
<div *ngIf="agent.status === 'OFFLINE'" class="alert alert-info alert-styled-right mt-3 info-dismissible">
<span class="font-weight-semibold">Info! </span>
<span>Offline agent, data based on the last sync.</span>
</div>
<app-utm-agent-console *ngIf="agent && connectToAgent" [websocketCommand]="websocketCommand"
(close)="connectToAgent = false"
[hostname]="agent.hostname"></app-utm-agent-console>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Component, Input, OnInit} from '@angular/core';
import {NetScanType} from '../../../../../assets-discover/shared/types/net-scan.type';
import {UtmAgentManagerService} from '../../../../services/agent/utm-agent-manager.service';
import {AgentType} from '../../../../types/agent/agent.type';
import {AgentStatusEnum, AgentType} from '../../../../types/agent/agent.type';
import {IncidentCommandType} from '../../../../types/incident/incident-command.type';
import {NetScanType} from "../../../../../assets-discover/shared/types/net-scan.type";

@Component({
selector: 'app-utm-agent-connect',
Expand All @@ -25,7 +25,8 @@ export class UtmAgentConnectComponent implements OnInit {
if (this.hostname) {
this.agentManagerService.getAgent(this.hostname).subscribe(response => {
this.agent = response.body;
});
},
error => this.assetTypeToAgentType());
}
}

Expand All @@ -34,4 +35,23 @@ export class UtmAgentConnectComponent implements OnInit {
this.hasNoReason = true;
this.agent = $event;
}

assetTypeToAgentType() {
this.agent = {
ip: this.asset.assetIp,
hostname: this.asset.assetName,
os: this.asset.assetOs,
status: AgentStatusEnum.OFFLINE,
platform: this.asset.assetOsPlatform,
version: this.asset.assetOsMinorVersion,
agentKey: '',
id: this.asset.id,
lastSeen: this.asset.modifiedAt,
mac: '',
osMajorVersion: this.asset.assetOsMajorVersion,
osMinorVersion: this.asset.assetOs,
aliases: '',
addresses: ''
};
}
}