removed
disocvery
This commit is contained in:
parent
ea596d6926
commit
1facd88842
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -87,3 +87,5 @@ hs_err_pid*
|
|||
.classpath
|
||||
.project
|
||||
.vscode/settings.json
|
||||
|
||||
.vscode/
|
|
@ -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<Host, Long> {
|
||||
}
|
|
@ -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<Host> implements HostDao {
|
||||
//}
|
|
@ -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<Port> implements PortDao {
|
||||
//}
|
|
@ -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<Service> implements ServiceDao {
|
||||
//}
|
|
@ -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<Zone> implements ZoneDao {
|
||||
//}
|
|
@ -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<Port, Long> {
|
||||
}
|
|
@ -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<Service, Long> {
|
||||
}
|
|
@ -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<Zone, Long> {
|
||||
}
|
|
@ -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<Port> ports;
|
||||
|
||||
public List<Port> getPorts() {
|
||||
return ports;
|
||||
}
|
||||
|
||||
public void setPorts(List<Port> 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<Port> ports = this.getPorts();
|
||||
if (ports != null) {
|
||||
for (int j =0 ; j < ports.size() ; ++j) {
|
||||
ports.get(j).mappingChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<Service> services;
|
||||
|
||||
public List<Service> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
public void setServices(List<Service> 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<Service> discoveryServices = this.getServices();
|
||||
if (discoveryServices != null) {
|
||||
for (int z = 0 ; z < discoveryServices.size() ; ++z) {
|
||||
discoveryServices.get(z).setPort(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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<HostScanHistory> histories;
|
||||
|
||||
@OneToMany(mappedBy = "zone", cascade = CascadeType.ALL)
|
||||
private List<Host> 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<Host> getHosts() {
|
||||
return hosts;
|
||||
}
|
||||
|
||||
public void setHosts(List<Host> hosts) {
|
||||
this.hosts = hosts;
|
||||
}
|
||||
|
||||
// public void mappingChildren(DiscoveryHistory history) {
|
||||
// this.setDiscovery(history);
|
||||
// List<HostScanHistory> hostScanHistories = this.getHistories();
|
||||
// if (hostScanHistories != null) {
|
||||
// for (int i =0 ; i < hostScanHistories.size() ; ++i) {
|
||||
// hostScanHistories.get(i).setZone(this);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<Host> hosts = this.getHosts();
|
||||
// if (hosts != null) {
|
||||
// for (int i =0 ; i < hosts.size() ; ++i) {
|
||||
// hosts.get(i).mappingChildren(this);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user