This commit is contained in:
crusader 2018-09-04 01:12:10 +09:00
parent 09b3764f99
commit 160d40b455
20 changed files with 246 additions and 7 deletions

View File

@ -0,0 +1,2 @@
export interface Credential {
}

View File

@ -0,0 +1,14 @@
import { Credential } from './Credential';
export interface SNMPCredential extends Credential {
version?: string;
vommunity?: string;
authenticationType?: string;
user?: string;
password?: string;
encryptionType?: string;
dataEncryptionKey?: string;
contextName?: string;
port?: number;
timeout?: number;
}

View File

@ -0,0 +1,12 @@
import { Credential } from './Credential';
export interface UnixCredential extends Credential {
user?: string;
loginType?: string;
password?: string;
privateKey?: string;
sshPort?: number;
sshRightsElevationType?: string;
targetUser?: string;
targetUserPassword?: string;
}

View File

@ -0,0 +1,7 @@
import { Credential } from './Credential';
export interface SNMPCredential extends Credential {
domainName?: string;
user?: string;
password?: string;
}

View File

@ -0,0 +1,16 @@
import { DiscoverPort } from './DiscoverPort';
import { MetaIPType } from '../meta';
import { DiscoveryConfig } from './DiscoveryConfig';
export interface DiscoverHost {
discoveryConfig?: DiscoveryConfig;
metaIPType?: MetaIPType;
firstScanRange?: string;
lastScanRange?: string;
excludeHosts?: string[];
includeHosts?: string[];
discoverPort?: DiscoverPort;
}

View File

@ -0,0 +1,15 @@
import { DiscoverService } from './DiscoverService';
import { DiscoveryConfig } from './DiscoveryConfig';
export interface DiscoverPort {
discoveryConfig?: DiscoveryConfig;
firstScanRange?: number;
lastScanRange?: number;
excludePorts?: number[];
includeTCP?: boolean;
includeUDP?: boolean;
discoverService?: DiscoverService;
}

View File

@ -0,0 +1,7 @@
import { DiscoveryConfig } from './DiscoveryConfig';
export interface DiscoverService {
discoveryConfig?: DiscoveryConfig;
includeServices?: string[];
}

View File

@ -0,0 +1,6 @@
import { DiscoverHost } from './DiscoverHost';
export interface DiscoverZone {
excludePatterns?: string[];
discoverHost?: DiscoverHost;
}

View File

@ -0,0 +1,5 @@
import { DiscoverHost } from './DiscoverHost';
export interface DiscoveryConfig {
credentials?: Map<string, any[]>;
}

View File

@ -0,0 +1,16 @@
import { Zone } from './Zone';
import { Port } from './Port';
import { MetaIPType } from '../meta';
export interface Host {
metaIPType?: MetaIPType;
name?: string;
address?: string;
mac?: string;
meta?: Map<string, string>;
zone?: Zone;
portList?: Port[];
discoveredDate?: Date;
}

View File

@ -0,0 +1,14 @@
import { Host } from './Host';
import { Service } from './Service';
import { MetaPortType } from '../meta';
export interface Port {
metaPortType?: MetaPortType;
portNumber?: number;
meta?: Map<string, string>;
discoveredDate?: Date;
host?: Host;
serviceList?: Service[];
}

View File

@ -0,0 +1,13 @@
import { Port } from './Port';
import { MetaCryptoType } from '../meta';
export interface Service {
metaCryptoType?: MetaCryptoType;
key?: string;
description?: string;
meta?: Map<string, string>;
port?: Port;
discoveredDate?: Date;
}

View File

@ -0,0 +1,13 @@
import { Host } from './Host';
import { MetaIPType } from '../meta';
export interface Zone {
network?: string;
iface?: string;
metaIPType?: MetaIPType;
address?: string;
mac?: string;
meta?: Map<string, string>;
discoveredDate?: Date;
}

View File

@ -0,0 +1,9 @@
export * from './DiscoverHost';
export * from './DiscoverPort';
export * from './DiscoverService';
export * from './DiscoverZone';
export * from './Host';
export * from './Port';
export * from './Service';
export * from './Zone';

View File

@ -0,0 +1,29 @@
export interface MetaCredentialType {
id?: number;
name?: string;
key?: string;
createDate?: Date;
}
export enum MetaCredentialTypeEnum {
NONE = 'NONE',
Windows = 'WINDOWS',
Linux = 'LINUX',
Solaris = 'SOLARIS',
MacOS = 'MACOS',
VMWare = 'VMWARE',
XenServer = 'XENSERVER',
SNMP = 'SNMP',
Database = 'DATABASE',
AmazoneCloudWatch = 'AMAZON_CLOUDWATCH',
}
export const toMetaCredentialTypeEnum = (v: MetaCredentialType): MetaCredentialTypeEnum => {
return MetaCredentialTypeEnum[v.key];
};
export const toMetaCredentialType = (v: MetaCredentialTypeEnum): MetaCredentialType => {
return {
key: v,
};
};

View File

@ -39,7 +39,7 @@
"@ngrx/schematics": "^6.1.0", "@ngrx/schematics": "^6.1.0",
"@ngrx/store": "^6.1.0", "@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^6.1.0", "@ngrx/store-devtools": "^6.1.0",
"@overflow/rpc-js": "0.0.1", "@overflow/rpc-js": "0.0.2",
"@types/fs-extra": "^5.0.4", "@types/fs-extra": "^5.0.4",
"@types/jasmine": "~2.8.6", "@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",

View File

@ -1,5 +1,5 @@
<div class="home-start"> <div class="home-start">
<div class="start-button"> <div class="start-button" (click)="discoverHost($event)">
<svg version="1.1" viewBox="0 0 200 210"> <svg version="1.1" viewBox="0 0 200 210">
<path d="M8.3,193.5c0.1,2.4,0.8,4.9,2.1,7.1c4.5,7.7,14.3,10.4,22.1,5.9l152.1-87.8c2-1.3,3.8-3.1,5.1-5.4 <path d="M8.3,193.5c0.1,2.4,0.8,4.9,2.1,7.1c4.5,7.7,14.3,10.4,22.1,5.9l152.1-87.8c2-1.3,3.8-3.1,5.1-5.4
c4.5-7.7,1.8-17.6-5.9-22.1L31.6,3.4c-2.2-1.1-4.6-1.7-7.2-1.7c-8.9,0-16.2,7.2-16.2,16.2V193.5z" /> c4.5-7.7,1.8-17.6-5.9-22.1L31.6,3.4c-2.2-1.1-4.6-1.7-7.2-1.7c-8.9,0-16.2,7.2-16.2,16.2V193.5z" />

View File

@ -1,5 +1,14 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Observable, Subscription, of } from 'rxjs';
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
import { ProbeService } from '../../../commons/service/probe.service';
import { Interface } from '@overflow/model/net/nic';
import { Zone, DiscoverHost } from '@overflow/model/discovery';
import { toMetaIPType, MetaIPTypeEnum } from '@overflow/model/meta';
import { Address } from '../../../commons/component/nic-dropdown.component';
@Component({ @Component({
@ -12,8 +21,11 @@ export class HomePageComponent implements OnInit {
blockedPanel = false; blockedPanel = false;
blockedDocument = false; blockedDocument = false;
addresses: Address[];
constructor() { } constructor(
private probeService: ProbeService,
) { }
ngOnInit() { ngOnInit() {
} }
@ -25,4 +37,53 @@ export class HomePageComponent implements OnInit {
this.blockedDocument = false; this.blockedDocument = false;
}, 3000); }, 3000);
} }
discoverHost() {
const zone: Zone = {
network: '192.168.1.0/24',
iface: 'enp3s0',
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
address: '192.168.1.101',
mac: '44:8a:5b:f1:f1:f3',
};
const discoverHost: DiscoverHost = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
firstScanRange: '192.168.1.1',
lastScanRange: '192.168.1.254',
discoveryConfig: {
},
discoverPort: {
firstScanRange: 1,
lastScanRange: 65535,
includeTCP: true,
includeUDP: true,
discoverService: {
}
}
};
this.probeService.send('DiscoveryService.DiscoverHost', 'testRequesterID', zone, discoverHost);
// this.probeService.call<Interface>('MachineService.Interfaces').pipe(
// map((ifaces: Interface[]) => {
// console.log(ifaces);
// this.addresses = [];
// ifaces.forEach(iface => {
// iface.addresses.forEach(address => {
// this.addresses.push({
// label: address.address,
// value: address.address,
// });
// });
// });
// }),
// catchError(error => {
// console.log(error);
// return of();
// }),
// take(1),
// ).subscribe();
}
} }

View File

@ -9,7 +9,7 @@ import {
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
const config: WebSocketClientRWCConfig = { const config: WebSocketClientRWCConfig = {
url: 'ws://localhost:60000/' url: 'ws://localhost:60000/scanner'
}; };
const rwc = new WebSocketClientRWC(config); const rwc = new WebSocketClientRWC(config);
const codec = new JSONClientCodec(); const codec = new JSONClientCodec();

View File

@ -224,9 +224,9 @@
tree-kill "^1.0.0" tree-kill "^1.0.0"
webpack-sources "^1.1.0" webpack-sources "^1.1.0"
"@overflow/rpc-js@0.0.1": "@overflow/rpc-js@0.0.2":
version "0.0.1" version "0.0.2"
resolved "https://nexus.loafle.net/repository/npm-all/@overflow/rpc-js/-/rpc-js-0.0.1.tgz#471602a8a49f19c0ba888ad24717e9659493ed52" resolved "https://nexus.loafle.net/repository/npm-all/@overflow/rpc-js/-/rpc-js-0.0.2.tgz#16a628f988cb2994d5b02d0c871340d9df6819e2"
"@schematics/angular@0.7.3": "@schematics/angular@0.7.3":
version "0.7.3" version "0.7.3"