This commit is contained in:
crusader 2018-09-11 10:40:28 +09:00
parent 25fa27babd
commit 6a8d99f56c
3 changed files with 38 additions and 38 deletions

View File

@ -86,29 +86,29 @@ export class HomePageComponent implements OnInit, OnDestroy {
}
startDiscovery() {
this.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',
};
// this.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',
// };
this.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.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: {
// }
// }
// };
console.log('########################################################');
console.log(this.zone);

View File

@ -52,7 +52,7 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
menuHoverActive: boolean;
started: boolean = false;
started = false;
@ViewChild('layoutContainer') layourContainerViewChild: ElementRef;

View File

@ -4,8 +4,7 @@ import { DiscoverHost, Zone } from '@overflow/model/discovery';
import { toMetaIPType, MetaIPTypeEnum, MetaPortTypeEnum } from '@overflow/model/meta';
import { DiscoveryConfigService } from '../service/discovery-config.service';
const IPCIDR = require("ip-cidr");
const IPCIDR = require('ip-cidr');
@Component({
selector: 'app-scanner-setting-dropdown',
@ -57,9 +56,9 @@ export class ScannerSettingDropdownComponent implements OnInit {
this.firstIP = cidr.start();
this.lastIP = cidr.end();
this.includePortType = [MetaPortTypeEnum.TCP, MetaPortTypeEnum.UDP]
this.firstPort = '1'
this.lastPort = '65535'
this.includePortType = [MetaPortTypeEnum.TCP, MetaPortTypeEnum.UDP];
this.firstPort = '1';
this.lastPort = '65535';
this.ipErrMsg = '';
this.portErrMsg = '';
@ -74,8 +73,8 @@ export class ScannerSettingDropdownComponent implements OnInit {
this.ipErrMsg = 'Invalid IP format.';
return;
}
let from = idx === 0 ? value : this.firstIP;
let to = idx === 1 ? value : this.lastIP;
const from = idx === 0 ? value : this.firstIP;
const to = idx === 1 ? value : this.lastIP;
if (this.ipToNum(from) > this.ipToNum(to)) {
this.ipErrMsg = 'Invalid IP range.';
return;
@ -101,15 +100,15 @@ export class ScannerSettingDropdownComponent implements OnInit {
}
ipToNum(ip: string): number {
return ip.split('.').reduce(function (ipInt, octet) { return (ipInt << 8) + parseInt(octet, 10) }, 0) >>> 0;
return ip.split('.').reduce(function (ipInt, octet) { return (ipInt << 8) + parseInt(octet, 10); }, 0) >>> 0;
}
validatePort(value: string, idx: number) {
this.portErrMsg = '';
let fromStr = idx === 0 ? value : this.firstPort;
let toStr = idx === 1 ? value : this.lastPort;
let from = Number(fromStr);
let to = Number(toStr)
const fromStr = idx === 0 ? value : this.firstPort;
const toStr = idx === 1 ? value : this.lastPort;
const from = Number(fromStr);
const to = Number(toStr);
if (from === NaN || to === NaN) {
this.portErrMsg = 'Invalid Port Type.';
return;
@ -156,14 +155,14 @@ export class ScannerSettingDropdownComponent implements OnInit {
}
saveLastCondition() {
var c: Condition = {
const c: Condition = {
ipType: this.ipType,
firstIP: this.firstIP,
lastIP: this.lastIP,
includePortType: this.includePortType,
firstPort: this.firstPort,
lastPort: this.lastPort,
}
};
this.lastCondition = c;
}
@ -191,13 +190,14 @@ export class ScannerSettingDropdownComponent implements OnInit {
metaIPType: toMetaIPType(this.ipType),
firstScanRange: this.firstIP,
lastScanRange: this.lastIP,
discoveryConfig: {},
discoverPort: {
firstScanRange: Number(this.firstPort),
lastScanRange: Number(this.lastPort),
includeTCP: this.includePortType.indexOf(MetaPortTypeEnum.TCP) !== -1 ? true : false,
includeUDP: this.includePortType.indexOf(MetaPortTypeEnum.UDP) !== -1 ? true : false,
}
}
};
this.ready.emit(discoverHost);
}