diff --git a/src/ts/@overflow/discovery/react/components/DiscoveryTree.tsx b/src/ts/@overflow/discovery/react/components/DiscoveryTree.tsx new file mode 100644 index 0000000..83d9db0 --- /dev/null +++ b/src/ts/@overflow/discovery/react/components/DiscoveryTree.tsx @@ -0,0 +1,301 @@ + +import * as React from 'react'; +// import update from 'immutability-helper'; + +import { + Checkbox, + Container, + Label, + Accordion, + Icon, + List, + ListItemProps, +} from 'semantic-ui-react'; + + +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 Utils from '@overflow/commons/util/Utils'; + +export interface DiscoveryResultProps { +} + +export interface DiscoveryResultState { + portState: { [key: number]: boolean; }; +} + + +export class DiscoveryTree extends React.Component { + + constructor(props: any, context: any) { + super(props, context); + + this.state = { + portState: {}, + }; + + + // fs.readFile('../../../../../dh.json', this.handlJSONFile); + } + + + public render(): JSX.Element { + + return ( + + + { + + jsonData.map((data: any, index: number) => { + let hh: Host = data; + this.state.portState[hh.ip] = false; + return ( + + + { + + + + {/*const newPortState = update.newContext()(this.state.portState, { + [hh.ip]: !this.state.portState[hh.ip] + });*/} + + {/*this.setState({ portState: newPortState });*/ } + + }} /> + + + + + Host + {this.state.portState[hh.ip] ? + hh.ports ? hh.ports.map((port: Port, idx: number) => { + + return ( + + + + + + Port + {port.services ? port.services.map((service: Service, sIdx: number) => { + return ( + + + + + + Service + + + + ); + }) : ''} + + + + ); + }) : '' : ''} + + + + ); + + })} + + + {/* + + + + + {this.state.tt ? + + Port 22 NOR + Port 443 TLS + Port 80 NOR + + : ''} + */} + + ); + } +} + +const jsonData = [{ + '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, +}, + + +]; diff --git a/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx b/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx index 58f890a..c81163a 100644 --- a/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx +++ b/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx @@ -102,6 +102,8 @@ export class CrawlerSelector extends React.Component { + this.setState({ + selectedCrawlerId: id, + }); + } + public render(): JSX.Element { - let steps = [, , ]; + let steps = [, + , ]; return (