ing
This commit is contained in:
parent
25fa27babd
commit
6a8d99f56c
|
@ -86,29 +86,29 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
startDiscovery() {
|
startDiscovery() {
|
||||||
this.zone = {
|
// this.zone = {
|
||||||
network: '192.168.1.0/24',
|
// network: '192.168.1.0/24',
|
||||||
iface: 'enp3s0',
|
// iface: 'enp3s0',
|
||||||
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
|
// metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
|
||||||
address: '192.168.1.101',
|
// address: '192.168.1.101',
|
||||||
mac: '44:8a:5b:f1:f1:f3',
|
// mac: '44:8a:5b:f1:f1:f3',
|
||||||
};
|
// };
|
||||||
|
|
||||||
this.discoverHost = {
|
// this.discoverHost = {
|
||||||
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
|
// metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
|
||||||
firstScanRange: '192.168.1.1',
|
// firstScanRange: '192.168.1.1',
|
||||||
lastScanRange: '192.168.1.254',
|
// lastScanRange: '192.168.1.254',
|
||||||
discoveryConfig: {
|
// discoveryConfig: {
|
||||||
},
|
// },
|
||||||
discoverPort: {
|
// discoverPort: {
|
||||||
firstScanRange: 1,
|
// firstScanRange: 1,
|
||||||
lastScanRange: 65535,
|
// lastScanRange: 65535,
|
||||||
includeTCP: true,
|
// includeTCP: true,
|
||||||
includeUDP: true,
|
// includeUDP: true,
|
||||||
discoverService: {
|
// discoverService: {
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
console.log('########################################################');
|
console.log('########################################################');
|
||||||
console.log(this.zone);
|
console.log(this.zone);
|
||||||
|
|
|
@ -52,7 +52,7 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||||
|
|
||||||
menuHoverActive: boolean;
|
menuHoverActive: boolean;
|
||||||
|
|
||||||
started: boolean = false;
|
started = false;
|
||||||
|
|
||||||
@ViewChild('layoutContainer') layourContainerViewChild: ElementRef;
|
@ViewChild('layoutContainer') layourContainerViewChild: ElementRef;
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ import { DiscoverHost, Zone } from '@overflow/model/discovery';
|
||||||
import { toMetaIPType, MetaIPTypeEnum, MetaPortTypeEnum } from '@overflow/model/meta';
|
import { toMetaIPType, MetaIPTypeEnum, MetaPortTypeEnum } from '@overflow/model/meta';
|
||||||
import { DiscoveryConfigService } from '../service/discovery-config.service';
|
import { DiscoveryConfigService } from '../service/discovery-config.service';
|
||||||
|
|
||||||
|
const IPCIDR = require('ip-cidr');
|
||||||
const IPCIDR = require("ip-cidr");
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-scanner-setting-dropdown',
|
selector: 'app-scanner-setting-dropdown',
|
||||||
|
@ -57,9 +56,9 @@ export class ScannerSettingDropdownComponent implements OnInit {
|
||||||
|
|
||||||
this.firstIP = cidr.start();
|
this.firstIP = cidr.start();
|
||||||
this.lastIP = cidr.end();
|
this.lastIP = cidr.end();
|
||||||
this.includePortType = [MetaPortTypeEnum.TCP, MetaPortTypeEnum.UDP]
|
this.includePortType = [MetaPortTypeEnum.TCP, MetaPortTypeEnum.UDP];
|
||||||
this.firstPort = '1'
|
this.firstPort = '1';
|
||||||
this.lastPort = '65535'
|
this.lastPort = '65535';
|
||||||
this.ipErrMsg = '';
|
this.ipErrMsg = '';
|
||||||
this.portErrMsg = '';
|
this.portErrMsg = '';
|
||||||
|
|
||||||
|
@ -74,8 +73,8 @@ export class ScannerSettingDropdownComponent implements OnInit {
|
||||||
this.ipErrMsg = 'Invalid IP format.';
|
this.ipErrMsg = 'Invalid IP format.';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let from = idx === 0 ? value : this.firstIP;
|
const from = idx === 0 ? value : this.firstIP;
|
||||||
let to = idx === 1 ? value : this.lastIP;
|
const to = idx === 1 ? value : this.lastIP;
|
||||||
if (this.ipToNum(from) > this.ipToNum(to)) {
|
if (this.ipToNum(from) > this.ipToNum(to)) {
|
||||||
this.ipErrMsg = 'Invalid IP range.';
|
this.ipErrMsg = 'Invalid IP range.';
|
||||||
return;
|
return;
|
||||||
|
@ -101,15 +100,15 @@ export class ScannerSettingDropdownComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ipToNum(ip: string): number {
|
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) {
|
validatePort(value: string, idx: number) {
|
||||||
this.portErrMsg = '';
|
this.portErrMsg = '';
|
||||||
let fromStr = idx === 0 ? value : this.firstPort;
|
const fromStr = idx === 0 ? value : this.firstPort;
|
||||||
let toStr = idx === 1 ? value : this.lastPort;
|
const toStr = idx === 1 ? value : this.lastPort;
|
||||||
let from = Number(fromStr);
|
const from = Number(fromStr);
|
||||||
let to = Number(toStr)
|
const to = Number(toStr);
|
||||||
if (from === NaN || to === NaN) {
|
if (from === NaN || to === NaN) {
|
||||||
this.portErrMsg = 'Invalid Port Type.';
|
this.portErrMsg = 'Invalid Port Type.';
|
||||||
return;
|
return;
|
||||||
|
@ -156,14 +155,14 @@ export class ScannerSettingDropdownComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveLastCondition() {
|
saveLastCondition() {
|
||||||
var c: Condition = {
|
const c: Condition = {
|
||||||
ipType: this.ipType,
|
ipType: this.ipType,
|
||||||
firstIP: this.firstIP,
|
firstIP: this.firstIP,
|
||||||
lastIP: this.lastIP,
|
lastIP: this.lastIP,
|
||||||
includePortType: this.includePortType,
|
includePortType: this.includePortType,
|
||||||
firstPort: this.firstPort,
|
firstPort: this.firstPort,
|
||||||
lastPort: this.lastPort,
|
lastPort: this.lastPort,
|
||||||
}
|
};
|
||||||
this.lastCondition = c;
|
this.lastCondition = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,13 +190,14 @@ export class ScannerSettingDropdownComponent implements OnInit {
|
||||||
metaIPType: toMetaIPType(this.ipType),
|
metaIPType: toMetaIPType(this.ipType),
|
||||||
firstScanRange: this.firstIP,
|
firstScanRange: this.firstIP,
|
||||||
lastScanRange: this.lastIP,
|
lastScanRange: this.lastIP,
|
||||||
|
discoveryConfig: {},
|
||||||
discoverPort: {
|
discoverPort: {
|
||||||
firstScanRange: Number(this.firstPort),
|
firstScanRange: Number(this.firstPort),
|
||||||
lastScanRange: Number(this.lastPort),
|
lastScanRange: Number(this.lastPort),
|
||||||
includeTCP: this.includePortType.indexOf(MetaPortTypeEnum.TCP) !== -1 ? true : false,
|
includeTCP: this.includePortType.indexOf(MetaPortTypeEnum.TCP) !== -1 ? true : false,
|
||||||
includeUDP: this.includePortType.indexOf(MetaPortTypeEnum.UDP) !== -1 ? true : false,
|
includeUDP: this.includePortType.indexOf(MetaPortTypeEnum.UDP) !== -1 ? true : false,
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
this.ready.emit(discoverHost);
|
this.ready.emit(discoverHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user