Merge branch 'master' of https://git.loafle.net/overflow/overflow_app
This commit is contained in:
commit
c4220866ff
|
@ -43,6 +43,7 @@ import MetaSensorItemReadAllReducer from '@overflow/meta/redux/reducer/sensor_it
|
||||||
import MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_type_read_all';
|
import MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_type_read_all';
|
||||||
|
|
||||||
import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all';
|
import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all';
|
||||||
|
import DiscoveryIngReducer from '@overflow/discovery/redux/reducer/ing';
|
||||||
|
|
||||||
import HistoryReadAllByProbeReducer from '@overflow/history/redux/reducer/read_all_by_probe';
|
import HistoryReadAllByProbeReducer from '@overflow/history/redux/reducer/read_all_by_probe';
|
||||||
import HistoryReadAllByProbeAndTypeReducer from '@overflow/history/redux/reducer/read_all_by_probe_and_type';
|
import HistoryReadAllByProbeAndTypeReducer from '@overflow/history/redux/reducer/read_all_by_probe_and_type';
|
||||||
|
@ -132,6 +133,7 @@ const reduxConfig: ReduxConfig = {
|
||||||
noauthDenyReducer,
|
noauthDenyReducer,
|
||||||
modifyProbeReducer,
|
modifyProbeReducer,
|
||||||
DiscoveryInfraTargetRegistAllReducer,
|
DiscoveryInfraTargetRegistAllReducer,
|
||||||
|
DiscoveryIngReducer,
|
||||||
HistoryReadAllByProbeReducer,
|
HistoryReadAllByProbeReducer,
|
||||||
HistoryReadAllByProbeAndTypeReducer,
|
HistoryReadAllByProbeAndTypeReducer,
|
||||||
readAllTargetByInfraReducer,
|
readAllTargetByInfraReducer,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Service } from '@overflow/commons/api/service';
|
import { Service } from '@overflow/commons/api/service';
|
||||||
|
|
||||||
import DiscoveryIngActions from '../../redux/action/ing';
|
import * as DiscoveryIngActions from '../../redux/action/ing';
|
||||||
|
|
||||||
import Host from '../model/Host';
|
import Host from '../model/Host';
|
||||||
import Port from '../model/Port';
|
import Port from '../model/Port';
|
||||||
|
@ -17,6 +17,10 @@ export class DiscoveryService extends Service {
|
||||||
// state change test
|
// state change test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public discoveryIngTest(params: any): void {
|
||||||
|
console.log(params);
|
||||||
|
}
|
||||||
|
|
||||||
public discoveryIngHost(params: any): void {
|
public discoveryIngHost(params: any): void {
|
||||||
|
|
||||||
let host: Host = params;
|
let host: Host = params;
|
||||||
|
|
|
@ -26,6 +26,10 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): DiscoveryDispatchPr
|
||||||
dispatch(asyncRequestActions.request('TargetDiscoveryService', 'saveAllTarget',
|
dispatch(asyncRequestActions.request('TargetDiscoveryService', 'saveAllTarget',
|
||||||
InfraTargetRegistAllActionTypes.REQUEST, JSON.stringify(hosts), JSON.stringify(probe)));
|
InfraTargetRegistAllActionTypes.REQUEST, JSON.stringify(hosts), JSON.stringify(probe)));
|
||||||
},
|
},
|
||||||
|
onTestDiscovery: (types: string, obj: any) => {
|
||||||
|
dispatch(asyncRequestActions.request('DiscoveryService', 'testDiscovery',
|
||||||
|
'DiscoveryTTTTTEEEESSSTTT', types, JSON.stringify(obj)));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ export function mapStateToProps(state: any, props: any): DiscoveryTreeStateProps
|
||||||
return {
|
return {
|
||||||
probeId: props.probeId,
|
probeId: props.probeId,
|
||||||
onSetTargetList: props.onSetTargetList,
|
onSetTargetList: props.onSetTargetList,
|
||||||
|
hostList: state.hostList,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@ import DiscoveryTreeContainer from '../DiscoveryTree';
|
||||||
|
|
||||||
import Probe from '@overflow/probe/api/model/Probe';
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
import Host from '@overflow/discovery/api/model/Host';
|
import Host from '@overflow/discovery/api/model/Host';
|
||||||
|
import Port from '@overflow/discovery/api/model/Port';
|
||||||
|
import Service from '@overflow/discovery/api/model/Service';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
export interface StateProps {
|
export interface StateProps {
|
||||||
probeId?: Number;
|
probeId?: Number;
|
||||||
|
@ -23,6 +26,7 @@ export interface StateProps {
|
||||||
|
|
||||||
export interface DispatchProps {
|
export interface DispatchProps {
|
||||||
onCreateTarget?(hosts: Host[], probe: Probe): void;
|
onCreateTarget?(hosts: Host[], probe: Probe): void;
|
||||||
|
onTestDiscovery?(types: string, obj: any): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Props = StateProps & DispatchProps;
|
export type Props = StateProps & DispatchProps;
|
||||||
|
@ -38,12 +42,16 @@ export class Discovery extends React.Component<Props, State> {
|
||||||
private submitData: any;
|
private submitData: any;
|
||||||
private discoveryHosts: Array<Host>;
|
private discoveryHosts: Array<Host>;
|
||||||
|
|
||||||
|
private exDisHosts: Array<Host>;
|
||||||
|
|
||||||
public constructor(props: Props, context: State) {
|
public constructor(props: Props, context: State) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.handleProbeChange.bind(this);
|
this.handleProbeChange.bind(this);
|
||||||
this.state = {
|
this.state = {
|
||||||
startPopup: false,
|
startPopup: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.exDisHosts = hostListJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillMount(): void {
|
public componentWillMount(): void {
|
||||||
|
@ -78,6 +86,95 @@ export class Discovery extends React.Component<Props, State> {
|
||||||
|
|
||||||
public handleCancel = () => this.setState({ startPopup: false });
|
public handleCancel = () => this.setState({ startPopup: false });
|
||||||
|
|
||||||
|
public handleTest = () => {
|
||||||
|
|
||||||
|
let min: number = 1;
|
||||||
|
let max: number = 2;
|
||||||
|
|
||||||
|
let idx: number = Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
|
|
||||||
|
idx = 2;
|
||||||
|
|
||||||
|
switch(idx) {
|
||||||
|
case 1:
|
||||||
|
this.testHost();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.testPort();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.testService();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public testHost(): void {
|
||||||
|
let min: number = 0;
|
||||||
|
let max: number = this.exDisHosts.length - 1;
|
||||||
|
|
||||||
|
let idx: number = Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
|
|
||||||
|
console.log('idx ----' + idx);
|
||||||
|
let host: Host = this.exDisHosts[idx];
|
||||||
|
console.log(host);
|
||||||
|
let chkObj: Object = host;
|
||||||
|
if(chkObj.hasOwnProperty('ports')) {
|
||||||
|
host.ports = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.onTestDiscovery('1', host);
|
||||||
|
}
|
||||||
|
public testPort(): void {
|
||||||
|
let min: number = 0;
|
||||||
|
let max: number = this.exDisHosts.length - 1;
|
||||||
|
|
||||||
|
let idx: number = Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
|
|
||||||
|
console.log('host index - ' + idx);
|
||||||
|
let host: Host = this.exDisHosts[idx];
|
||||||
|
|
||||||
|
let checkObj: object = host;
|
||||||
|
if(checkObj.hasOwnProperty('ports') === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(host.ports === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// if(host.ports === undefined || host.ports === null) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
let portmin: number = 0;
|
||||||
|
let portmax: number = host.ports.length - 1;
|
||||||
|
|
||||||
|
let portIdx: number = Math.floor(Math.random() * (portmax - portmin + 1) + portmin);
|
||||||
|
|
||||||
|
let port: Port = host.ports[portIdx];
|
||||||
|
|
||||||
|
let cHost: Host = _.clone(host);
|
||||||
|
|
||||||
|
let chkObj: Object = cHost;
|
||||||
|
if(chkObj.hasOwnProperty('ports')) {
|
||||||
|
cHost.ports = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
port.host = cHost;
|
||||||
|
|
||||||
|
this.props.onTestDiscovery('2', port);
|
||||||
|
}
|
||||||
|
public testService(): void {
|
||||||
|
let min: number = 0;
|
||||||
|
let max: number = this.exDisHosts.length - 1;
|
||||||
|
|
||||||
|
let idx: number = Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
|
|
||||||
|
console.log('idx ----' + idx);
|
||||||
|
let host: Host = this.exDisHosts[idx];
|
||||||
|
console.log(host);
|
||||||
|
this.props.onTestDiscovery('1', this.exDisHosts[idx]);
|
||||||
|
}
|
||||||
|
|
||||||
public handlePopupClose = () => this.setState({ startPopup: false });
|
public handlePopupClose = () => this.setState({ startPopup: false });
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
|
@ -98,6 +195,7 @@ export class Discovery extends React.Component<Props, State> {
|
||||||
</Modal.Content>
|
</Modal.Content>
|
||||||
<Modal.Actions>
|
<Modal.Actions>
|
||||||
<Button onClick={this.handleCancel}> Cancel </Button>
|
<Button onClick={this.handleCancel}> Cancel </Button>
|
||||||
|
<Button onClick={this.handleTest}> Test </Button>
|
||||||
<Button onClick={this.handleSubmit.bind(this)} primary> Submit </Button>
|
<Button onClick={this.handleSubmit.bind(this)} primary> Submit </Button>
|
||||||
</Modal.Actions>
|
</Modal.Actions>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -114,3 +212,180 @@ export class Discovery extends React.Component<Props, State> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const hostListJson: any = [
|
||||||
|
{
|
||||||
|
'firstScanRange': 1,
|
||||||
|
'lastScanRange': 10000,
|
||||||
|
'name': '',
|
||||||
|
'ip': 3232235818,
|
||||||
|
'mac': 91754662925,
|
||||||
|
'os': 'Windows',
|
||||||
|
'ports': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'SSH',
|
||||||
|
'target': true,
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 22,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'HTTP',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 443,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'HTTP',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 80,
|
||||||
|
}],
|
||||||
|
'createDate': 1498470178000,
|
||||||
|
'updateDate': 1498470178000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'firstScanRange': 1,
|
||||||
|
'lastScanRange': 10000,
|
||||||
|
'name': '',
|
||||||
|
'ip': 3232235781,
|
||||||
|
'mac': 91754660625,
|
||||||
|
'os': 'Windows',
|
||||||
|
'ports': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'SSH',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 22,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'HTTP',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'HTTP',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 1936,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': null,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 443,
|
||||||
|
}],
|
||||||
|
'createDate': 1498470178000,
|
||||||
|
'updateDate': 1498470178000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'firstScanRange': 1,
|
||||||
|
'lastScanRange': 10000,
|
||||||
|
'name': '',
|
||||||
|
'ip': 3232235797,
|
||||||
|
'mac': 91754662913,
|
||||||
|
'os': 'Windows',
|
||||||
|
'target': true,
|
||||||
|
'ports': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'HTTP',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'SSH',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 22,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'HTTP',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 3343,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'services': [{
|
||||||
|
'createDate': -62135596800000,
|
||||||
|
'updateDate': -62135596800000,
|
||||||
|
'portType': 'TCP',
|
||||||
|
'serviceName': 'HTTP',
|
||||||
|
}],
|
||||||
|
'portType': 'TCP',
|
||||||
|
'portNumber': 443,
|
||||||
|
}],
|
||||||
|
'createDate': 1498470178000,
|
||||||
|
'updateDate': 1498470178000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'firstScanRange': 1,
|
||||||
|
'lastScanRange': 10000,
|
||||||
|
'name': '',
|
||||||
|
'ip': 3232235877,
|
||||||
|
'mac': 75361038758387,
|
||||||
|
'os': 'Windows',
|
||||||
|
'ports': null,
|
||||||
|
'createDate': 1498470179000,
|
||||||
|
'updateDate': 1498470179000,
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
|
@ -25,6 +25,7 @@ import * as Utils from '@overflow/commons/util/Utils';
|
||||||
|
|
||||||
export interface DiscoveryTreeStateProps {
|
export interface DiscoveryTreeStateProps {
|
||||||
probeId: number;
|
probeId: number;
|
||||||
|
hostList: Host[];
|
||||||
onSetTargetList(discoveryHosts: Array<Host>): void;
|
onSetTargetList(discoveryHosts: Array<Host>): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
|
||||||
this.selectedHostState = new Map;
|
this.selectedHostState = new Map;
|
||||||
this.selectedPortState = new Map;
|
this.selectedPortState = new Map;
|
||||||
this.selectedServiceState = new Map;
|
this.selectedServiceState = new Map;
|
||||||
this.discoveryHosts = hostListJson;
|
// this.discoveryHosts = hostListJson;
|
||||||
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
|
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
|
||||||
let checkObj: any = selectedObj;
|
let checkObj: any = selectedObj;
|
||||||
checkObj.target = checkProps.checked;
|
checkObj.target = checkProps.checked;
|
||||||
}
|
}
|
||||||
this.props.onSetTargetList(this.discoveryHosts);
|
// this.props.onSetTargetList(this.discoveryHosts);
|
||||||
// if(selectedObj instanceof Host) {
|
// if(selectedObj instanceof Host) {
|
||||||
// console.log(selectedObj);
|
// console.log(selectedObj);
|
||||||
// }
|
// }
|
||||||
|
@ -106,15 +107,19 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
|
||||||
|
|
||||||
public renderDiscovery(): JSX.Element[] {
|
public renderDiscovery(): JSX.Element[] {
|
||||||
|
|
||||||
|
if(this.props.hostList === undefined) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let elems: JSX.Element[] = new Array();
|
let elems: JSX.Element[] = new Array();
|
||||||
|
|
||||||
let hostList: Host[] = this.discoveryHosts;
|
let hostList: Host[] = this.props.hostList;
|
||||||
let host: Host;
|
let host: Host;
|
||||||
for (let index: number = 0; index < hostList.length; ++index) {
|
for (let index: number = 0; index < hostList.length; ++index) {
|
||||||
host = hostList[index];
|
host = hostList[index];
|
||||||
let key: string = String(host.ip);
|
let key: string = String(host.ip);
|
||||||
elems.push(
|
elems.push(
|
||||||
<List.Item key={key} >
|
<List.Item key={key + String(index)} >
|
||||||
<List.Icon name={host.ports ? (this.state.portState[key] ? 'chevron up' : 'chevron down') : 'file'}
|
<List.Icon name={host.ports ? (this.state.portState[key] ? 'chevron up' : 'chevron down') : 'file'}
|
||||||
onClick={this.onClickHost.bind(this, key)} />
|
onClick={this.onClickHost.bind(this, key)} />
|
||||||
<List.Content>
|
<List.Content>
|
||||||
|
@ -223,180 +228,6 @@ export class DiscoveryTree extends React.Component<DiscoveryTreeProps, Discovery
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const hostListJson: any = [
|
|
||||||
{
|
|
||||||
'firstScanRange': 1,
|
|
||||||
'lastScanRange': 10000,
|
|
||||||
'name': '',
|
|
||||||
'ip': 3232235818,
|
|
||||||
'mac': 91754662925,
|
|
||||||
'os': 'Windows',
|
|
||||||
'ports': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'SSH',
|
|
||||||
'target': true,
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 22,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'HTTP',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 443,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'HTTP',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 80,
|
|
||||||
}],
|
|
||||||
'createDate': 1498470178000,
|
|
||||||
'updateDate': 1498470178000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'firstScanRange': 1,
|
|
||||||
'lastScanRange': 10000,
|
|
||||||
'name': '',
|
|
||||||
'ip': 3232235781,
|
|
||||||
'mac': 91754660625,
|
|
||||||
'os': 'Windows',
|
|
||||||
'ports': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'SSH',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 22,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'HTTP',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 80,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'HTTP',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 1936,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': null,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 443,
|
|
||||||
}],
|
|
||||||
'createDate': 1498470178000,
|
|
||||||
'updateDate': 1498470178000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'firstScanRange': 1,
|
|
||||||
'lastScanRange': 10000,
|
|
||||||
'name': '',
|
|
||||||
'ip': 3232235797,
|
|
||||||
'mac': 91754662913,
|
|
||||||
'os': 'Windows',
|
|
||||||
'target': true,
|
|
||||||
'ports': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'HTTP',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 80,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'SSH',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 22,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'HTTP',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 3343,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'services': [{
|
|
||||||
'createDate': -62135596800000,
|
|
||||||
'updateDate': -62135596800000,
|
|
||||||
'portType': 'TCP',
|
|
||||||
'serviceName': 'HTTP',
|
|
||||||
}],
|
|
||||||
'portType': 'TCP',
|
|
||||||
'portNumber': 443,
|
|
||||||
}],
|
|
||||||
'createDate': 1498470178000,
|
|
||||||
'updateDate': 1498470178000,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'firstScanRange': 1,
|
|
||||||
'lastScanRange': 10000,
|
|
||||||
'name': '',
|
|
||||||
'ip': 3232235877,
|
|
||||||
'mac': 75361038758387,
|
|
||||||
'os': 'Windows',
|
|
||||||
'ports': null,
|
|
||||||
'createDate': 1498470179000,
|
|
||||||
'updateDate': 1498470179000,
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
const hostListJsonMini: any = [
|
const hostListJsonMini: any = [
|
||||||
|
|
|
@ -18,13 +18,14 @@ const reducer: ReducersMapObject = {
|
||||||
[IngActionTypes.RECEIVE_HOST]: (state: DiscoveryIngState = DiscoveryIngDefaultState,
|
[IngActionTypes.RECEIVE_HOST]: (state: DiscoveryIngState = DiscoveryIngDefaultState,
|
||||||
action: Action<Host>): DiscoveryIngState => {
|
action: Action<Host>): DiscoveryIngState => {
|
||||||
|
|
||||||
|
let obj: any = action.payload;
|
||||||
let hostList: Host[] = null;
|
let hostList: Host[] = null;
|
||||||
if(state.hostList === null || state.hostList === undefined) {
|
if(state.hostList === null || state.hostList === undefined) {
|
||||||
hostList = new Array();
|
hostList = new Array();
|
||||||
hostList.push(action.payload);
|
hostList.push(JSON.parse(obj));
|
||||||
} else {
|
} else {
|
||||||
hostList = _.clone(state.hostList);
|
hostList = _.clone(state.hostList);
|
||||||
hostList.push(action.payload);
|
hostList.push(JSON.parse(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -36,9 +37,10 @@ const reducer: ReducersMapObject = {
|
||||||
action: Action<Port>): DiscoveryIngState => {
|
action: Action<Port>): DiscoveryIngState => {
|
||||||
|
|
||||||
let hostList: Host[] = null;
|
let hostList: Host[] = null;
|
||||||
|
let obj: any = action.payload;
|
||||||
if(state.hostList === null || state.hostList === undefined) {
|
if(state.hostList === null || state.hostList === undefined) {
|
||||||
hostList = new Array();
|
hostList = new Array();
|
||||||
let port: Port = action.payload;
|
let port: Port = JSON.parse(obj);
|
||||||
let host: Host = _.clone(port.host);
|
let host: Host = _.clone(port.host);
|
||||||
host.ports = new Array();
|
host.ports = new Array();
|
||||||
port.host = host;
|
port.host = host;
|
||||||
|
@ -47,18 +49,33 @@ const reducer: ReducersMapObject = {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
hostList = _.clone(state.hostList);
|
hostList = _.clone(state.hostList);
|
||||||
let port: Port = action.payload;
|
let port: Port = JSON.parse(obj);
|
||||||
// let host: Host = _.clone(port.host);
|
// let host: Host = _.clone(port.host);
|
||||||
|
|
||||||
|
let tHost: Host = null;
|
||||||
for(let h of hostList) {
|
for(let h of hostList) {
|
||||||
if(h.ip === port.host.ip) {
|
if(h.ip === port.host.ip) {
|
||||||
|
tHost = h;
|
||||||
port.host = h;
|
port.host = h;
|
||||||
if(h.ports === null || h.ports === undefined) {
|
if(h.ports === null || h.ports === undefined) {
|
||||||
h.ports = new Array();
|
h.ports = new Array();
|
||||||
}
|
}
|
||||||
h.ports.push(port);
|
h.ports.push(port);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let dIdx: number = hostList.indexOf(tHost, 0);
|
||||||
|
if(dIdx > -1) {
|
||||||
|
hostList.slice(dIdx, 1);
|
||||||
|
hostList.push(tHost);
|
||||||
|
} else {
|
||||||
|
let host: Host = _.clone(port.host);
|
||||||
|
host.ports = new Array();
|
||||||
|
port.host = host;
|
||||||
|
host.ports.push(port);
|
||||||
|
hostList.push(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user