diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java b/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java index 4d27b7c..df60d33 100644 --- a/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java @@ -15,9 +15,7 @@ import java.util.Date; @Table(name = "NOAUTH_PROBE", schema = "public") public class NoAuthProbe { private long id; - private String hostName; - private long macAddress; - private long ipAddress; + private String description; private MetaNoAuthProbeStatus status; private String tempProbeKey; private Date createDate; @@ -35,33 +33,13 @@ public class NoAuthProbe { this.id = id; } - @Column(name = "HOST_NAME", nullable = true, length = 50) - public String getHostName() { - return hostName; + @Column(name = "DESCRIPTION", nullable = true, length = 1000) + public String getDescription() { + return description; } - public void setHostName(String hostName) { - this.hostName = hostName; - } - - - @Column(name = "MAC_ADDRESS", nullable = true) - public long getMacAddress() { - return macAddress; - } - - public void setMacAddress(long macAddress) { - this.macAddress = macAddress; - } - - - @Column(name = "IP_ADDRESS", nullable = true) - public long getIpAddress() { - return ipAddress; - } - - public void setIpAddress(long ipAddress) { - this.ipAddress = ipAddress; + public void setDescription(String description) { + this.description = description; } @ManyToOne diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java b/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java index b7f315e..c6c1507 100644 --- a/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java @@ -65,8 +65,11 @@ public class NoAuthProbeService { probe.setTargetCount(0); probe.setSensorCount(0); - String dispName = noAuth.getHostName().isEmpty() ? - StringConvertor.intToIp(noAuth.getIpAddress()) : noAuth.getHostName(); + + +// String dispName = noAuth.getHostName().isEmpty() ? +// StringConvertor.intToIp(noAuth.getIpAddress()) : noAuth.getHostName(); + String dispName = noAuth.getDescription(); probe.setDisplayName(dispName); probes.add(probe); diff --git a/src/main/resources/local/init.sql b/src/main/resources/local/init.sql index e3f59b1..305f2d2 100644 --- a/src/main/resources/local/init.sql +++ b/src/main/resources/local/init.sql @@ -1216,14 +1216,14 @@ INSERT INTO public.sensor_item (create_date,item_id,sensor_id) VALUES ( INSERT INTO public.sensor_item (create_date,item_id,sensor_id) VALUES ( '2017-09-11 12:26:02.738',115,5); -INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES ( -'52abd6fd57e511e7ac52080027658d13','2017-06-26 12:43:46.877','snoop',3232235980,8796753988883,'1cf2555c57d511e79714080027658d13',1,NULL,3); +INSERT INTO public.noauth_probe (api_key,create_date,description,temp_probe_key,domain_id,probe_id,status) VALUES ( +'52abd6fd57e511e7ac52080027658d13','2017-06-26 12:43:46.877','{"host":{"name":"geek-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"03000200-0400-0500-0006-000700080009"},"network":{"name":"enp3s0","address":"192.168.1.103/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d13',1,NULL,3); -INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES ( -'52abd6fd57e511e7ac52080027658d14','2017-08-11 12:43:46.877','geek',3232235980,8796753988883,'1cf2555c57d511e79714080027658d14',1,NULL,3); +INSERT INTO public.noauth_probe (api_key,create_date,description,temp_probe_key,domain_id,probe_id,status) VALUES ( +'52abd6fd57e511e7ac52080027658d14','2017-08-11 12:43:46.877','{"host":{"name":"insanity-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"4C4C4544-0044-4A10-8039-C7C04F595031"},"network":{"name":"enp3s0","address":"192.168.1.105/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d14',1,NULL,3); -INSERT INTO public.noauth_probe (api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES ( -'52abd6fd57e511e7ac52080027658d15','2017-08-11 12:43:46.877','insanity',3232235980,8796753988883,'1cf2555c57d511e79714080027658d15',1,NULL,3); +INSERT INTO public.noauth_probe (api_key,create_date,description,temp_probe_key,domain_id,probe_id,status) VALUES ( +'52abd6fd57e511e7ac52080027658d15','2017-08-11 12:43:46.877','{"host":{"name":"snoop-ubuntu","os":"linux","paltform":"ubuntu","platformFamily":"debian","platformVersion":"","kernelVersion":"4.4.0-93-generic","hostID":"DE60E4C3-347A-4D38-AEAB-1760471665EA"},"network":{"name":"enp3s0","address":"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64","gateway":"192.168.1.254","macAddress":"44:8a:5b:f1:f1:f3"}}','1cf2555c57d511e79714080027658d15',1,NULL,3); diff --git a/src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java b/src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java index 7d854dc..41789a9 100644 --- a/src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeServiceTest.java @@ -34,9 +34,11 @@ public class NoAuthProbeServiceTest { NoAuthProbe noAuthProbe = new NoAuthProbe(); - noAuthProbe.setHostName("snoop"); - noAuthProbe.setIpAddress(3232235980L); - noAuthProbe.setMacAddress(8796753988883L); +// noAuthProbe.setHostName("snoop"); +// noAuthProbe.setIpAddress(3232235980L); +// noAuthProbe.setMacAddress(8796753988883L); + noAuthProbe.setDescription("{\"host\":{\"name\":\"snoop-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"DE60E4C3-347A-4D38-AEAB-1760471665EA\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); + noAuthProbe.setApiKey("52abd6fd57e511e7ac52080027658d13"); MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); @@ -61,9 +63,10 @@ public class NoAuthProbeServiceTest { NoAuthProbe noAuthProbe = new NoAuthProbe(); - noAuthProbe.setHostName("geek"); - noAuthProbe.setIpAddress(3232235980L); - noAuthProbe.setMacAddress(8796753988883L); +// noAuthProbe.setHostName("geek"); +// noAuthProbe.setIpAddress(3232235980L); +// noAuthProbe.setMacAddress(8796753988883L); + noAuthProbe.setDescription("{\"host\":{\"name\":\"geek-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"03000200-0400-0500-0006-000700080009\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.103/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); noAuthProbe.setApiKey("521abd6fd57e511e7ac52080027658d13"); MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();