From 5f8e6475641f79515447ad334fea85458421b9c4 Mon Sep 17 00:00:00 2001 From: snoop Date: Tue, 27 Jun 2017 16:11:55 +0900 Subject: [PATCH] added discovery mode not entity --- .../overflow/module/discovery/model/Host.java | 100 ++++++++++++++ .../overflow/module/discovery/model/Port.java | 124 ++++++++++++++++++ .../module/discovery/model/Service.java | 87 ++++++++++++ .../module/discovery/type/PortType.java | 18 +++ 4 files changed, 329 insertions(+) create mode 100644 src/main/java/com/loafle/overflow/module/discovery/model/Host.java create mode 100644 src/main/java/com/loafle/overflow/module/discovery/model/Port.java create mode 100644 src/main/java/com/loafle/overflow/module/discovery/model/Service.java create mode 100644 src/main/java/com/loafle/overflow/module/discovery/type/PortType.java diff --git a/src/main/java/com/loafle/overflow/module/discovery/model/Host.java b/src/main/java/com/loafle/overflow/module/discovery/model/Host.java new file mode 100644 index 0000000..35a1c31 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/discovery/model/Host.java @@ -0,0 +1,100 @@ +package com.loafle.overflow.module.discovery.model; + + +import java.util.Date; +import java.util.List; + +/** + * Created by root on 17. 6. 4. + */ + +public class Host { + + + private long id; + private long ip; + private long mac; + + private Date createDate; + private Date updateDate; + + private String os; + private boolean target; + + + private List ports; + + public List getPorts() { + return ports; + } + + public void setPorts(List ports) { + this.ports = ports; + } + + + + + public Host(){} + + public Host(long ip, long mac){ + this.ip = ip; + this.mac = mac; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getIp() { + return ip; + } + + public void setIp(long ip) { + this.ip = ip; + } + + public long getMac() { + return mac; + } + + public void setMac(long mac) { + this.mac = mac; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + + public String getOs() { + return os; + } + + public void setOs(String os) { + this.os = os; + } + + public boolean isTarget() { + return target; + } + + public void setTarget(boolean target) { + this.target = target; + } +} diff --git a/src/main/java/com/loafle/overflow/module/discovery/model/Port.java b/src/main/java/com/loafle/overflow/module/discovery/model/Port.java new file mode 100644 index 0000000..aadd15d --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/discovery/model/Port.java @@ -0,0 +1,124 @@ +package com.loafle.overflow.module.discovery.model; + +/** + * Created by snoop on 17. 6. 27. + */ + + +import com.loafle.overflow.module.discovery.type.PortType; + + + +import java.util.Date; +import java.util.List; + +/** + * Created by root on 17. 6. 4. + */ + +public class Port { + + + private long id; + + + private Host host; + public Host getHost() { + return host; + } + + public void setHost(Host host) { + this.host = host; + } + + private PortType portType; + + + private int portNumber; + + + + private List services; + + public List getServices() { + return services; + } + + public void setServices(List services) { + this.services = services; + } + + + private Date createDate; + + + private Date updateDate; + + public Port() {} + + public Port(PortType type, int portNumber) { + this.portType = type; + this.portNumber = portNumber; + } + + public Port(Host host, PortType type, int portNumber) { + this.host = host; + this.portType = type; + this.portNumber = portNumber; + } + + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public PortType getPortType() { + return portType; + } + + public void setPortType(PortType portType) { + this.portType = portType; + } + + public int getPortNumber() { + return portNumber; + } + + public void setPortNumber(int portNumber) { + this.portNumber = portNumber; + } + + + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + + public void mappingChildren(Host discoveryHost) { + this.setHost(discoveryHost); + + + List discoveryServices = this.getServices(); + if (discoveryServices != null) { + for (int z = 0 ; z < discoveryServices.size() ; ++z) { + discoveryServices.get(z).setPort(this); + } + } + } +} diff --git a/src/main/java/com/loafle/overflow/module/discovery/model/Service.java b/src/main/java/com/loafle/overflow/module/discovery/model/Service.java new file mode 100644 index 0000000..e250cec --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/discovery/model/Service.java @@ -0,0 +1,87 @@ +package com.loafle.overflow.module.discovery.model; + + +import com.loafle.overflow.module.discovery.type.PortType; + +import java.util.Date; + +/** + * Created by root on 17. 6. 4. + */ + +public class Service { + + + private long id; + + + private Port port; + public Port getPort() { + return port; + } + + public void setPort(Port port) { + this.port = port; + } + + + private PortType portType; + + + private String serviceName; + + + private Date createDate; + + + private Date updateDate; + + public Service() {} + + public Service(Port port,PortType t, String serviceName) { + this.port = port; + this.portType = t; + this.serviceName = serviceName; + } + + public PortType getPortType() { + return portType; + } + + public void setPortType(PortType portType) { + this.portType = portType; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } +} diff --git a/src/main/java/com/loafle/overflow/module/discovery/type/PortType.java b/src/main/java/com/loafle/overflow/module/discovery/type/PortType.java new file mode 100644 index 0000000..c080c24 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/discovery/type/PortType.java @@ -0,0 +1,18 @@ +package com.loafle.overflow.module.discovery.type; + +/** + * Created by snoop on 17. 6. 27. + */ +public enum PortType { + TCP("TCP"), + UDP("UDP"), + TLS("TLS"); + + private String stringValue; + PortType(String string) {stringValue = string;} + + @Override + public String toString() { + return stringValue; + } +} \ No newline at end of file