diff --git a/.gitignore b/.gitignore index 33fa5d5..57b203d 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,6 @@ hs_err_pid* .settings/ .classpath .project -.vscode/settings.json \ No newline at end of file +.vscode/settings.json + +.vscode/ \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/HostDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/HostDao.java deleted file mode 100644 index 71276bc..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/HostDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.loafle.overflow.module.discovery.dao; - -import com.loafle.overflow.module.discovery.model.Host; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -/** - * Created by root on 17. 6. 4. - */ -@Repository -public interface HostDao extends JpaRepository { -} diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAHostDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/JPAHostDao.java deleted file mode 100644 index 201fce8..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAHostDao.java +++ /dev/null @@ -1,10 +0,0 @@ -//package com.loafle.overflow.module.discovery.dao; -// -//import com.loafle.overflow.commons.dao.JPABaseDAO; -//import com.loafle.overflow.module.discovery.model.Host; -// -///** -// * Created by root on 17. 6. 4. -// */ -//public class JPAHostDao extends JPABaseDAO implements HostDao { -//} diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAPortDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/JPAPortDao.java deleted file mode 100644 index e8085bc..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAPortDao.java +++ /dev/null @@ -1,10 +0,0 @@ -//package com.loafle.overflow.module.discovery.dao; -// -//import com.loafle.overflow.commons.dao.JPABaseDAO; -//import com.loafle.overflow.module.discovery.model.Port; -// -///** -// * Created by root on 17. 6. 4. -// */ -//public class JPAPortDao extends JPABaseDAO implements PortDao { -//} diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAServiceDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/JPAServiceDao.java deleted file mode 100644 index c2d5899..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAServiceDao.java +++ /dev/null @@ -1,10 +0,0 @@ -//package com.loafle.overflow.module.discovery.dao; -// -//import com.loafle.overflow.commons.dao.JPABaseDAO; -//import com.loafle.overflow.module.discovery.model.Service; -// -///** -// * Created by root on 17. 6. 4. -// */ -//public class JPAServiceDao extends JPABaseDAO implements ServiceDao { -//} diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAZoneDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/JPAZoneDao.java deleted file mode 100644 index ca35368..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/JPAZoneDao.java +++ /dev/null @@ -1,11 +0,0 @@ -//package com.loafle.overflow.module.discovery.dao; -// -// -//import com.loafle.overflow.commons.dao.JPABaseDAO; -//import com.loafle.overflow.module.discovery.model.Zone; -// -///** -// * Created by root on 17. 6. 4. -// */ -//public class JPAZoneDao extends JPABaseDAO implements ZoneDao { -//} diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/PortDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/PortDao.java deleted file mode 100644 index a4ec309..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/PortDao.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.loafle.overflow.module.discovery.dao; - -import com.loafle.overflow.module.discovery.model.Port; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -/** - * Created by root on 17. 6. 4. - */ - -@Repository -public interface PortDao extends JpaRepository { -} diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/ServiceDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/ServiceDao.java deleted file mode 100644 index 282e890..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/ServiceDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.loafle.overflow.module.discovery.dao; - -import com.loafle.overflow.module.discovery.model.Service; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -/** - * Created by root on 17. 6. 4. - */ -@Repository -public interface ServiceDao extends JpaRepository { -} diff --git a/src/main/java/com/loafle/overflow/module/discovery/dao/ZoneDao.java b/src/main/java/com/loafle/overflow/module/discovery/dao/ZoneDao.java deleted file mode 100644 index 1537fba..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/dao/ZoneDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.loafle.overflow.module.discovery.dao; - -import com.loafle.overflow.module.discovery.model.Zone; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -/** - * Created by root on 17. 6. 4. - */ -@Repository -public interface ZoneDao extends JpaRepository { -} 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 deleted file mode 100644 index 0ab41c7..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/model/Host.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.loafle.overflow.module.discovery.model; - -import org.codehaus.jackson.annotate.JsonIgnore; - -import javax.persistence.*; -import java.util.Date; -import java.util.List; - -/** - * Created by root on 17. 6. 4. - */ -@Entity -public class Host { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - @Column(name = "IP",nullable = false) - private long ip; - - @Column(name = "MAC",nullable = false) - private long mac; - - @ManyToOne - @JoinColumn(name = "ZONE_ID", nullable = false) - @JsonIgnore - private Zone zone; - - public Zone getZone() { - return zone; - } - - public void setZone(Zone zone) { - this.zone = zone; - } - - - - @OneToMany(mappedBy = "host",cascade = CascadeType.ALL) - private List ports; - - public List getPorts() { - return ports; - } - - public void setPorts(List ports) { - this.ports = ports; - } - - @Column(name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) - private Date createDate; - - @Column(name = "UPDATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false) - private Date updateDate; - - - 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 void mappingChildren(Zone discoveryZone) { - this.setZone(discoveryZone); - - List ports = this.getPorts(); - if (ports != null) { - for (int j =0 ; j < ports.size() ; ++j) { - ports.get(j).mappingChildren(this); - } - } - } -} 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 deleted file mode 100644 index 2cb0f74..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/model/Port.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.loafle.overflow.module.discovery.model; - -import com.loafle.overflow.module.discovery.type.PortType; -import org.codehaus.jackson.annotate.JsonIgnore; - -import javax.persistence.*; -import java.util.Date; -import java.util.List; - -/** - * Created by root on 17. 6. 4. - */ -@Entity -public class Port { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - @ManyToOne - @JoinColumn(nullable = false) - @JsonIgnore - private Host host; - public Host getHost() { - return host; - } - - public void setHost(Host host) { - this.host = host; - } - @Column(nullable = false) - @Enumerated(EnumType.STRING) - private PortType portType; - - @Column(nullable = false) - private int portNumber; - - - @OneToMany(mappedBy = "port" ,cascade = CascadeType.ALL) - private List services; - - public List getServices() { - return services; - } - - public void setServices(List services) { - this.services = services; - } - - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) - private Date createDate; - - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false) - 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 deleted file mode 100644 index e3856cf..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/model/Service.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.loafle.overflow.module.discovery.model; - -import com.loafle.overflow.module.discovery.type.PortType; -import org.codehaus.jackson.annotate.JsonIgnore; - -import javax.persistence.*; -import java.util.Date; - -/** - * Created by root on 17. 6. 4. - */ -@Entity -public class Service { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - @ManyToOne - @JoinColumn(nullable = false) - @JsonIgnore - private Port port; - public Port getPort() { - return port; - } - - public void setPort(Port port) { - this.port = port; - } - - @Column(nullable = false) - @Enumerated(EnumType.STRING) - private PortType portType; - - @Column(nullable = false) - private String serviceName; - - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) - private Date createDate; - - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false ,insertable = false) - 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/model/Zone.java b/src/main/java/com/loafle/overflow/module/discovery/model/Zone.java deleted file mode 100644 index 3249202..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/model/Zone.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.loafle.overflow.module.discovery.model; - -import javax.persistence.*; -import java.util.Date; -import java.util.List; - -/** - * Created by root on 17. 6. 4. - */ -@Entity -public class Zone { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - @Column(nullable=false) - private long ip; - - @Column(nullable=false) - private long cidr; - -// @JoinColumn(nullable=false) -// @OneToOne -// @JsonIgnore -// private DiscoveryHistory discovery; - -// @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) -// private List histories; - - @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) - private List hosts; - - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) - private Date createDate; - - @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false) - private Date updateDate; - - 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 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 getCidr() { - return cidr; - } - - public void setCidr(long cidr) { - this.cidr = cidr; - } - - - - - public List getHosts() { - return hosts; - } - - public void setHosts(List hosts) { - this.hosts = hosts; - } - -// public void mappingChildren(DiscoveryHistory history) { -// this.setDiscovery(history); -// List hostScanHistories = this.getHistories(); -// if (hostScanHistories != null) { -// for (int i =0 ; i < hostScanHistories.size() ; ++i) { -// hostScanHistories.get(i).setZone(this); -// } -// } -// -// List hosts = this.getHosts(); -// if (hosts != null) { -// for (int i =0 ; i < hosts.size() ; ++i) { -// hosts.get(i).mappingChildren(this); -// } -// } -// } -} diff --git a/src/main/java/com/loafle/overflow/module/discovery/type/DirectionType.java b/src/main/java/com/loafle/overflow/module/discovery/type/DirectionType.java deleted file mode 100644 index 6f900df..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/type/DirectionType.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.loafle.overflow.module.discovery.type; - -/** - * Created by root on 16. 11. 15. - */ -public enum DirectionType { - Send("S"), - Recv("R"), - Timeout("T"), - Closed("C"); - - private String stringValue; - DirectionType(String string) {stringValue = string;} - @Override - public String toString() { - return stringValue; - } -} - 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 deleted file mode 100644 index 58dea4d..0000000 --- a/src/main/java/com/loafle/overflow/module/discovery/type/PortType.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.loafle.overflow.module.discovery.type; - -/** - * Created by root on 16. 11. 15. - */ - -public enum PortType { - TCP("TCP"), - UDP("UDP"), - TLS("TLS"); - - private String stringValue; - PortType(String string) {stringValue = string;} - - @Override - public String toString() { - return stringValue; - } -}