This commit is contained in:
crusader
2018-05-24 15:44:13 +09:00
parent b69539d368
commit d59d9379f9
514 changed files with 4868 additions and 8262 deletions

View File

@@ -0,0 +1,22 @@
<div class="ui-g">
<div class="ui-g-12">
<p-panel [showHeader]="false" >Temp Area</p-panel>
</div>
<div class="ui-g-12 ui-md-3">
<p-accordion (onClose)="onTabClose($event)" (onOpen)="OnTabOpen($event)">
<p-accordionTab header="Discovery Search Config Area" [selected]="true">
<of-discovery-search-config (discoverySearchStartClick)="onDiscoveryStart()" ></of-discovery-search-config>
</p-accordionTab>
<p-accordionTab header="Result Filter Area">
<of-discovery-search-filter></of-discovery-search-filter>
</p-accordionTab>
</p-accordion>
</div>
<div class="ui-g-12 ui-md-9">
<p-panel>
<of-discovery-search-result></of-discovery-search-result>
</p-panel>
</div>
</div>

View File

@@ -0,0 +1,39 @@
import {
AfterContentInit, Component,
OnInit
} from '@angular/core';
@Component({
selector: 'of-discovery',
templateUrl: './discovery.component.html',
})
export class DiscoveryComponent implements OnInit, AfterContentInit {
private tabIdx: number;
constructor(
) {
}
ngOnInit() {
}
ngAfterContentInit() {
}
onTabClose(event) {
}
OnTabOpen(event) {
this.tabIdx = event.index;
}
onFilterResultOpen() {
}
onDiscoveryStart() {
console.log('dddddddddddddd');
}
}

View File

@@ -0,0 +1,60 @@
<div class="ui-g-nopad">
<!--<form [formGroup]="discoveryFormGroup" (ngSubmit)="discoveryStartClick()" >-->
<of-probe-selector [hidden]="requestStart" [preProbe]="probe" (probeSelected)="onProbeSelect($event)"></of-probe-selector>
<div class="ui-g ui-fluid" style="width:250px;margin-bottom:10px">
<div class="ui-g-12"><p-radioButton name="group1" value="0" label="IPv4" [(ngModel)]="ipVesion" inputId="opt1"></p-radioButton></div>
<div class="ui-g-12"><p-radioButton name="group1" value="1" label="IPv6" [(ngModel)]="ipVesion" inputId="opt2"></p-radioButton></div>
</div>
<div class="ui-g ui-fluid">
<span>Start IP Adress </span>
<input type="hidden" >
<div class="ui-inputgroup">
<input type="text" pInputText placeholder="127" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="0" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="0" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="1" maxlength="3">
</div>
</div>
<div class="ui-g ui-fluid">
<span>End IP Adress </span>
<div class="ui-inputgroup">
<input type="text" pInputText placeholder="127" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="0" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="0" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="1" maxlength="3">
</div>
</div>
<div class="ui-g ui-fluid">
<span>Exclud IP Adress </span>
<div class="ui-inputgroup">
<input type="text" pInputText placeholder="127" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="0" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="0" maxlength="3">
<span class="ui-inputgroup-addon">.</span>
<input type="text" pInputText placeholder="1" maxlength="3">
</div>
</div>
<div class="ui-g ui-fluid">
<span>Start Port : </span>
<p-inputMask slotChar=" " mask="9999" [(ngModel)]="startPort" placeholder="1024" [autoClear]="false"></p-inputMask> -
<span>End Port : </span>
<p-inputMask mask="9999" [(ngModel)]="endPort" placeholder="1024" [autoClear]="false"></p-inputMask>
<span>Exclude Port : </span>
<p-inputMask mask="9999" [(ngModel)]="excludePort" placeholder="1024" [autoClear]="false"></p-inputMask>
</div>
<of-service-selector [disabled]="!serviceChecked" [(includeServices)]="includeServices"></of-service-selector>
<button type="submit" label="Discovery Start" pButton class="ui-button-width-fit" ></button>
<!--</form>-->
</div>

View File

@@ -0,0 +1,54 @@
import {
AfterContentInit, Component, EventEmitter, Input,
OnInit, Output
} from '@angular/core';
import {
FormBuilder,
FormGroup
} from '@angular/forms';
@Component({
selector: 'of-discovery-search-config',
templateUrl: './search-config.component.html',
})
export class SearchConfigComponent implements OnInit, AfterContentInit {
@Output() discoverySearchStartClick = new EventEmitter();
discoveryFormGroup: FormGroup;
private ipVesion: string;
private startIP: string;
private endIP: string;
private excludeIP: string;
private startPort: string;
private endPort: string;
private excludePort: string;
constructor(
private formBuilder: FormBuilder,
) {
}
ngOnInit() {
this.ipVesion = '0';
this.initForm();
}
ngAfterContentInit() {
}
initForm() {
// this.discoveryFormGroup = this.formBuilder.group({
//
// });
}
discoveryStartClick() {
this.discoverySearchStartClick.emit();
}
onProbeSelect(event) {
}
}

View File

@@ -0,0 +1,21 @@
<div class="ui-g-nopad">
<div class="ui-g ui-fluid">
<span>Start IP Address : </span>
<p-inputMask mask="9?9?9.9?9?9.9?9?9.9?9?9" [(ngModel)]="startIP" placeholder="254.254.254.254" [autoClear]="false"></p-inputMask> -
<span>End IP Address : </span>
<p-inputMask mask="9?9?9.9?9?9.9?9?9.9?9?9" [(ngModel)]="endIP" placeholder="254.254.254.254" [autoClear]="false"></p-inputMask>
</div>
<div class="ui-g ui-fluid">
<span>Start Port : </span>
<p-inputMask slotChar=" " mask="9999" [(ngModel)]="startPort" placeholder="1024" [autoClear]="false"></p-inputMask> -
<span>End Port : </span>
<p-inputMask mask="9999" [(ngModel)]="endPort" placeholder="1024" [autoClear]="false"></p-inputMask>
</div>
<div class="ui-g ui-fluid">
<p-toggleButton offLabel="Oracle" onLabel="Oracle" [(ngModel)]="Oracle" [style]="{'width':'150px'}" ></p-toggleButton>
<p-toggleButton offLabel="MYSQL" onLabel="MYSQL" [(ngModel)]="MYSQL" [style]="{'width':'150px'}"></p-toggleButton>
<p-toggleButton offLabel="Tomcat" onLabel="Tomcat" [(ngModel)]="Tomcat" [style]="{'width':'150px'}"></p-toggleButton>
<p-toggleButton offLabel="WMI" onLabel="WMI" [(ngModel)]="WMI" [style]="{'width':'150px'}"></p-toggleButton>
</div>
</div>

View File

@@ -0,0 +1,22 @@
import {
AfterContentInit, Component,
OnInit
} from '@angular/core';
@Component({
selector: 'of-discovery-search-filter',
templateUrl: './search-filter.component.html',
})
export class SearchFilterComponent implements OnInit, AfterContentInit {
constructor(
) {
}
ngOnInit() {
}
ngAfterContentInit() {
}
}

View File

@@ -0,0 +1,4 @@
<div class="ui-g">
discovery Search Filter List Print
</div>

View File

@@ -0,0 +1,22 @@
import {
AfterContentInit, Component,
OnInit
} from '@angular/core';
@Component({
selector: 'of-discovery-search-result',
templateUrl: './search-result.component.html',
})
export class SearchResultComponent implements OnInit, AfterContentInit {
constructor(
) {
}
ngOnInit() {
}
ngAfterContentInit() {
}
}

View File

@@ -0,0 +1,23 @@
import { SettingComponent } from './setting/setting.component';
import { ProbeSelectorComponent } from './setting/probe-selector/probe-selector.component';
import { ServiceSelectorComponent } from './setting/filter/service-selector/service-selector.component';
import { FilterComponent } from './setting/filter/filter.component';
import { ResultComponent } from './setting/result/result.component';
import { FilterSummaryComponent } from './setting/filter-summary/filter-summary.component';
import { DiscoveryComponent } from './discovery/discovery.component';
import { SearchConfigComponent } from './discovery/search-config/search-config.component';
import { SearchFilterComponent } from './discovery/search-filter/search-filter.component';
import { SearchResultComponent } from './discovery/search-result/search-result.component';
export const COMPONENTS = [
SettingComponent,
FilterComponent,
ServiceSelectorComponent,
ProbeSelectorComponent,
ResultComponent,
FilterSummaryComponent,
DiscoveryComponent,
SearchConfigComponent,
SearchFilterComponent,
SearchResultComponent
];

View File

@@ -0,0 +1,66 @@
<div class="ui-g">
<div>
<div class="ui-g">
<div class="ui-g-12">
<p-checkbox value="host" label="Host" [(ngModel)]="hostChecked" binary="true" [disabled]="true"></p-checkbox>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="startIP">
<label for="float-input">Start Ip</label>
</span>
</div>
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="endIP">
<label for="float-input">End Ip</label>
</span>
</div>
</div>
<div class="ui-g">
<div class="ui-g-12">
<p-checkbox #portCheckbox value="port" label="Port" [(ngModel)]="portChecked" binary="true" (onChange)="onPortCheckChange(serviceCheckbox, $event)"></p-checkbox>
</div>
<div class="ui-g-12">
<div class="ui-g-6">
TCP &nbsp;
<p-inputSwitch [(ngModel)]="tcpChecked" [disabled]="!portChecked" binary="true"></p-inputSwitch>
</div>
<div class="ui-g-6">
UDP &nbsp;
<p-inputSwitch [(ngModel)]="udpChecked" [disabled]="!portChecked" binary="true"></p-inputSwitch>
</div>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="startPort" [disabled]="!portChecked">
<label for="float-input">Start Port</label>
</span>
</div>
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="endPort" [disabled]="!portChecked">
<label for="float-input">End Port</label>
</span>
</div>
</div>
<div class="ui-g-12">
<div class="ui-g-12 ui-g-nopad">
<p-checkbox #serviceCheckbox value="service" label="Service" [(ngModel)]="serviceChecked" (onChange)="onServiceCheckChange(portCheckbox, $event)" binary="true"></p-checkbox>
</div>
<of-service-selector [disabled]="!serviceChecked" [(includeServices)]="includeServices"></of-service-selector>
</div>
</div>
</div>

View File

@@ -0,0 +1,116 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
import * as CIDR from 'ip-cidr';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { DiscoverZone, DiscoverPort, DiscoverService } from '@overflow/commons-typescript/model/discovery';
@Component({
selector: 'of-discovery-filter',
templateUrl: './filter.component.html',
})
export class FilterComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
@Input() probe: Probe;
@Input() requestStart: boolean;
@Output() discoveryRequested = new EventEmitter<DiscoverZone>();
private startIP: string;
private endIP: string;
private startPort: string;
private endPort: string;
private includeServices = [];
private hostChecked = true;
private portChecked = true;
private serviceChecked = true;
private tcpChecked = true;
private udpChecked = true;
constructor(
) {
}
ngOnInit() {
}
ngAfterContentInit() {
}
ngOnDestroy() {
}
hostRange() {
if (!this.probe || this.probe === undefined) {
return;
}
const cidr = new CIDR(this.probe.cidr);
if (!cidr.isValid()) {
alert('Invalid cidr : ' + this.probe.cidr);
return;
}
this.startIP = cidr.addressStart.address;
this.endIP = cidr.addressEnd.address;
}
portRange() {
this.startPort = '1';
this.endPort = '1024';
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['probe']) {
this.hostRange();
this.portRange();
}
if (changes['requestStart'] && this.requestStart) {
this.onStart();
}
}
onPortCheckChange(serviceCheckbox, checked) {
if (!checked) {
serviceCheckbox.checked = false;
this.serviceChecked = false;
}
}
onServiceCheckChange(portCheckbox, checked) {
if (checked) {
portCheckbox.checked = true;
this.portChecked = true;
}
}
onStart() {
let discoverPort: DiscoverPort = null;
let discoverService: DiscoverService = null;
if (this.serviceChecked) {
const services = new Array();
for (const service of this.includeServices) {
services.push(service.description); // FIXME to const name
}
discoverService = {
includeServices: services,
};
}
if (this.portChecked) {
discoverPort = {
firstScanRange: Number(this.startPort),
lastScanRange: Number(this.endPort),
includeTCP: this.tcpChecked,
includeUDP: this.udpChecked,
excludePorts: null,
discoverService: discoverService
};
}
const discoverZone: DiscoverZone = {
discoverHost: {
firstScanRangev4: this.startIP,
lastScanRangev4: this.endIP,
discoverPort: discoverPort
},
};
this.discoveryRequested.emit(discoverZone);
}
}

View File

@@ -0,0 +1,10 @@
<div class="ui-g-12">
<p-pickList [disabled]="disabled" [source]="crawlers" [target]="includeServices" sourceHeader="Available" targetHeader="Selected" [responsive]="true"
filterBy="description" dragdrop="true" dragdropScope="services" [sourceStyle]="{'height':'200px'}" [targetStyle]="{'height':'200px'}" [showTargetControls]="false" [showSourceControls]="false">
<ng-template let-crawler pTemplate="item">
<div class="ui-helper-clearfix">
<div style="font-size:14px;margin:0;padding: 0;">{{crawler.description}}</div>
</div>
</ng-template>
</p-pickList>
</div>

View File

@@ -0,0 +1,52 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import * as ListStore from '@overflow/meta/crawler/store/list';
import { ReadAllCrawlerSelector } from '@overflow/meta/crawler/store';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
import { Subscription } from 'rxjs/Subscription';
@Component({
selector: 'of-service-selector',
templateUrl: './service-selector.component.html',
})
export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDestroy {
crawlersSubscription$: Subscription;
crawlers$: StateObservable;
crawlers: MetaCrawler[];
@Output() crawlerSelected = new EventEmitter<MetaCrawler>();
@Input() includeServices;
@Input() disabled: boolean;
constructor(
private listStore: Store<ListStore.State>,
) {
this.crawlers$ = listStore.pipe(select(ReadAllCrawlerSelector.select('metaCrawlerList')));
}
ngOnInit() {
this.crawlersSubscription$ = this.crawlers$.subscribe(
(list: MetaCrawler[]) => {
if (list !== null) {
this.crawlers = [];
this.includeServices = list;
}
},
(error: RPCClientError) => {
console.log(error);
}
);
}
ngAfterContentInit() {
this.listStore.dispatch(new ListStore.ReadAll());
}
ngOnDestroy() {
if (this.crawlersSubscription$) {
this.crawlersSubscription$.unsubscribe();
}
}
}

View File

@@ -0,0 +1,4 @@
<div *ngIf="!preProbe">
<p-dropdown #dropdown [options]="probes" optionLabel="displayName" placeholder="Select a Probe" [(ngModel)]="selected" (onChange)="onProbeSelect($event)"
[style]="{'width':'300px'}"></p-dropdown>
</div>

View File

@@ -0,0 +1,82 @@
import {
Component, OnInit, Input, AfterContentInit, Output,
EventEmitter, OnDestroy, OnChanges, SimpleChanges, ViewChild
} from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import * as ListStore from '@overflow/probe/store/list';
import { ListSelector } from '@overflow/probe/store';
import { Subscription } from 'rxjs/Subscription';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { AuthSelector } from '@overflow/member/store';
import { Domain } from '@overflow/commons-typescript/model/domain';
import { Dropdown } from 'primeng/primeng';
@Component({
selector: 'of-probe-selector',
templateUrl: './probe-selector.component.html',
})
export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
@Input() visible: boolean;
@Input() preProbe: Probe;
probesSubscription$: Subscription;
probes$: StateObservable;
probes: Probe[];
selected: Probe;
@Output() probeSelected = new EventEmitter<Probe>();
constructor(
private listStore: Store<ListStore.State>,
) {
this.probes$ = listStore.pipe(select(ListSelector.select('probes')));
}
ngOnInit() {
this.probesSubscription$ = this.probes$.subscribe(
(list: Probe[]) => {
if (list !== null) {
this.probes = list;
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
}
ngAfterContentInit() {
this.getProbes();
}
ngOnDestroy() {
if (this.probesSubscription$) {
this.probesSubscription$.unsubscribe();
}
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['visible']) {
this.selected = null;
this.getProbes();
}
}
getProbes() {
this.listStore.select(AuthSelector.select('domain')).subscribe(
(domain: Domain) => {
this.listStore.dispatch(new ListStore.ReadAllByDomain(domain));
},
(error) => {
console.log(error);
}
);
}
onProbeSelect(event) {
this.selected = event.value;
this.probeSelected.emit(this.selected);
}
}

View File

@@ -0,0 +1,11 @@
<div class="ui-g-12">
<div *ngIf="inProgress">
<p-progressBar mode="indeterminate" [style]="{'height': '16px'}"></p-progressBar>
</div>
<p-blockUI [target]="result" [blocked]="inProgress"></p-blockUI>
<p-panel #result [showHeader]="false">
<p-tree [value]="treeNodes" selectionMode="checkbox" [(selection)]="selectedNodes"></p-tree>
</p-panel>
</div>

View File

@@ -0,0 +1,191 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { Subscription } from 'rxjs/Subscription';
import { TreeNode } from 'primeng/primeng';
import * as DiscoveredStore from '@overflow/discovery/store/setting';
import { SettingSelector, DiscoverSelector } from '@overflow/discovery/store';
import * as DiscoverStore from '@overflow/discovery/store/discover';
import * as RegistStore from '@overflow/discovery/store/regist';
import { Zone } from '@overflow/commons-typescript/model/discovery';
import { Host } from '@overflow/commons-typescript/model/discovery';
import { Port } from '@overflow/commons-typescript/model/discovery';
import { Service } from '@overflow/commons-typescript/model/discovery';
@Component({
selector: 'of-discovery-result',
templateUrl: './result.component.html',
})
export class ResultComponent implements OnInit, AfterContentInit, OnDestroy {
treeNodes = [];
selectedNodes = [];
zones: Map<string, Zone> = null;
checkedSet = new Set();
resultSubscription$: Subscription;
result$: any;
startedSubscription$: Subscription;
started$: any;
endedSubscription$: Subscription;
ended$: any;
inProgress = false;
selectedDiscoveryResult: TreeNode[];
constructor(
private discoverdStore: Store<DiscoveredStore.State>,
private discoverStore: Store<DiscoverStore.State>,
private registStore: Store<RegistStore.State>,
) {
this.result$ = discoverStore.pipe(select(DiscoverSelector.select('zones')));
this.started$ = discoverStore.pipe(select(DiscoverSelector.select('isStart')));
this.ended$ = discoverStore.pipe(select(DiscoverSelector.select('isEnd')));
}
ngOnInit() {
alert('init');
this.resultSubscription$ = this.result$.subscribe(
(zones: Map<string, Zone>) => {
if (zones !== undefined && zones !== null) {
console.log(zones);
this.treeNodes = this.convertTreeViewZone(zones);
this.zones = zones;
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
this.startedSubscription$ = this.started$.subscribe(
(isStart: boolean) => {
if (isStart !== undefined && isStart !== null && isStart) {
this.inProgress = true;
console.log('##Discovery has started.##');
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
this.endedSubscription$ = this.ended$.subscribe(
(isEnd: boolean) => {
if (isEnd !== undefined && isEnd !== null && isEnd) {
console.log('##Discovery has done.##');
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
}
ngAfterContentInit() {
}
ngOnDestroy() {
if (this.startedSubscription$) {
this.startedSubscription$.unsubscribe();
}
if (this.endedSubscription$) {
this.endedSubscription$.unsubscribe();
}
if (this.resultSubscription$) {
this.resultSubscription$.unsubscribe();
}
}
save() {
}
convertTreeViewZone(zones: Map<string, Zone>) {
if (zones === undefined || zones === null) {
return;
}
const treeNodes: any[] = [];
zones.forEach((value: Zone, key: string, map) => {
const jZone: any = {
label: 'Zone - ' + value.iface,
// className: 'cn' + value.ip,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jZone.obj = value;
jZone.children = this.convertViewHost(value.hosts);
treeNodes.push(jZone);
});
return treeNodes;
}
convertViewHost(hosts): any[] {
if (hosts === undefined || hosts === null) {
return null;
}
const hostNodes: any[] = [];
hosts.forEach((host, hostKey) => {
const jHost: any = {
label: 'Host - ' + host.ipv4,
// className: 'cn' + host.ip
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jHost.obj = host;
jHost.children = this.convertViewPort(host.ports);
hostNodes.push(jHost);
});
return hostNodes;
}
convertViewPort(ports): any[] {
if (ports === undefined || ports === null || ports.size < 0) {
return null;
}
const portChildren: any[] = [];
ports.forEach((port, portKey) => {
const jPort: any = {
label: 'Port - ' + port.portNumber,
// className: 'cn' + port.portNumber,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jPort.obj = port;
jPort.children = this.convertViewService(port.services);
portChildren.push(jPort);
});
return portChildren;
}
convertViewService(services): any[] {
if (services === undefined || services === null || services.size <= 0) {
return null;
}
const serviceChildren: any[] = [];
services.forEach((service, serviceKey) => {
const jService: any = {
label: 'Service - ' + service.serviceName,
// className: 'cn' + service.serviceName,
};
jService.obj = service;
serviceChildren.push(jService);
});
return serviceChildren;
}
}

View File

@@ -0,0 +1,30 @@
<div [style.height.px]="height">
<div dir="rtl">
<p-button (onClick)="onCancel()" icon="fa fa-fw fa-close"></p-button>
</div>
<div *ngIf="!started; else result">
<of-probe-selector [preProbe]="probe" [visible]="visible" (probeSelected)="onProbeSelect($event)"></of-probe-selector>
<p-blockUI [target]="df" [blocked]="!selectedProbe && !probe"></p-blockUI>
<p-panel #df [showHeader]="false">
<of-discovery-filter [probe]="selectedProbe" [requestStart]="requestStart" (discoveryRequested)="onDiscoveryStart($event)"></of-discovery-filter>
</p-panel>
<div dir="rtl">
<button [disabled]="!selectedProbe && !probe" pButton type="button" label="Start" icon="fa-check" class="ui-button-width-fit"
(click)="requestStart = true"></button>
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="onCancel()"></button>
</div>
</div>
<ng-template #result>
<of-discovery-result #resultComponent (close)="onCancel()"></of-discovery-result>
<div dir="rtl">
<button [disabled]="!selectedProbe && !probe" pButton type="button" label="Start" icon="fa-check" class="ui-button-width-fit"
(click)="onSave()"></button>
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="onCancel()"></button>
</div>
</ng-template>
</div>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingComponent } from './setting.component';
describe('SettingComponent', () => {
let component: SettingComponent;
let fixture: ComponentFixture<SettingComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,93 @@
import { Component, OnInit, AfterContentInit, Output, EventEmitter,
Input, OnDestroy, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import {
DiscoveryStartInfo,
DiscoverZone,
Zone,
DiscoverPort,
DiscoverService
} from '@overflow/commons-typescript/model/discovery';
import * as CIDR from 'ip-cidr';
import * as DiscoveredStore from '../../store/setting';
import { SettingSelector, DiscoverSelector } from '../../store';
import * as DiscoverStore from '../../store/discover';
import * as RegistStore from '../../store/regist';
import { Host } from '@overflow/commons-typescript/model/discovery';
import { Port } from '@overflow/commons-typescript/model/discovery';
import { Service } from '@overflow/commons-typescript/model/discovery';
import * as ProbeDetailStore from '@overflow/probe/store';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { TreeNode } from 'primeng/primeng';
import { ListSelector as ProbeListSelector } from '@overflow/probe/store';
import * as ProbeListStore from '@overflow/probe/store/list';
import { AuthSelector } from '@overflow/member/store';
import { Domain } from '@overflow/commons-typescript/model/domain';
import { Subscription } from 'rxjs/Subscription';
import { ResultComponent } from './result/result.component';
@Component({
selector: 'of-discovery-setting',
templateUrl: './setting.component.html',
})
export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
@Input() visible: boolean;
@Input() probe: Probe;
@Output() close = new EventEmitter();
private requestStart = false;
private started = false;
private selectedProbe: Probe;
private height: number;
@ViewChild('resultComponent') resultComponent: ResultComponent;
constructor(
private discoverStore: Store<DiscoverStore.State>,
) {
}
ngOnInit() {
this.height = window.innerHeight * 0.9;
}
ngAfterContentInit() {
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['probe'] && this.probe) {
this.selectedProbe = this.probe;
}
}
ngOnDestroy() {
}
onProbeSelect(probe: Probe) {
this.selectedProbe = probe;
}
onDiscoveryStart(discoverZone: DiscoverZone) {
this.discoverStore.dispatch(new DiscoverStore.DiscoverZone(
{ probeID: this.selectedProbe.probeKey, discoverZone: discoverZone }));
setTimeout(() => {
this.started = true;
this.requestStart = false;
});
}
onCancel() {
this.selectedProbe = null;
this.started = false;
this.close.emit();
}
onSave() {
this.resultComponent.ngOnInit();
this.resultComponent.save();
}
}

View File

@@ -0,0 +1,11 @@
<div *ngIf="data" class="ui-g-12" (click)="onClick()">
<of-key-value *ngIf="data.discoverHost" [key]="'Host'" [value]="hostRange"></of-key-value>
<of-key-value *ngIf="data.discoverHost.discoverPort" [key]="'Port'" [value]="portRange"></of-key-value>
<span *ngIf="includeTCP">
TCP
</span>
<span *ngIf="includeUDP">
UDP
</span>
<of-key-value *ngIf="services !== ''" [key]="'Services'" [value]="services"></of-key-value>
</div>

View File

@@ -0,0 +1,59 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
import { DiscoverZone } from '@overflow/commons-typescript/model/discovery';
@Component({
selector: 'of-discovery-filter-summary',
templateUrl: './filter-summary.component.html',
})
export class FilterSummaryComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
@Output() click = new EventEmitter();
@Input() data: DiscoverZone;
private hostRange: string;
private portRange: string;
private includeTCP: boolean;
private includeUDP: boolean;
private services: string;
constructor(
) {
this.services = '';
}
ngOnInit() {
}
ngAfterContentInit() {
}
ngOnChanges(changes: SimpleChanges): void {
if (!this.data) {
return;
}
this.hostRange = this.data.discoverHost.firstScanRangev4 + ' ~ ' + this.data.discoverHost.lastScanRangev4;
if (this.data.discoverHost.discoverPort) {
this.portRange = this.data.discoverHost.discoverPort.firstScanRange + ' ~ ' + this.data.discoverHost.discoverPort.lastScanRange;
this.includeTCP = this.data.discoverHost.discoverPort.includeTCP;
this.includeUDP = this.data.discoverHost.discoverPort.includeUDP;
}
if (this.data.discoverHost.discoverPort.discoverService) {
const services = this.data.discoverHost.discoverPort.discoverService.includeServices;
if (services.length > 3) {
this.services = String(services.length) + ' services selected.';
return;
}
for (const service of services) {
this.services += service;
}
}
}
ngOnDestroy() {
}
onClick() {
this.click.emit();
}
}

View File

@@ -0,0 +1,66 @@
<div class="ui-g">
<div>
<div class="ui-g">
<div class="ui-g-12">
<p-checkbox value="host" label="Host" [(ngModel)]="hostChecked" binary="true" [disabled]="true"></p-checkbox>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="startIP">
<label for="float-input">Start Ip</label>
</span>
</div>
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="endIP">
<label for="float-input">End Ip</label>
</span>
</div>
</div>
<div class="ui-g">
<div class="ui-g-12">
<p-checkbox #portCheckbox value="port" label="Port" [(ngModel)]="portChecked" binary="true" (onChange)="onPortCheckChange(serviceCheckbox, $event)"></p-checkbox>
</div>
<div class="ui-g-12">
<div class="ui-g-6">
TCP &nbsp;
<p-inputSwitch [(ngModel)]="tcpChecked" [disabled]="!portChecked" binary="true"></p-inputSwitch>
</div>
<div class="ui-g-6">
UDP &nbsp;
<p-inputSwitch [(ngModel)]="udpChecked" [disabled]="!portChecked" binary="true"></p-inputSwitch>
</div>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="startPort" [disabled]="!portChecked">
<label for="float-input">Start Port</label>
</span>
</div>
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="endPort" [disabled]="!portChecked">
<label for="float-input">End Port</label>
</span>
</div>
</div>
<div class="ui-g-12">
<div class="ui-g-12 ui-g-nopad">
<p-checkbox #serviceCheckbox value="service" label="Service" [(ngModel)]="serviceChecked" (onChange)="onServiceCheckChange(portCheckbox, $event)" binary="true"></p-checkbox>
</div>
<of-service-selector [disabled]="!serviceChecked" [(includeServices)]="includeServices"></of-service-selector>
</div>
</div>
</div>

View File

@@ -0,0 +1,116 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
import * as CIDR from 'ip-cidr';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { DiscoverZone, DiscoverPort, DiscoverService } from '@overflow/commons-typescript/model/discovery';
@Component({
selector: 'of-discovery-filter',
templateUrl: './filter.component.html',
})
export class FilterComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
@Input() probe: Probe;
@Input() requestStart: boolean;
@Output() discoveryRequested = new EventEmitter<DiscoverZone>();
private startIP: string;
private endIP: string;
private startPort: string;
private endPort: string;
private includeServices = [];
private hostChecked = true;
private portChecked = true;
private serviceChecked = true;
private tcpChecked = true;
private udpChecked = true;
constructor(
) {
}
ngOnInit() {
}
ngAfterContentInit() {
}
ngOnDestroy() {
}
hostRange() {
if (!this.probe || this.probe === undefined) {
return;
}
const cidr = new CIDR(this.probe.cidr);
if (!cidr.isValid()) {
alert('Invalid cidr : ' + this.probe.cidr);
return;
}
this.startIP = cidr.addressStart.address;
this.endIP = cidr.addressEnd.address;
}
portRange() {
this.startPort = '1';
this.endPort = '1024';
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['probe']) {
this.hostRange();
this.portRange();
}
if (changes['requestStart'] && this.requestStart) {
this.onStart();
}
}
onPortCheckChange(serviceCheckbox, checked) {
if (!checked) {
serviceCheckbox.checked = false;
this.serviceChecked = false;
}
}
onServiceCheckChange(portCheckbox, checked) {
if (checked) {
portCheckbox.checked = true;
this.portChecked = true;
}
}
onStart() {
let discoverPort: DiscoverPort = null;
let discoverService: DiscoverService = null;
if (this.serviceChecked) {
const services = new Array();
for (const service of this.includeServices) {
services.push(service.description); // FIXME to const name
}
discoverService = {
includeServices: services,
};
}
if (this.portChecked) {
discoverPort = {
firstScanRange: Number(this.startPort),
lastScanRange: Number(this.endPort),
includeTCP: this.tcpChecked,
includeUDP: this.udpChecked,
excludePorts: null,
discoverService: discoverService
};
}
const discoverZone: DiscoverZone = {
discoverHost: {
firstScanRangev4: this.startIP,
lastScanRangev4: this.endIP,
discoverPort: discoverPort
},
};
this.discoveryRequested.emit(discoverZone);
}
}

View File

@@ -0,0 +1,22 @@
<div class="ui-g-12">
<p-pickList
[disabled]="disabled"
[source]="crawlers"
[target]="includeServices"
sourceHeader="Available"
targetHeader="Selected"
[responsive]="true"
filterBy="description"
dragdrop="true"
dragdropScope="services"
[sourceStyle]="{'height':'200px'}"
[targetStyle]="{'height':'200px'}"
[showTargetControls]="false"
[showSourceControls]="false" >
<ng-template let-crawler pTemplate="item">
<div class="ui-helper-clearfix">
<div style="font-size:14px;margin:0;padding: 0;">{{crawler.description}}</div>
</div>
</ng-template>
</p-pickList>
</div>

View File

@@ -0,0 +1,52 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import * as ListStore from '@overflow/meta/crawler/store/list';
import { ReadAllCrawlerSelector } from '@overflow/meta/crawler/store';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
import { Subscription } from 'rxjs/Subscription';
@Component({
selector: 'of-service-selector',
templateUrl: './service-selector.component.html',
})
export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDestroy {
crawlersSubscription$: Subscription;
crawlers$: StateObservable;
crawlers: MetaCrawler[];
@Output() crawlerSelected = new EventEmitter<MetaCrawler>();
@Input() includeServices;
@Input() disabled: boolean;
constructor(
private listStore: Store<ListStore.State>,
) {
this.crawlers$ = listStore.pipe(select(ReadAllCrawlerSelector.select('metaCrawlerList')));
}
ngOnInit() {
this.crawlersSubscription$ = this.crawlers$.subscribe(
(list: MetaCrawler[]) => {
if (list !== null) {
this.crawlers = [];
this.crawlers = list;
}
},
(error: RPCClientError) => {
console.log(error);
}
);
}
ngAfterContentInit() {
this.listStore.dispatch(new ListStore.ReadAll());
}
ngOnDestroy() {
if (this.crawlersSubscription$) {
this.crawlersSubscription$.unsubscribe();
}
}
}

View File

@@ -0,0 +1,4 @@
<div *ngIf="!preProbe">
<p-dropdown #dropdown [options]="probes" optionLabel="displayName" placeholder="Select a Probe" [(ngModel)]="selected" (onChange)="onProbeSelect($event)"
[style]="{'width':'300px'}"></p-dropdown>
</div>

View File

@@ -0,0 +1,75 @@
import {
Component, OnInit, Input, AfterContentInit, Output,
EventEmitter, OnDestroy, ViewChild
} from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import * as ListStore from '@overflow/probe/store/list';
import { ListSelector } from '@overflow/probe/store';
import { Subscription } from 'rxjs/Subscription';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { AuthSelector } from '@overflow/member/store';
import { Domain } from '@overflow/commons-typescript/model/domain';
import { Dropdown } from 'primeng/primeng';
@Component({
selector: 'of-probe-selector',
templateUrl: './probe-selector.component.html',
})
export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestroy {
@Input() preProbe: Probe;
probesSubscription$: Subscription;
probes$: StateObservable;
probes: Probe[];
selected: Probe;
@Output() probeSelected = new EventEmitter<Probe>();
constructor(
private listStore: Store<ListStore.State>,
) {
this.probes$ = listStore.pipe(select(ListSelector.select('probes')));
}
ngOnInit() {
this.probesSubscription$ = this.probes$.subscribe(
(list: Probe[]) => {
if (list !== null) {
this.probes = list;
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
}
ngAfterContentInit() {
this.getProbes();
}
ngOnDestroy() {
if (this.probesSubscription$) {
this.probesSubscription$.unsubscribe();
}
this.selected = null;
this.probes = null;
}
getProbes() {
this.listStore.select(AuthSelector.select('domain')).subscribe(
(domain: Domain) => {
this.listStore.dispatch(new ListStore.ReadAllByDomain(domain));
},
(error) => {
console.log(error);
}
);
}
onProbeSelect(event) {
this.selected = event.value;
this.probeSelected.emit(this.selected);
}
}

View File

@@ -0,0 +1,190 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { Subscription } from 'rxjs/Subscription';
import { TreeNode } from 'primeng/primeng';
import * as DiscoveredStore from '@overflow/discovery/store/setting';
import { SettingSelector, DiscoverSelector } from '@overflow/discovery/store';
import * as DiscoverStore from '@overflow/discovery/store/discover';
import * as RegistStore from '@overflow/discovery/store/regist';
import { Zone } from '@overflow/commons-typescript/model/discovery';
import { Host } from '@overflow/commons-typescript/model/discovery';
import { Port } from '@overflow/commons-typescript/model/discovery';
import { Service } from '@overflow/commons-typescript/model/discovery';
@Component({
selector: 'of-discovery-result',
templateUrl: './result.component.html',
})
export class ResultComponent implements OnInit, AfterContentInit, OnDestroy {
treeNodes = [];
selectedNodes = [];
zones: Map<string, Zone> = null;
checkedSet = new Set();
resultSubscription$: Subscription;
result$: any;
startedSubscription$: Subscription;
started$: any;
endedSubscription$: Subscription;
ended$: any;
inProgress = false;
selectedDiscoveryResult: TreeNode[];
constructor(
private discoverdStore: Store<DiscoveredStore.State>,
private discoverStore: Store<DiscoverStore.State>,
private registStore: Store<RegistStore.State>,
) {
this.result$ = discoverStore.pipe(select(DiscoverSelector.select('zones')));
this.started$ = discoverStore.pipe(select(DiscoverSelector.select('isStart')));
this.ended$ = discoverStore.pipe(select(DiscoverSelector.select('isEnd')));
}
ngOnInit() {
this.resultSubscription$ = this.result$.subscribe(
(zones: Map<string, Zone>) => {
if (zones !== undefined && zones !== null) {
console.log(zones);
this.treeNodes = this.convertTreeViewZone(zones);
this.zones = zones;
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
this.startedSubscription$ = this.started$.subscribe(
(isStart: boolean) => {
if (isStart !== undefined && isStart !== null && isStart) {
this.inProgress = true;
console.log('##Discovery has started.##');
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
this.endedSubscription$ = this.ended$.subscribe(
(isEnd: boolean) => {
if (isEnd !== undefined && isEnd !== null && isEnd) {
console.log('##Discovery has done.##');
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
}
ngAfterContentInit() {
}
ngOnDestroy() {
if (this.startedSubscription$) {
this.startedSubscription$.unsubscribe();
}
if (this.endedSubscription$) {
this.endedSubscription$.unsubscribe();
}
if (this.resultSubscription$) {
this.resultSubscription$.unsubscribe();
}
}
save() {
}
convertTreeViewZone(zones: Map<string, Zone>) {
if (zones === undefined || zones === null) {
return;
}
const treeNodes: any[] = [];
zones.forEach((value: Zone, key: string, map) => {
const jZone: any = {
label: 'Zone - ' + value.iface,
// className: 'cn' + value.ip,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jZone.obj = value;
jZone.children = this.convertViewHost(value.hosts);
treeNodes.push(jZone);
});
return treeNodes;
}
convertViewHost(hosts): any[] {
if (hosts === undefined || hosts === null) {
return null;
}
const hostNodes: any[] = [];
hosts.forEach((host, hostKey) => {
const jHost: any = {
label: 'Host - ' + host.ipv4,
// className: 'cn' + host.ip
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jHost.obj = host;
jHost.children = this.convertViewPort(host.ports);
hostNodes.push(jHost);
});
return hostNodes;
}
convertViewPort(ports): any[] {
if (ports === undefined || ports === null || ports.size < 0) {
return null;
}
const portChildren: any[] = [];
ports.forEach((port, portKey) => {
const jPort: any = {
label: 'Port - ' + port.portNumber,
// className: 'cn' + port.portNumber,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jPort.obj = port;
jPort.children = this.convertViewService(port.services);
portChildren.push(jPort);
});
return portChildren;
}
convertViewService(services): any[] {
if (services === undefined || services === null || services.size <= 0) {
return null;
}
const serviceChildren: any[] = [];
services.forEach((service, serviceKey) => {
const jService: any = {
label: 'Service - ' + service.serviceName,
// className: 'cn' + service.serviceName,
};
jService.obj = service;
serviceChildren.push(jService);
});
return serviceChildren;
}
}

View File

@@ -0,0 +1,13 @@
<div class="ui-g-12">
<div *ngIf="inProgress">
<p-progressBar mode="indeterminate"></p-progressBar>
</div>
<p-blockUI [target]="result" [blocked]="inProgress"></p-blockUI>
<p-panel #result [showHeader]="false">
<div>
result
</div>
<p-tree [value]="treeNodes" selectionMode="checkbox" [(selection)]="selectedNodes"></p-tree>
</p-panel>
</div>

View File

@@ -0,0 +1,198 @@
import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { Subscription } from 'rxjs/Subscription';
import { TreeNode } from 'primeng/primeng';
import * as DiscoveredStore from '@overflow/discovery/store/setting';
import { SettingSelector, DiscoverSelector } from '@overflow/discovery/store';
import * as DiscoverStore from '@overflow/discovery/store/discover';
import * as RegistStore from '@overflow/discovery/store/regist';
import { Zone } from '@overflow/commons-typescript/model/discovery';
import { Host } from '@overflow/commons-typescript/model/discovery';
import { Port } from '@overflow/commons-typescript/model/discovery';
import { Service } from '@overflow/commons-typescript/model/discovery';
@Component({
selector: 'of-discovery-result',
templateUrl: './result.component.html',
})
export class ResultComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
@Input() started: boolean;
treeNodes = [];
selectedNodes = [];
zones: Map<string, Zone> = null;
checkedSet = new Set();
resultSubscription$: Subscription;
result$: any;
startedSubscription$: Subscription;
started$: any;
endedSubscription$: Subscription;
ended$: any;
inProgress = false;
selectedDiscoveryResult: TreeNode[];
constructor(
private discoverdStore: Store<DiscoveredStore.State>,
private discoverStore: Store<DiscoverStore.State>,
private registStore: Store<RegistStore.State>,
) {
this.result$ = discoverStore.pipe(select(DiscoverSelector.select('zones')));
this.started$ = discoverStore.pipe(select(DiscoverSelector.select('isStart')));
this.ended$ = discoverStore.pipe(select(DiscoverSelector.select('isEnd')));
}
ngOnInit() {
this.inProgress = true;
this.resultSubscription$ = this.result$.subscribe(
(zones: Map<string, Zone>) => {
if (zones !== undefined && zones !== null) {
console.log(zones);
this.treeNodes = this.convertTreeViewZone(zones);
this.zones = zones;
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
this.startedSubscription$ = this.started$.subscribe(
(isStart: boolean) => {
if (isStart !== undefined && isStart !== null && isStart) {
console.log('##Discovery has started.##');
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
this.endedSubscription$ = this.ended$.subscribe(
(isEnd: boolean) => {
if (isEnd !== undefined && isEnd !== null && isEnd) {
console.log('##Discovery has done.##');
}
},
(error: RPCClientError) => {
console.log(error.response.message);
}
);
}
ngAfterContentInit() {
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['started'] && !changes['started'].currentValue) {
this.inProgress = false;
}
}
ngOnDestroy() {
if (this.startedSubscription$) {
this.startedSubscription$.unsubscribe();
}
if (this.endedSubscription$) {
this.endedSubscription$.unsubscribe();
}
if (this.resultSubscription$) {
this.resultSubscription$.unsubscribe();
}
}
save() {
}
convertTreeViewZone(zones: Map<string, Zone>) {
if (zones === undefined || zones === null) {
return;
}
const treeNodes: any[] = [];
zones.forEach((value: Zone, key: string, map) => {
const jZone: any = {
label: 'Zone - ' + value.iface,
// className: 'cn' + value.ip,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jZone.obj = value;
jZone.children = this.convertViewHost(value.hosts);
treeNodes.push(jZone);
});
return treeNodes;
}
convertViewHost(hosts): any[] {
if (hosts === undefined || hosts === null) {
return null;
}
const hostNodes: any[] = [];
hosts.forEach((host, hostKey) => {
const jHost: any = {
label: 'Host - ' + host.ipv4,
// className: 'cn' + host.ip
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jHost.obj = host;
jHost.children = this.convertViewPort(host.ports);
hostNodes.push(jHost);
});
return hostNodes;
}
convertViewPort(ports): any[] {
if (ports === undefined || ports === null || ports.size < 0) {
return null;
}
const portChildren: any[] = [];
ports.forEach((port, portKey) => {
const jPort: any = {
label: 'Port - ' + port.portNumber,
// className: 'cn' + port.portNumber,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jPort.obj = port;
jPort.children = this.convertViewService(port.services);
portChildren.push(jPort);
});
return portChildren;
}
convertViewService(services): any[] {
if (services === undefined || services === null || services.size <= 0) {
return null;
}
const serviceChildren: any[] = [];
services.forEach((service, serviceKey) => {
const jService: any = {
label: 'Service - ' + service.serviceName,
// className: 'cn' + service.serviceName,
};
jService.obj = service;
serviceChildren.push(jService);
});
return serviceChildren;
}
}

View File

@@ -0,0 +1,36 @@
<div [style.height.px]="height">
<div dir="rtl">
<p-button (onClick)="onCancel()" icon="fa fa-fw fa-close"></p-button>
</div>
<div>
<of-probe-selector [hidden]="requestStart" #probeSelectorComponent [preProbe]="probe" (probeSelected)="onProbeSelect($event)"></of-probe-selector>
<p-blockUI [target]="df" [blocked]="!selectedProbe && !probe"></p-blockUI>
<p-panel #df [showHeader]="false">
<div [@discoveryFilter]="!requestStart ? 'full' : 'summary'">
<div [hidden]="requestStart">
<of-discovery-filter #filterComponent [probe]="selectedProbe" [requestStart]="requestStart" (discoveryRequested)="onDiscoveryStart($event)"></of-discovery-filter>
</div>
<div [hidden]="!requestStart">
<of-discovery-filter-summary [data]="filterData" (click)="onSummaryClick($event)"></of-discovery-filter-summary>
</div>
</div>
</p-panel>
<div dir="rtl" *ngIf="!requestStart">
<button [disabled]="!selectedProbe && !probe" pButton type="button" label="Start" icon="fa-check" class="ui-button-width-fit"
(click)="requestStart = true"></button>
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="onCancel()"></button>
</div>
</div>
<div *ngIf="requestStart" [@result]="!requestStart ? 'hidden' : 'show'">
<of-discovery-result (close)="onCancel()" [started]="started"></of-discovery-result>
<div dir="rtl">
<button [disabled]="!selectedProbe && !probe" pButton type="button" label="Save" icon="fa-check" class="ui-button-width-fit"
(click)="onSave()"></button>
<button pButton type="button" label="Stop" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="onStop()"></button>
</div>
</div>
</div>

View File

@@ -0,0 +1,156 @@
import {
Component, OnInit, AfterContentInit, Output, EventEmitter,
Input, OnDestroy, OnChanges, SimpleChanges, ViewChild
} from '@angular/core';
import { Store } from '@ngrx/store';
import {
DiscoverZone,
} from '@overflow/commons-typescript/model/discovery';
import * as DiscoverStore from '../../store/discover';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { ResultComponent } from './result/result.component';
import { ProbeSelectorComponent } from './probe-selector/probe-selector.component';
import { FilterComponent } from './filter/filter.component';
import { trigger, state, transition, style, animate } from '@angular/animations';
@Component({
selector: 'of-discovery-setting',
templateUrl: './setting.component.html',
animations: [
trigger(
'discoveryFilter', [
state('summary', style({
height: '70px',
opacity: 0.9,
})),
state('full', style({
height: '500px',
opacity: 1,
})),
transition('* => *', animate('200ms ease-in')),
]),
trigger(
'result', [
state('show', style({
height: '300px',
opacity: 1,
})),
state('hidden', style({
height: '0px',
opacity: 0,
})),
transition('* => *', animate('200ms ease-in')),
]
)
]
})
export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges {
@Input() visible: boolean;
@Input() probe: Probe;
@Output() close = new EventEmitter();
private requestStart = false;
private started = false;
private filterData: DiscoverZone;
private selectedProbe: Probe;
private height: number;
@ViewChild('probeSelectorComponent') probeSelectorComponent: ProbeSelectorComponent;
@ViewChild('filterComponent') filterComponent: FilterComponent;
@ViewChild('resultComponent') resultComponent: ResultComponent;
constructor(
private discoverStore: Store<DiscoverStore.State>,
) {
this.height = window.innerHeight * 0.9;
}
ngOnInit() {
this.selectedProbe = this.probe;
}
ngAfterContentInit() {
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['visible']) {
const change = changes['visible'];
if (!change.previousValue && change.currentValue) {
this.initAll();
} else if (change.previousValue && !change.currentValue) {
this.destroyAll();
}
}
}
ngOnDestroy() {
this.selectedProbe = null;
this.started = false;
this.close.emit();
this.requestStart = false;
}
initAll() {
this.ngOnInit();
if (this.probeSelectorComponent) {
this.probeSelectorComponent.ngOnInit();
}
if (this.filterComponent) {
this.filterComponent.ngOnInit();
}
if (this.resultComponent) {
this.resultComponent.ngOnInit();
}
}
destroyAll() {
this.ngOnDestroy();
if (this.probeSelectorComponent) {
this.probeSelectorComponent.ngOnDestroy();
}
if (this.filterComponent) {
this.filterComponent.ngOnDestroy();
}
if (this.resultComponent) {
this.resultComponent.ngOnDestroy();
}
}
onProbeSelect(probe: Probe) {
this.selectedProbe = probe;
}
onDiscoveryStart(discoverZone: DiscoverZone) {
this.filterData = discoverZone;
this.discoverStore.dispatch(new DiscoverStore.DiscoverZone(
{ probeID: this.selectedProbe.probeKey, discoverZone: discoverZone }));
setTimeout(() => {
this.started = true;
// this.requestStart = false;
});
}
onCancel() {
this.destroyAll();
}
onSave() {
this.resultComponent.save();
}
onStop() {
this.started = false;
}
onSummaryClick() {
if (this.started) {
return;
}
this.requestStart = false;
}
}

View File

@@ -0,0 +1,124 @@
<div *ngIf="!started">
<!-- <mat-dialog-actions fxLayoutAlign="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-button color="primary" (click)="discovery()">Start</button>
</mat-dialog-actions> -->
<div class="ui-g">
<!-- <p-card title="Zone" subtitle="{{cidr}}" styleClass="ui-card-shadow"> -->
<div *ngIf="probe">
{{probe.cidr}}
</div>
<div class="ui-g-12">
<of-probe-selector (probeSelected)="onProbeSelect($event)"></of-probe-selector>
</div>
<div *ngIf="probe" >
<div class="ui-g">
<div class="ui-g-12">
<p-checkbox name="group1" value="host" label="Host" inputId="la" [(ngModel)]="hostChecked" (onChange)="handleHostCheckChange($event)"></p-checkbox>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="startIP">
<label for="float-input">Start Ip</label>
</span>
</div>
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="endIP">
<label for="float-input">End Ip</label>
</span>
</div>
</div>
<div class="ui-g">
<div class="ui-g-12">
<p-checkbox name="group1" value="port" label="Port" [(ngModel)]="portChecked" inputId="la" (onChange)="handlePortCheckChange($event)"></p-checkbox>
</div>
<div class="ui-g-12">
<div class="ui-g-6">
TCP &nbsp;
<p-inputSwitch [(ngModel)]="tcpChecked"></p-inputSwitch>
</div>
<div class="ui-g-6">
UDP &nbsp;
<p-inputSwitch [(ngModel)]="udpChecked"></p-inputSwitch>
</div>
</div>
</div>
<div class="ui-g form-group">
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="startPort">
<label for="float-input">Start Port</label>
</span>
</div>
<div class="ui-g-12 ui-md-6">
<span class="ui-float-label">
<input id="float-input" type="text" size="30" pInputText [(ngModel)]="endPort">
<label for="float-input">End Port</label>
</span>
</div>
</div>
<!-- <p-listbox [options]="cities" [(ngModel)]="selectedCities" multiple="multiple" checkbox="checkbox" filter="filter" optionLabel="name">
<p-header>
<i class="fa fa-car"></i>
Cars
</p-header>
</p-listbox> -->
<div class="ui-g-12">
<div class="ui-g-12 ui-g-nopad">
<p-checkbox name="group1" value="service" label="Service" [(ngModel)]="serviceChecked" inputId="la" (onChange)="handleServiceCheckChange($event)"></p-checkbox>
</div>
<of-service-selector></of-service-selector>
</div>
<div>
<div dir="rtl">
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="closeDialog()"></button>
<button pButton [disabled]="!probe" type="button" label="Start" icon="fa-check" class="ui-button-width-fit" (click)="discovery()"></button>
</div>
</div>
</div>
</div>
<div *ngIf="started">
<p-card title="Discovery Result" [style]="{width: '100%'}" styleClass="ui-card-shadow">
<p-header>
</p-header>
<div class="ui-g-12">
<p-tree [value]="treeNodes" selectionMode="checkbox" [(selection)]="selectedNodes"></p-tree>
</div>
<!-- <div class="ui-g-12">Selected Nodes:
<span *ngFor="let file of filesTree4">{{file.label}} </span>
</div> -->
<p-footer>
<div dir="rtl">
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="closeDialog()"></button>
<button pButton type="button" label="Save" icon="fa-check" class="ui-button-width-fit" (click)="discoveryResultSave()"></button>
</div>
</p-footer>
</p-card>
<!-- <mat-dialog-actions fxLayoutAlign="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-button color="primary" (click)="discoveryResultSave()">Save</button>
</mat-dialog-actions> -->
</div>

View File

@@ -0,0 +1,793 @@
import { Component, OnInit, AfterContentInit, Output, EventEmitter, Input, OnDestroy } from '@angular/core';
import { Store, select, StateObservable } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import {
DiscoveryStartInfo,
DiscoverZone,
Zone,
DiscoverPort,
DiscoverService
} from '@overflow/commons-typescript/model/discovery';
import * as CIDR from 'ip-cidr';
import * as DiscoveredStore from '../../store/setting';
import { SettingSelector, DiscoverSelector } from '../../store';
import * as DiscoverStore from '../../store/discover';
import * as RegistStore from '../../store/regist';
import { Host } from '@overflow/commons-typescript/model/discovery';
import { Port } from '@overflow/commons-typescript/model/discovery';
import { Service } from '@overflow/commons-typescript/model/discovery';
import * as ProbeDetailStore from '@overflow/probe/store';
import { Probe } from '@overflow/commons-typescript/model/probe';
import { TreeNode } from 'primeng/primeng';
import { ListSelector as ProbeListSelector } from '@overflow/probe/store';
import * as ProbeListStore from '@overflow/probe/store/list';
import { AuthSelector } from '@overflow/member/store';
import { Domain } from '@overflow/commons-typescript/model/domain';
import { Subscription } from 'rxjs/Subscription';
@Component({
selector: 'of-discovery-setting',
templateUrl: './setting.component.html',
})
export class SettingComponent implements OnInit, AfterContentInit, OnDestroy {
@Input() probe: Probe; /* To determine valid range. */
@Output() close = new EventEmitter();
settingSucceed$: any;
discoveryResult$: any;
discoveryReq$: any;
discoveryStart$: any;
discoveryEnd$: any;
started = false;
startIP;
endIP;
startPort;
endPort;
hostChecked = ['host'];
portChecked = [];
serviceChecked = [];
tcpChecked = true;
udpChecked = true;
includeServices = [];
treeNodes = [];
selectedNodes = [];
zones: Map<string, Zone> = null;
checkedSet = new Set();
testObj: any[] = testDiscovery;
selectedDiscoveryResult: TreeNode[];
constructor(
private discoverdstore: Store<DiscoveredStore.State>,
private discoverstore: Store<DiscoverStore.State>,
private registStore: Store<RegistStore.State>,
private probeListStore: Store<ProbeListStore.State>
) {
this.settingSucceed$ = discoverdstore.pipe(select(SettingSelector.select('isStart')));
this.discoveryResult$ = discoverstore.pipe(select(DiscoverSelector.select('zones')));
this.discoveryReq$ = discoverstore.pipe(select(DiscoverSelector.select('isReq')));
this.discoveryStart$ = discoverstore.pipe(select(DiscoverSelector.select('isStart')));
this.discoveryEnd$ = discoverstore.pipe(select(DiscoverSelector.select('isEnd')));
}
ngOnInit() {
// this.settingSucceed$.subscribe(
// (succeed: boolean) => {
// if (succeed) {
// this.started = true;
// }
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
// this.discoveryResult$.subscribe(
// (zones: Map<string, Zone>) => {
// if (zones !== undefined && zones !== null) {
// console.log('ZoneZoneZoneZoneZoneZoneZone');
// // console.log(JSON.stringify(zones));
// this.treeNodes = this.convertTreeViewZone(zones);
// this.zones = zones;
// }
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
// this.discoveryReq$.subscribe(
// (isReq: boolean) => {
// if (isReq !== undefined && isReq !== null) {
// console.log('isReqisReqisReqisReq');
// }
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
// this.discoveryStart$.subscribe(
// (isStart: boolean) => {
// if (isStart !== undefined && isStart !== null) {
// console.log('isStartisStartisStart');
// }
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
// this.discoveryEnd$.subscribe(
// (isEnd: boolean) => {
// if (isEnd !== undefined && isEnd !== null) {
// console.log('isEndisEndisEndisEnd');
// }
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
}
ngAfterContentInit() {
if (this.probe === undefined || this.probe === null) {
} else {
this.hostRange();
this.portRange();
}
}
ngOnDestroy() {
}
onProbeSelect(event) {
this.probe = event.value;
this.hostRange();
this.portRange();
}
closeDialog() {
this.close.emit();
}
isZone(zone: Zone): boolean {
// for (let i = 0; i < this.treeNodes.length; ++i) {
// if (zone.iface === this.treeNodes[i].iface) {
// return true;
// }
// }
return false;
}
hostRange() {
const cidr = new CIDR(this.probe.cidr);
if (!cidr.isValid()) {
alert('Invalid cidr : ' + this.probe.cidr);
return;
}
this.startIP = cidr.addressStart.address;
this.endIP = cidr.addressEnd.address;
}
portRange() {
this.startPort = '1';
this.endPort = '1024';
}
handleHostCheckChange(e: any) {
this.hostChecked = ['host'];
}
handlePortCheckChange(e: any) {
this.serviceChecked = [];
}
handleServiceCheckChange(e: any) {
if (e) {
this.portChecked = ['port'];
}
}
handleServiceChange(list: any) {
this.includeServices = list;
}
discovery() {
console.log(this.startIP);
console.log(this.startPort);
console.log(this.endPort);
let discoverPort: DiscoverPort = null;
let discoverService: DiscoverService = null;
if (this.serviceChecked.length > 0) {
const services = new Array();
for (const service of this.includeServices) {
services.push(service.name);
}
discoverService = {
includeServices: services,
};
}
if (this.portChecked.length > 0) {
discoverPort = {
firstScanRange: this.startPort,
lastScanRange: this.endPort,
includeTCP: this.tcpChecked,
includeUDP: this.udpChecked,
excludePorts: null,
discoverService: discoverService
};
}
const discoverZone: DiscoverZone = {
discoverHost: {
firstScanRangev4: this.startIP,
lastScanRangev4: this.endIP,
discoverPort: discoverPort,
},
};
console.log(discoverZone);
// console.log('start discovery - ' + this.probe.probeKey);
this.discoverstore.dispatch(new DiscoverStore.DiscoverZone(
{ probeID: this.probe.probeKey, discoverZone: discoverZone }));
this.started = true;
}
checkDiscoveryResult(node) {
node.toggleActivated(true);
if (node.isActive) {
if (node.data.obj !== undefined) {
node.data.obj.target = true;
}
} else {
if (node.data.obj !== undefined) {
node.data.obj.target = false;
}
}
console.log(this.zones);
}
convertMapToList(map: Map<any, any>): Array<any> {
if (undefined === map || null === map || map.size < 0) {
return null;
}
const retArr = new Array();
map.forEach((v: any, k: any) => {
retArr.push(v);
});
return retArr;
}
discoveryResultSave() {
// console.log(this.checkedSet);
// send discovery save this.zones;
// this.registStore.dispatch(new DiscoverStore.DiscoverZone(
// {probeID: '52abd6fd57e511e7ac52080027658d13', discoveryZone: discoveryZone}));
// console.log(this.zones);
// isTarget Check
for (const sn of this.selectedNodes) {
if (sn.obj !== undefined && sn.obj !== null) {
if (sn.obj.target !== undefined && sn.obj.target !== null) {
sn.obj.target = true;
}
}
}
this.zones.forEach((zone: Zone, key: string) => {
if (zone.hosts !== undefined && zone.hosts !== null && zone.hosts.size > 0) {
// FIXME: getHosts
const hosts: Host[] = [];
zone.hosts.forEach((h: Host, hKey: string) => {
h.zone = null;
if (h.ports !== undefined && h.ports !== null) {
h.portList = [];
h.ports.forEach((p: Port, pKey: number) => {
p.host = null;
if (p.services !== undefined && p.services !== null) {
p.serviceList = [];
p.services.forEach((s: Service, sKey: string) => {
s.port = null;
p.serviceList.push(s);
});
}
h.portList.push(p);
});
}
hosts.push(h);
});
if (hosts.length > 0) {
const sd: any = { hosts: hosts, probe: { id: 1 } };
console.log(JSON.stringify(sd));
console.log('--------');
this.registStore.dispatch(new RegistStore.DiscoverySaveAllTarget(sd));
}
}
});
}
handleClick(event) {
// console.log(this.filesTree4);
this.checkTarget(this.selectedDiscoveryResult);
console.log(this.testObj);
}
checkTarget(treeList: any[]) {
if (treeList === undefined || treeList === null) {
return;
}
for (let i = 0; i < treeList.length; ++i) {
treeList[i].obj.target = true;
this.checkTarget(treeList[i].children);
}
}
convertTreeViewZone(zones: Map<string, Zone>) {
if (zones === undefined || zones === null) {
return;
}
// console.log('convertTreeViewZone');
const treeNodes: any[] = [];
zones.forEach((value: Zone, key: string, map) => {
if (this.isZone(value)) {
return;
}
const jZone: any = {
label: 'Zone - ' + value.iface,
// className: 'cn' + value.ip,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jZone.obj = value;
jZone.children = this.convertViewHost(value.hosts);
treeNodes.push(jZone);
});
return treeNodes;
}
convertViewHost(hosts): any[] {
if (hosts === undefined || hosts === null) {
return null;
}
const hostNodes: any[] = [];
hosts.forEach((host, hostKey) => {
const jHost: any = {
label: 'Host - ' + host.ipv4,
// className: 'cn' + host.ip
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jHost.obj = host;
jHost.children = this.convertViewPort(host.ports);
hostNodes.push(jHost);
});
return hostNodes;
}
convertViewPort(ports): any[] {
if (ports === undefined || ports === null || ports.size < 0) {
return null;
}
const portChildren: any[] = [];
ports.forEach((port, portKey) => {
const jPort: any = {
label: 'Port - ' + port.portNumber,
// className: 'cn' + port.portNumber,
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
};
jPort.obj = port;
jPort.children = this.convertViewService(port.services);
portChildren.push(jPort);
});
return portChildren;
}
convertViewService(services): any[] {
if (services === undefined || services === null || services.size <= 0) {
return null;
}
const serviceChildren: any[] = [];
services.forEach((service, serviceKey) => {
const jService: any = {
label: 'Service - ' + service.serviceName,
// className: 'cn' + service.serviceName,
};
jService.obj = service;
serviceChildren.push(jService);
});
return serviceChildren;
}
}
const testDiscovery: any[] = [
{
id: 0,
ip: '192.168.1.254',
mac: '64:e5:99:63:e7:80',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'UDP',
portNumber: 53,
discoveredDate: -62135596800000,
host: null,
services: [
{
id: 0,
cryptoType: null,
serviceName: 'DNS',
discoveredDate: -62135596800000,
port: null,
target: false
}
]
}
]
},
{
id: 0,
ip: '192.168.1.99',
mac: '00:25:b3:fa:ca:9b',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'UDP',
portNumber: 161,
discoveredDate: -62135596800000,
host: null,
services: [
{
id: 0,
cryptoType: null,
serviceName: 'SNMP_V2',
discoveredDate: -62135596800000,
port: null,
target: false
}
]
},
{
id: 0,
portType: 'TCP',
portNumber: 7,
discoveredDate: -62135596800000,
host: null,
services: null
}
]
},
{
id: 0,
ip: '192.168.1.206',
mac: '30:9c:23:15:a3:09',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: null
},
{
id: 0,
ip: '192.168.1.50',
mac: '6c:f0:49:7a:60:68',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'TCP',
portNumber: 22,
discoveredDate: -62135596800000,
host: null,
services: [
{
id: 0,
cryptoType: 'TCP',
serviceName: 'SSH',
discoveredDate: -62135596800000,
port: null,
target: false
}
]
}
]
},
{
id: 0,
ip: '192.168.1.15',
mac: '00:19:b9:35:8e:a6',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'TCP',
portNumber: 22,
discoveredDate: -62135596800000,
host: null,
services: null
},
{
id: 0,
portType: 'TCP',
portNumber: 25,
discoveredDate: -62135596800000,
host: null,
services: null
}
]
},
{
id: 0,
ip: '192.168.1.100',
mac: '00:17:08:8d:cf:f7',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'UDP',
portNumber: 161,
discoveredDate: -62135596800000,
host: null,
services: [
{
id: 0,
cryptoType: null,
serviceName: 'SNMP_V2',
discoveredDate: -62135596800000,
port: null,
target: false
}
]
},
{
id: 0,
portType: 'TCP',
portNumber: 23,
discoveredDate: -62135596800000,
host: null,
services: null
},
{
id: 0,
portType: 'TCP',
portNumber: 21,
discoveredDate: -62135596800000,
host: null,
services: null
}
]
},
{
id: 0,
ip: '192.168.1.16',
mac: '00:19:b9:19:7e:c7',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'TCP',
portNumber: 22,
discoveredDate: -62135596800000,
host: null,
services: null
}
]
},
{
id: 0,
ip: '192.168.1.106',
mac: '44:8a:5b:f1:3a:7d',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'UDP',
portNumber: 161,
discoveredDate: -62135596800000,
host: null,
services: [
{
id: 0,
cryptoType: null,
serviceName: 'SNMP_V2',
discoveredDate: -62135596800000,
port: null,
target: false
}
]
},
{
id: 0,
portType: 'TCP',
portNumber: 21,
discoveredDate: -62135596800000,
host: null,
services: null
}
]
},
{
id: 0,
ip: '192.168.1.101',
mac: '44:8a:5b:f1:f1:f3',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: null
},
{
id: 0,
ip: '192.168.1.102',
mac: '44:8a:5b:f1:f2:d3',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: null
},
{
id: 0,
ip: '192.168.1.205',
mac: '40:98:ad:7b:d0:43',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: null
},
{
id: 0,
ip: '192.168.1.103',
mac: '44:8a:5b:44:8c:e8',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'TCP',
portNumber: 21,
discoveredDate: -62135596800000,
host: null,
services: null
}
]
},
{
id: 0,
ip: '192.168.1.10',
mac: 'd0:50:99:97:5d:99',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: [
{
id: 0,
portType: 'TCP',
portNumber: 22,
discoveredDate: -62135596800000,
host: null,
services: null
}
]
},
{
id: 0,
ip: '192.168.1.203',
mac: 'a8:e5:39:5b:c9:62',
os: null,
discoveredDate: -62135596800000,
target: false,
zone: null,
ports: null
}
];