discovery condition port + service
This commit is contained in:
parent
e557f7a608
commit
e23ad44191
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
|
||||
import { Component, OnInit, Input, OnDestroy, Output, EventEmitter } from '@angular/core';
|
||||
import { MatChipInputEvent } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
|
@ -10,6 +10,7 @@ export class InputChipComponent implements OnInit, OnDestroy {
|
|||
|
||||
selectedItems = new Array();
|
||||
@Input() unselectedItems;
|
||||
@Output() change = new EventEmitter<any>();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
@ -25,11 +26,13 @@ export class InputChipComponent implements OnInit, OnDestroy {
|
|||
selected(app: any) {
|
||||
this.selectedItems.push(app);
|
||||
this.remove(this.unselectedItems, app);
|
||||
this.emitEvent();
|
||||
}
|
||||
|
||||
unselected(app: any): void {
|
||||
this.remove(this.selectedItems, app);
|
||||
this.unselectedItems.push(app);
|
||||
this.emitEvent();
|
||||
}
|
||||
|
||||
remove(list: any, target: any) {
|
||||
|
@ -45,6 +48,7 @@ export class InputChipComponent implements OnInit, OnDestroy {
|
|||
t.selectedItems.push(v);
|
||||
});
|
||||
this.unselectedItems.length = 0;
|
||||
this.emitEvent();
|
||||
}
|
||||
|
||||
unselectAll() {
|
||||
|
@ -53,5 +57,10 @@ export class InputChipComponent implements OnInit, OnDestroy {
|
|||
t.unselectedItems.push(v);
|
||||
});
|
||||
this.selectedItems.length = 0;
|
||||
this.emitEvent();
|
||||
}
|
||||
|
||||
emitEvent() {
|
||||
this.change.emit(this.selectedItems);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
<mat-checkbox [(ngModel)]="portChecked" (change)="handlePortCheckChange($event)">Port</mat-checkbox>
|
||||
</div>
|
||||
<div>
|
||||
<div *ngIf="portChecked">
|
||||
<mat-slide-toggle [checked]="true" [(ngModel)]="tcpChecked">TCP</mat-slide-toggle>
|
||||
<mat-slide-toggle [checked]="true" [(ngModel)]="udpChecked">UDP</mat-slide-toggle>
|
||||
</div>
|
||||
<mat-form-field *ngIf="portChecked">
|
||||
<input matInput placeholder="Start Port" type="number" [(ngModel)]="startPort">
|
||||
</mat-form-field>
|
||||
|
@ -42,7 +46,7 @@
|
|||
<mat-checkbox [(ngModel)]="serviceChecked" (change)="handleServiceCheckChange($event)">Service</mat-checkbox>
|
||||
</div>
|
||||
<div>
|
||||
<of-input-chip *ngIf="serviceChecked" [unselectedItems]="serviceItems"></of-input-chip>
|
||||
<of-input-chip *ngIf="serviceChecked" [unselectedItems]="serviceItems" (change)="handleServiceChange($event)"></of-input-chip>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </form> -->
|
||||
|
@ -65,10 +69,7 @@
|
|||
<div class="tree-node">
|
||||
<input type="checkbox" [checked]="node.isActive" (change)="checkDiscoveryResult(node)" />
|
||||
<tree-node-expander [node]="node"></tree-node-expander>
|
||||
<div
|
||||
class="node-content-wrapper"
|
||||
[class.node-content-wrapper-active]="node.isActive"
|
||||
[class.node-content-wrapper-focused]="node.isFocused"
|
||||
<div class="node-content-wrapper" [class.node-content-wrapper-active]="node.isActive" [class.node-content-wrapper-focused]="node.isFocused"
|
||||
(click)="checkDiscoveryResult(node)">
|
||||
<span [class]="node.data.className" [class.title]="true">{{ node.data.title }}</span>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit, AfterContentInit } from '@angular/core';
|
||||
import { MatCheckboxChange } from '@angular/material';
|
||||
import { MatCheckboxChange, MatSlideToggleChange } from '@angular/material';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
import { RPCClientError } from '@loafer/ng-rpc/protocol';
|
||||
import {
|
||||
|
@ -45,12 +45,25 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
|||
hostChecked = true;
|
||||
portChecked = true;
|
||||
serviceChecked = true;
|
||||
tcpChecked = true;
|
||||
udpChecked = true;
|
||||
includeServices = null;
|
||||
|
||||
serviceItems = [
|
||||
{ name: 'SSH' },
|
||||
{ name: 'PostgreSQL' },
|
||||
{ name: 'DNS' },
|
||||
{ name: 'WMI'},
|
||||
{ name: 'SMB' },
|
||||
{ name: 'ActiveDirectory' },
|
||||
{ name: 'Cassandra' },
|
||||
{ name: 'FTP' },
|
||||
{ name: 'HTTP' },
|
||||
{ name: 'IMAP' },
|
||||
{ name: 'LDAP' },
|
||||
{ name: 'MongoDB' },
|
||||
{ name: 'MySQL' },
|
||||
{ name: 'Redis' },
|
||||
{ name: 'Tomcat' },
|
||||
{ name: 'Nginx' },
|
||||
{ name: 'NBSS' },
|
||||
];
|
||||
|
||||
treeNodes = [];
|
||||
|
@ -172,6 +185,11 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
|||
}
|
||||
|
||||
handleServiceCheckChange(e: MatCheckboxChange) {
|
||||
this.includeServices = null;
|
||||
}
|
||||
|
||||
handleServiceChange(list: any) {
|
||||
this.includeServices = list;
|
||||
}
|
||||
|
||||
discovery() {
|
||||
|
@ -179,16 +197,10 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
|||
this.startPort = '0';
|
||||
this.endPort = '0';
|
||||
}
|
||||
if (!this.serviceChecked) {
|
||||
|
||||
const services = new Array();
|
||||
for (const service of this.includeServices) {
|
||||
services.push(service.name);
|
||||
}
|
||||
const startInfo: DiscoveryStartInfo = {
|
||||
startIp: this.startIP,
|
||||
endIP: this.endIP,
|
||||
startPort: this.startPort,
|
||||
endPort: this.endPort
|
||||
};
|
||||
|
||||
const discoveryZone: DiscoveryZone = {
|
||||
discoveryHost: {
|
||||
firstScanRange: this.startIP,
|
||||
|
@ -196,11 +208,11 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
|||
discoveryPort: {
|
||||
firstScanRange: this.startPort,
|
||||
lastScanRange: this.endPort,
|
||||
includeTCP: true,
|
||||
includeUDP: true,
|
||||
includeTCP: this.tcpChecked,
|
||||
includeUDP: this.udpChecked,
|
||||
excludePorts: null,
|
||||
discoveryService: {
|
||||
includeServices: ['SSH', 'PostgreSQL', 'DNS', 'WMI', 'SMB'],
|
||||
includeServices: services
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -210,7 +222,6 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
|||
this.discoverstore.dispatch(new DiscoverStore.DiscoverZone(
|
||||
{ probeID: this.probe.probeKey, discoveryZone: discoveryZone }));
|
||||
|
||||
|
||||
this.started = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user