bug fix in progress

This commit is contained in:
insanity 2018-06-14 12:11:56 +09:00
parent b42dcee8d0
commit 8f577acae4
9 changed files with 85 additions and 66 deletions

View File

@ -1,9 +1,8 @@
<h1>Discovery</h1> <h1>Discovery</h1>
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-12"> <div class="ui-g-12">
<of-zone-selector></of-zone-selector> <of-probe-selector [probeHostID]="probeHostID" (select)="selectedProbe=$event"></of-probe-selector>
<!-- <of-probe-selector [probeHostID]="probeHostID" (select)="selectedProbe=$event"></of-probe-selector> --> <of-probe-summary *ngIf="selectedProbe" @discoveryFilterAnim [probeHost]="selectedProbe"></of-probe-summary>
<!-- <of-probe-summary *ngIf="selectedProbe" @discoveryFilterAnim [probeHost]="selectedProbe"></of-probe-summary> -->
</div> </div>
</div> </div>
<div class="ui-g"> <div class="ui-g">
@ -22,12 +21,8 @@
<div class="ui-g-12 ui-md-9"> <div class="ui-g-12 ui-md-9">
<!-- <button class="ui-button-danger ui-button-width-fit" type="button" label="Stop" icon="ui-icon-close" pButton (click)="onRequestStop()"></button> --> <!-- <button class="ui-button-danger ui-button-width-fit" type="button" label="Stop" icon="ui-icon-close" pButton (click)="onRequestStop()"></button> -->
<of-discovery-result #discoveryResult *ngIf="requested else info" <of-discovery-result #discoveryResult *ngIf="requested else info" [probeHost]="selectedProbe" [filterWord]="filterWord" [filterServices]="filterServices"
[probeHost]="selectedProbe" [finished]="finished"></of-discovery-result>
[filterWord]="filterWord"
[filterServices]="filterServices"
[finished]="finished"
></of-discovery-result>
</div> </div>
</div> </div>

View File

@ -21,13 +21,13 @@ export class RequestSummaryComponent implements OnChanges {
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
this.hostRange = this.discoverZone.discoverHost.firstScanRangev4 // this.hostRange = this.discoverZone.discoverHost.firstScanRangev4
+ ' ~ ' // + ' ~ '
+ this.discoverZone.discoverHost.lastScanRangev4; // + this.discoverZone.discoverHost.lastScanRangev4;
this.portRange = this.discoverZone.discoverHost.discoverPort.firstScanRange // this.portRange = this.discoverZone.discoverHost.discoverPort.firstScanRange
+ ' ~ ' // + ' ~ '
+ this.discoverZone.discoverHost.discoverPort.lastScanRange; // + this.discoverZone.discoverHost.discoverPort.lastScanRange;
this.services = this.discoverZone.discoverHost.discoverPort.discoverService.includeServices; // this.services = this.discoverZone.discoverHost.discoverPort.discoverService.includeServices;
} }
} }

View File

@ -7,7 +7,7 @@ import * as CIDR from 'ip-cidr';
import * as ipRangeCheck from 'ip-range-check'; import * as ipRangeCheck from 'ip-range-check';
import { DiscoverPort, DiscoverService, DiscoverZone } from '@overflow/commons-typescript/model/discovery'; import { DiscoverPort, DiscoverService, DiscoverZone } from '@overflow/commons-typescript/model/discovery';
import { Checkbox } from 'primeng/primeng'; import { Checkbox } from 'primeng/primeng';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; import { MetaIPTypeEnum, toMetaIPType } from '@overflow/commons-typescript/model/meta';
@Component({ @Component({
selector: 'of-discovery-search-config', selector: 'of-discovery-search-config',
@ -20,7 +20,7 @@ export class SearchConfigComponent implements OnChanges {
@Input() probeHost: ProbeHost; @Input() probeHost: ProbeHost;
@Output() requestDiscovery = new EventEmitter<DiscoverZone>(); @Output() requestDiscovery = new EventEmitter<DiscoverZone>();
ipVer: string; ipType: MetaIPTypeEnum;
startIP: string; startIP: string;
endIP: string; endIP: string;
startPort: string; startPort: string;
@ -60,7 +60,7 @@ export class SearchConfigComponent implements OnChanges {
if (!cidr.isValid()) { if (!cidr.isValid()) {
return; return;
} }
this.ipVer = 'v4'; this.ipType = MetaIPTypeEnum.V4;
this.startIP = cidr.start(); this.startIP = cidr.start();
this.endIP = cidr.end(); this.endIP = cidr.end();
this.startPort = '1'; this.startPort = '1';
@ -122,10 +122,11 @@ export class SearchConfigComponent implements OnChanges {
} }
const discoverZone: DiscoverZone = { const discoverZone: DiscoverZone = {
discoverHost: { discoverHost: {
firstScanRangev4: this.startIP, metaIPType: toMetaIPType(this.ipType),
lastScanRangev4: this.endIP, firstScanRange: this.startIP,
lastScanRange: this.endIP,
discoverPort: discoverPort, discoverPort: discoverPort,
excludeHostsv4: this.excludeIPs, excludeHosts: this.excludeIPs,
}, },
}; };
@ -206,7 +207,7 @@ export class SearchConfigComponent implements OnChanges {
} }
isValidIPregex(ip: string): boolean { isValidIPregex(ip: string): boolean {
if (this.ipVer === 'v4') { if (this.ipType === MetaIPTypeEnum.V4) {
return /^(?=\d+\.\d+\.\d+\.\d+$)(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\.?){4}$/.test(ip); return /^(?=\d+\.\d+\.\d+\.\d+$)(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\.?){4}$/.test(ip);
} }
return false; return false;

View File

@ -1,19 +1,15 @@
import { import {
AfterContentInit, Component, Input, Component, Input,
EventEmitter,
Output,
SimpleChanges, SimpleChanges,
OnInit, OnInit,
OnChanges, OnChanges,
} from '@angular/core'; } from '@angular/core';
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators'; import { Subscription, Observable } from 'rxjs';
import { Subscription, Observable, of } from 'rxjs'; import { Host, Port, Service } from '@overflow/commons-typescript/model/discovery';
import { DiscoverZone, Zone, Host, Port, Service } from '@overflow/commons-typescript/model/discovery';
import { TreeNode, Message, Tree } from 'primeng/primeng'; import { TreeNode, Message, Tree } from 'primeng/primeng';
import { ProbeHost } from '@overflow/commons-typescript/model/probe'; import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { Anim } from './animation'; import { Anim } from './animation';
import { TargetService } from '@overflow/target/service/target.service'; import { TargetService } from '@overflow/target/service/target.service';
import { Target } from '@overflow/commons-typescript/model/target';
@Component({ @Component({
selector: 'of-discovery-result', selector: 'of-discovery-result',
@ -103,7 +99,7 @@ export class SearchResultComponent implements OnInit, OnChanges {
label: service.name + ' (' + service.port.portNumber + ')', label: service.name + ' (' + service.port.portNumber + ')',
data: { data: {
name: service.name, name: service.name,
portType: service.port.metaPortTypeKey, portType: service.port.metaPortType,
portNumber: service.port.portNumber, portNumber: service.port.portNumber,
target: service target: service
}, },

View File

@ -21,9 +21,9 @@
<i [ngClass]="expanded ? 'fa fa-fw fa-chevron-circle-down' : 'fa fa-fw fa-chevron-circle-right'"></i> <i [ngClass]="expanded ? 'fa fa-fw fa-chevron-circle-down' : 'fa fa-fw fa-chevron-circle-right'"></i>
</a> </a>
</td> </td>
<td>{{rowData.tempProbeKey}}</td> <td>{{rowData.apiKey}}</td>
<td>{{rowData.descriptions.host.name}}</td> <td>{{getInfraHostInfo(rowData.infraHostMeta, 'name')}}</td>
<td>{{rowData.descriptions.host.os}}</td> <td>{{getInfraHostInfo(rowData.infraHostMeta, 'os')}}</td>
<td>{{rowData.createDate | date: 'dd/MM/yyyy'}}</td> <td>{{rowData.createDate | date: 'dd/MM/yyyy'}}</td>
</tr> </tr>
</ng-template> </ng-template>
@ -34,17 +34,16 @@
<div class="ui-g-12 ui-md-6"> <div class="ui-g-12 ui-md-6">
<div class="ui-g-12"> <div class="ui-g-12">
<b>Platform:</b> {{rowData.descriptions.host.platform}} <b>Platform:</b> {{getInfraHostInfo(rowData.infraHostMeta, 'platform')}}
</div>
<div class="ui-g-12">
<b>Platform family:</b> {{rowData.descriptions.host.platformFamily}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>Kernel:</b> {{rowData.descriptions.host.kernelVersion}} <b>Platform family:</b> {{getInfraHostInfo(rowData.infraHostMeta, 'platformFamily')}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>HostID:</b> {{rowData.descriptions.host.hostID}} <b>Kernel:</b> {{getInfraHostInfo(rowData.infraHostMeta, 'kernelVersion')}}
</div>
<div class="ui-g-12">
<b>HostID:</b> {{getInfraHostInfo(rowData.infraHostMeta, 'hostID')}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>Connected:</b> <b>Connected:</b>
@ -58,16 +57,16 @@
<div class="ui-g-12 ui-md-6"> <div class="ui-g-12 ui-md-6">
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-12"> <div class="ui-g-12">
<b>NIC:</b> {{rowData.descriptions.network.name}} <b>NIC:</b> {{getInfraNetworkInfo(rowData.infraHostMeta, 'name')}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>Network Address:</b> {{rowData.descriptions.network.address}} <b>Network Address:</b> {{getInfraNetworkInfo(rowData.infraHostMeta, 'address')}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>Gateway:</b> {{rowData.descriptions.network.gateway}} <b>Gateway:</b> {{getInfraNetworkInfo(rowData.infraHostMeta, 'gateway')}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
<b>Mac Address:</b> {{rowData.descriptions.network.macAddress}} <b>Mac Address:</b> {{getInfraNetworkInfo(rowData.infraHostMeta, 'macAddress')}}
</div> </div>
<div class="ui-g-12"> <div class="ui-g-12">
</div> </div>

View File

@ -139,10 +139,6 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
if (null === noauthProbes) { if (null === noauthProbes) {
return; return;
} }
noauthProbes.forEach(noauthProbe => {
// FIXME
// noauthProbe.descriptions = JSON.parse(noauthProbe.description);
});
this.noauthProbes = noauthProbes; this.noauthProbes = noauthProbes;
} }
@ -150,5 +146,42 @@ export class NoAuthProbeListComponent implements OnInit, OnDestroy {
this.error$ = of(error); this.error$ = of(error);
} }
getInfraHostInfo(infraHostMeta: string, type: string): string {
const infraHost = JSON.parse(infraHostMeta);
switch (type) {
case 'name':
return infraHost.host.name;
case 'os':
let os = infraHost.host.os;
return os;
case 'platform':
return infraHost.host.platform;
case 'platformFamily':
return infraHost.host.platformFamily;
case 'kernelVersion':
return infraHost.host.kernelVersion;
case 'hostID':
return infraHost.host.hostID;
default:
return '';
}
}
getInfraNetworkInfo(infraHostMeta: string, type: string): string {
const infraHost = JSON.parse(infraHostMeta);
switch (type) {
case 'name':
return infraHost.network.name;
case 'address':
return infraHost.network.address;
case 'gateway':
return infraHost.network.gateway;
case 'macAddress':
return infraHost.network.macAddress;
default:
return '';
}
}
} }

11
package-lock.json generated
View File

@ -453,9 +453,9 @@
} }
}, },
"@overflow/commons-typescript": { "@overflow/commons-typescript": {
"version": "0.0.10", "version": "0.0.11",
"resolved": "https://nexus.loafle.net/repository/npm-all/@overflow/commons-typescript/-/commons-typescript-0.0.10.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/@overflow/commons-typescript/-/commons-typescript-0.0.11.tgz",
"integrity": "sha512-caZTr0lFFrJ5PF4G9pWYciOK7FGsxvpXBfhhECKrxdX5RqRS3cnai98aUiYsH6hB1mrQl+WaA5Twjp6miNt3NQ==" "integrity": "sha512-Gft8tJ9oSsGFWOnaqq3wd4liqmRZAzgdduQqy6xR4JRc2E6b30p/+RLy3o1VUhVO+KMsu2tYcpx/qpZfBgMj5Q=="
}, },
"@schematics/angular": { "@schematics/angular": {
"version": "0.6.5", "version": "0.6.5",
@ -6729,11 +6729,6 @@
"lower-case": "1.1.4" "lower-case": "1.1.4"
} }
}, },
"node-cidr": {
"version": "1.0.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/node-cidr/-/node-cidr-1.0.0.tgz",
"integrity": "sha512-F7KXTvJ1fyVVldfjO/MrZS7ux9nyE6GiMS2q3yNFZWrU6IHjHEOuQ7jQEArJf7/qvZO3k8RGu38GSxInz8TE1g=="
},
"node-fetch": { "node-fetch": {
"version": "1.7.3", "version": "1.7.3",
"resolved": "https://nexus.loafle.net/repository/npm-all/node-fetch/-/node-fetch-1.7.3.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/node-fetch/-/node-fetch-1.7.3.tgz",

View File

@ -37,7 +37,7 @@
"@ngrx/router-store": "^5.2.0", "@ngrx/router-store": "^5.2.0",
"@ngrx/store": "^5.2.0", "@ngrx/store": "^5.2.0",
"@ngrx/store-devtools": "^5.2.0", "@ngrx/store-devtools": "^5.2.0",
"@overflow/commons-typescript": "^0.0.10", "@overflow/commons-typescript": "^0.0.11",
"angular-google-recaptcha": "^1.0.3", "angular-google-recaptcha": "^1.0.3",
"angular-l10n": "^5.0.0", "angular-l10n": "^5.0.0",
"angularx-qrcode": "^1.1.7", "angularx-qrcode": "^1.1.7",

View File

@ -5,9 +5,9 @@
export const environment = { export const environment = {
production: false, production: false,
restBaseURL: 'http://192.168.1.50:19080/webapp', restBaseURL: 'http://192.168.1.101:19080/webapp',
webappRPCConfig: { webappRPCConfig: {
url: 'ws://192.168.1.50:19090/webapp', url: 'ws://192.168.1.101:19090/webapp',
reconnectInterval: 5000, reconnectInterval: 5000,
reconnectRetry: 10, reconnectRetry: 10,
}, },