This commit is contained in:
insanity 2017-07-17 15:20:32 +09:00
commit 946b9ee43d
7 changed files with 258 additions and 161 deletions

View File

@ -0,0 +1,14 @@
import Port from './Port';
interface Host {
id?: number;
ip: number;
mac: number;
createDate?: Date;
updateDate: Date;
os: string;
target: boolean;
ports?: Port[];
}
export default Host;

View File

@ -0,0 +1,15 @@
import Host from './Host';
import Service from './Service';
import PortType from './PortType';
interface Port {
id?: number;
host: Host;
portType: PortType;
portNumber: number;
services?: Service[];
createDate?: Date;
updateDate: Date;
}
export default Port;

View File

@ -0,0 +1,10 @@
// enum PortType {
// TCP = 1,
// UDP = 2,
// TLS = 3,
// }
type PortType = 'TCP' | 'UDP' | 'TLS';
export default PortType;

View File

@ -0,0 +1,14 @@
import Port from './Port';
import PortType from './PortType';
interface Service {
id: number;
port: Port;
portType: PortType;
serviceName: string;
createDate: Date;
updateDate: Date;
target: boolean;
}
export default Service;

View File

@ -16,6 +16,8 @@ export class DiscoveryDetails extends React.Component<any, any> {
};
}
componentWillMount() {
this.probeTemp =
{
@ -29,7 +31,8 @@ export class DiscoveryDetails extends React.Component<any, any> {
"host": {
"ip": "192.168.1.103",
"mac": "44:8a:5b:44:8c:e8",
"os": "Ubuntu 17.04"
"os": "Ubuntu 17.04",
"name": "?????"
},
"createAt": "2017-07-12",
"probeKey": "AGBLKDFJ2452ASDGFL2KWJLKSDJ",
@ -57,10 +60,10 @@ export class DiscoveryDetails extends React.Component<any, any> {
render() {
return (
<Container fluid>
<Header as='h3' dividing> Discovery Details</Header>
<DiscoveryProbe probe={this.probeTemp}/>
<br />
<DiscoveryTable onProbeChange={this.handleProbeChange.bind(this)} />
<Header as='h3' dividing> Discovery Details</Header>
<DiscoveryProbe probe={this.probeTemp}/>
<br />
<DiscoveryTable onProbeChange={this.handleProbeChange.bind(this)} />
<Modal size='small' open={this.state.startPopup} onClose={this.handlePopupClose}>
<Modal.Header>Change your password Enter email address.</Modal.Header>

View File

@ -42,31 +42,31 @@ export class DiscoveryTable extends React.Component<any, any> {
let value: string = data.value;
switch (data.tabIndex) {
case '0':{
case '1':{
this.setState({
startIp: value,
});
break;
}
case '1':{
case '2':{
this.setState({
endIP: value,
});
break;
}
case '2':{
case '3':{
this.setState({
excludeIp: value,
});
break;
}
case '3':{
case '4':{
this.setState({
startPort: value,
});
break;
}
case '4':{
case '5':{
this.setState({
endPort: value,
});

View File

@ -3,9 +3,11 @@ import * as React from 'react';
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 '../../../components/Utils';
export class Tree extends React.Component<any, any> {
@ -17,28 +19,67 @@ export class Tree extends React.Component<any, any> {
};
console.log(jsonData);
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
}
handlJSONFile = (err: any, data: any) => {
}
handlJSONFile = (err: any, data: any) => {
}
render() {
return (
<Container>
{jsonData.map((data: any) => {
})}
<List>
{
jsonData.map((data: any, index: number) => {
let hh: Host = data;
return (
<List.Item key={index}>
<List.Icon name='folder' />
<List.Content>
<List.Header>{Utils.int2ip(hh.ip)} {hh.os}</List.Header>
<List.Description>Host</List.Description>
{hh.ports ? hh.ports.map((port: Port, idx: number) => {
return (
<List.List key={idx * 1000}>
<List.Item>
<List.Icon name='folder' />
<List.Content>
<List.Header>{port.portNumber} {port.portType}</List.Header>
<List.Description>Port</List.Description>
{port.services ? port.services.map((service: Service, sIdx: number) => {
return (
<List.List key={sIdx * 10000}>
<List.Item>
<List.Icon name='folder' />
<List.Content>
<List.Header>{service.serviceName} {service.portType}</List.Header>
<List.Description>Service</List.Description>
</List.Content>
</List.Item>
</List.List>
);
}) : ''}
</List.Content>
</List.Item>
</List.List>
);
}) : ''}
</List.Content>
</List.Item>
);
})}
</List>
{/*<List>
<List.Item >
<Label basic onClick={() => {
this.setState({ tt: !this.state.tt });
@ -52,7 +93,7 @@ export class Tree extends React.Component<any, any> {
<List.Item>Port 80 NOR </List.Item>
</List.List>
</List.Item> : ''}
</List>
</List>*/}
</Container>
);
}
@ -69,7 +110,7 @@ const jsonData = [{
"name": "",
"ip": 3232235818,
"mac": 91754662925,
"os":"Windows",
"os": "Windows",
"ports": [{
"createDate": -62135596800000,
"updateDate": -62135596800000,
@ -78,161 +119,161 @@ const jsonData = [{
"updateDate": -62135596800000,
"portType": "TCP",
"serviceName": "SSH",
"target":true
"target": true
}],
"portType": "TCP",
"portNumber": 22
},
{
{
"createDate": -62135596800000,
"updateDate": -62135596800000,
"services": [{
"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
"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": [{
{
"firstScanRange": 1,
"lastScanRange": 10000,
"name": "",
"ip": 3232235781,
"mac": 91754660625,
"os": "Windows",
"ports": [{
"createDate": -62135596800000,
"updateDate": -62135596800000,
"services": [{
"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
"serviceName": "SSH"
}],
"portType": "TCP",
"portNumber": 22
},
{
"firstScanRange": 1,
"lastScanRange": 10000,
"name": "",
"ip": 3232235797,
"mac": 91754662913,
"os":"Windows",
"target":true,
"ports": [{
"createDate": -62135596800000,
"updateDate": -62135596800000,
"services": [{
"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
"serviceName": "HTTP"
}],
"portType": "TCP",
"portNumber": 80
},
{
"firstScanRange": 1,
"lastScanRange": 10000,
"name": "",
"ip": 3232235877,
"mac": 75361038758387,
"os":"Windows",
"ports": null,
"createDate": 1498470179000,
"updateDate": 1498470179000
}
"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
}
]