From e557f7a60869f534c047c8c6b3616f79cf265a55 Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 29 Mar 2018 19:45:06 +0900 Subject: [PATCH] discovery port,service testing --- .../component/setting/setting.component.ts | 146 +++--------------- 1 file changed, 20 insertions(+), 126 deletions(-) diff --git a/src/packages/discovery/component/setting/setting.component.ts b/src/packages/discovery/component/setting/setting.component.ts index b8d7e0e..08460b5 100644 --- a/src/packages/discovery/component/setting/setting.component.ts +++ b/src/packages/discovery/component/setting/setting.component.ts @@ -19,7 +19,7 @@ import { Host } from 'packages/discovery/model/Host'; import * as ProbeDetailStore from 'packages/probe/store'; import { Probe } from 'packages/probe/model'; -import { DetailSelector as ProbeDetailSelector} from 'packages/probe/store'; +import { DetailSelector as ProbeDetailSelector } from 'packages/probe/store'; @Component({ selector: 'of-setting', @@ -107,7 +107,7 @@ export class SettingComponent implements OnInit, AfterContentInit { isZone(zone: Zone): boolean { - for (let i = 0 ; i < this.treeNodes.length; ++i) { + for (let i = 0; i < this.treeNodes.length; ++i) { if (zone.iface === this.treeNodes[i].iface) { return true; } @@ -131,7 +131,7 @@ export class SettingComponent implements OnInit, AfterContentInit { } const jZone: any = { title: 'Zone - ' + value.iface, - className : 'cn' + value.ip + className: 'cn' + value.ip }; jZone.obj = value; jZone.children = this.convertViewHost(value.hosts); @@ -193,13 +193,22 @@ export class SettingComponent implements OnInit, AfterContentInit { discoveryHost: { firstScanRange: this.startIP, lastScanRange: this.endIP, - } + discoveryPort: { + firstScanRange: this.startPort, + lastScanRange: this.endPort, + includeTCP: true, + includeUDP: true, + excludePorts: null, + discoveryService: { + includeServices: ['SSH', 'PostgreSQL', 'DNS', 'WMI', 'SMB'], + } + }, + }, }; - console.log('start discovery - ' + this.probe.probeKey); this.discoverstore.dispatch(new DiscoverStore.DiscoverZone( - {probeID: this.probe.probeKey, discoveryZone: discoveryZone})); + { probeID: this.probe.probeKey, discoveryZone: discoveryZone })); this.started = true; @@ -240,7 +249,7 @@ export class SettingComponent implements OnInit, AfterContentInit { }); if (hosts.length > 0) { - this.registStore.dispatch(new RegistStore.DiscoverySaveAllTarget({hosts: hosts, probe: {id: 1}})); + this.registStore.dispatch(new RegistStore.DiscoverySaveAllTarget({ hosts: hosts, probe: { id: 1 } })); } } @@ -260,7 +269,7 @@ export class SettingComponent implements OnInit, AfterContentInit { const jHost: any = { title: 'Host - ' + host.ip, - className : 'cn' + host.ip + className: 'cn' + host.ip }; jHost.obj = host; @@ -286,14 +295,14 @@ export class SettingComponent implements OnInit, AfterContentInit { const jPort: any = { title: 'Port - ' + port.portNumber, - className : 'cn' + port.portNumber, + className: 'cn' + port.portNumber, }; jPort.obj = port; jPort.children = this.convertViewService(port.services); portChildren.push(jPort); - } ); + }); return portChildren; @@ -310,7 +319,7 @@ export class SettingComponent implements OnInit, AfterContentInit { services.forEach((service, serviceKey) => { const jService: any = { title: 'Service - ' + service.serviceName, - className : 'cn' + service.serviceName, + className: 'cn' + service.serviceName, }; jService.obj = service; @@ -321,118 +330,3 @@ export class SettingComponent implements OnInit, AfterContentInit { } } - - - - -const nodes = [ - { - title: 'host - 3232235781', - className: 'className3232235781', - children: [ - { - title: 'Port - 22', - className: 'className22', - children: [ - { - title: 'SSH', - className: 'classNameSSH' - } - ] - }, - { - title: 'Port - 80', - className: 'className80', - children: [ - { - title: 'HTTP', - className: 'classNameHTTP' - } - ] - }, - { - title: 'Port - 1936', - className: 'className1936', - children: [ - { - title: 'HTTP', - className: 'classNameHTTP' - } - ] - } - ] - }, - { - title: 'host - 3232235781', - className: 'className3232235781', - children: [ - { - title: 'Port - 22', - className: 'className22', - children: [ - { - title: 'SSH', - className: 'classNameSSH' - } - ] - }, - { - title: 'Port - 80', - className: 'className80', - children: [ - { - title: 'HTTP', - className: 'classNameHTTP' - } - ] - }, - { - title: 'Port - 1936', - className: 'className1936', - children: [ - { - title: 'HTTP', - className: 'classNameHTTP' - } - ] - } - ] - }, - { - title: 'host - 3232235781', - className: 'className3232235781', - children: [ - { - title: 'Port - 22', - className: 'className22', - children: [ - { - title: 'SSH', - className: 'classNameSSH' - } - ] - }, - { - title: 'Port - 80', - className: 'className80', - children: [ - { - title: 'HTTP', - className: 'classNameHTTP' - } - ] - }, - { - title: 'Port - 1936', - className: 'className1936', - children: [ - { - title: 'HTTP', - className: 'classNameHTTP' - } - ] - } - ] - } -]; -