Merge branch 'demostration_08' into 'develop'

Demostration 08

See merge request !33
This commit is contained in:
wangxin
2018-08-17 15:34:02 -04:00
9 changed files with 196 additions and 10 deletions

View File

@@ -51,10 +51,19 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private List<ComplexkeywordCfg> complexList; private List<ComplexkeywordCfg> complexList;
private List<BaseStringCfg> stringList; private List<BaseStringCfg> stringList;
private List<FileDigestCfg> digestList; private List<FileDigestCfg> digestList;
private List<NtcSubscribeIdCfg> ntcSubscribeIdCfgList;//新增SUBSCRIBE_ID
private NtcSubscribeIdCfg ntcSubscribeIdCfg;
private Long dnsStrategyId; private Long dnsStrategyId;
private String dnsStrategyName; private String dnsStrategyName;
public NtcSubscribeIdCfg getNtcSubscribeIdCfg() {
return ntcSubscribeIdCfg;
}
public void setNtcSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg) {
this.ntcSubscribeIdCfg = ntcSubscribeIdCfg;
}
public Long getDnsStrategyId() { public Long getDnsStrategyId() {
return dnsStrategyId; return dnsStrategyId;
} }

View File

@@ -0,0 +1,30 @@
package com.nis.domain.configuration;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
public class NtcSubscribeIdCfg extends BaseCfg<NtcSubscribeIdCfg> {
/**
*
*/
private static final long serialVersionUID = 9137401459733286997L;
/**
* 配置关键字
*/
@Expose
@SerializedName("keywords")
@ExcelField(title="key_word")
protected String cfgKeywords;
public String getCfgKeywords() {
return cfgKeywords;
}
public void setCfgKeywords(String cfgKeywords) {
this.cfgKeywords = cfgKeywords;
}
}

View File

@@ -7,6 +7,10 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.management.RuntimeErrorException;
import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringEscapeUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -388,7 +392,7 @@ public abstract class BaseService {
* @return * @return
*/ */
public static IpCfg ipConvert(IpCfg dstIp,BaseIpCfg srcIp){ public static IpCfg ipConvert(IpCfg dstIp,BaseIpCfg srcIp){
if(srcIp.getSrcIpAddress()!=null){ if(srcIp.getSrcIpAddress()!=null){
if(srcIp.getSrcIpAddress().indexOf("/")!=-1){ if(srcIp.getSrcIpAddress().indexOf("/")!=-1){
if(srcIp.getIpType()==4 || srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6 if(srcIp.getIpType()==4 || srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]); Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
@@ -403,6 +407,26 @@ public abstract class BaseService {
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress()); IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]); dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString()); dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {
Pattern patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP);
Pattern patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP);
Matcher matchernV4Subnet=patternV4Subnet.matcher(srcIp.getSrcIpAddress());
Matcher matcherV6Subnet=patternV6Subnet.matcher(srcIp.getSrcIpAddress());
if(matchernV4Subnet.matches()) {
Integer srcMaskNum = Integer.parseInt(srcIp.getSrcIpAddress().split("/")[1]);
if(srcMaskNum==0){
dstIp.setSrcIpMask("0.0.0.0");
}else{
dstIp.setSrcIpMask(IpUtil.convertMask(srcMaskNum));
}
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
}else if(matcherV6Subnet.matches()){
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getSrcIpAddress());
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("/")[0]);
dstIp.setSrcIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {
throw new RuntimeException("Invalid IP/subnet mask format");
}
} }
}else if(srcIp.getSrcIpAddress().indexOf("-")!=-1){ }else if(srcIp.getSrcIpAddress().indexOf("-")!=-1){
@@ -415,6 +439,23 @@ public abstract class BaseService {
IPv6Network network = IPv6Network.fromTwoAddresses(address1,address2); IPv6Network network = IPv6Network.fromTwoAddresses(address1,address2);
dstIp.setSrcIp(address1.toString()); dstIp.setSrcIp(address1.toString());
dstIp.setSrcIpMask(network.getNetmask().asAddress().toString()); dstIp.setSrcIpMask(network.getNetmask().asAddress().toString());
}else {
Pattern patternV4Range=Pattern.compile(Constants.IPV4_IP_RANGE_REGEXP);
Pattern patternV6Range=Pattern.compile(Constants.IPV6_IP_RANGE_REGEXP);
Matcher matcherV4Range=patternV4Range.matcher(srcIp.getSrcIpAddress());
Matcher matcherV6Range=patternV6Range.matcher(srcIp.getSrcIpAddress());
if(matcherV4Range.matches()) {
dstIp.setSrcIp(srcIp.getSrcIpAddress().split("-")[0]);
dstIp.setSrcIpMask(IpUtil.getMask(srcIp.getSrcIpAddress().split("-")[0], srcIp.getSrcIpAddress().split("-")[1]));
}else if(matcherV6Range.matches()) {
IPv6Address address1 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[0]);
IPv6Address address2 = IPv6Address.fromString(srcIp.getSrcIpAddress().split("-")[1]);
IPv6Network network = IPv6Network.fromTwoAddresses(address1,address2);
dstIp.setSrcIp(address1.toString());
dstIp.setSrcIpMask(network.getNetmask().asAddress().toString());
}else {
throw new RuntimeException("Invalid IP range format");
}
} }
}else{ }else{
@@ -424,6 +465,20 @@ public abstract class BaseService {
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4 }else if(srcIp.getIpType()==6|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress()); dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else {//all
Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP);
Matcher matcherV4=patternV4.matcher(srcIp.getSrcIpAddress());
Matcher matcherV6=patternV6.matcher(srcIp.getSrcIpAddress());
if(matcherV4.matches()) {
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
}else if(matcherV6.matches()) {
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else {
throw new RuntimeException("Invalid IP format");
}
} }
} }
@@ -434,6 +489,9 @@ public abstract class BaseService {
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4 }else if(srcIp.getIpType()==6|| srcIp.getIpType()==64){//64表示源ip为ipv6目的ip为ipv4
dstIp.setSrcIp(srcIp.getSrcIpAddress()); dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); dstIp.setSrcIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else {//all
dstIp.setSrcIp(srcIp.getSrcIpAddress());
dstIp.setSrcIpMask("255.255.255.255");
} }
} }
if(srcIp.getDestIpAddress()!=null){ if(srcIp.getDestIpAddress()!=null){
@@ -450,6 +508,26 @@ public abstract class BaseService {
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress()); IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]); dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString()); dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {
Pattern patternV4Subnet=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP);
Pattern patternV6Subnet=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP);
Matcher matchernV4Subnet=patternV4Subnet.matcher(srcIp.getDestIpAddress());
Matcher matcherV6Subnet=patternV6Subnet.matcher(srcIp.getDestIpAddress());
if(matchernV4Subnet.matches()) {
Integer dstMaskNum = Integer.parseInt(srcIp.getDestIpAddress().split("/")[1]);
if(dstMaskNum==0){
dstIp.setDstIpMask("0.0.0.0");
}else{
dstIp.setDstIpMask(IpUtil.convertMask(dstMaskNum));;
}
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
}else if(matcherV6Subnet.matches()){
IPv6Network strangeNetwork = IPv6Network.fromString(srcIp.getDestIpAddress());
dstIp.setDstIp(srcIp.getDestIpAddress().split("/")[0]);
dstIp.setDstIpMask(strangeNetwork.getNetmask().asAddress().toString());
}else {
throw new RuntimeException("Invalid IP/subnet mask format");
}
} }
}else if(srcIp.getDestIpAddress().indexOf("-")!=-1){ }else if(srcIp.getDestIpAddress().indexOf("-")!=-1){
@@ -462,6 +540,23 @@ public abstract class BaseService {
IPv6Network network = IPv6Network.fromTwoAddresses(address1,address2); IPv6Network network = IPv6Network.fromTwoAddresses(address1,address2);
dstIp.setDstIp(address1.toString()); dstIp.setDstIp(address1.toString());
dstIp.setDstIpMask(network.getNetmask().asAddress().toString()); dstIp.setDstIpMask(network.getNetmask().asAddress().toString());
}else {
Pattern patternV4Range=Pattern.compile(Constants.IPV4_IP_RANGE_REGEXP);
Pattern patternV6Range=Pattern.compile(Constants.IPV6_IP_RANGE_REGEXP);
Matcher matcherV4Range=patternV4Range.matcher(srcIp.getDestIpAddress());
Matcher matcherV6Range=patternV6Range.matcher(srcIp.getDestIpAddress());
if(matcherV4Range.matches()) {
dstIp.setDstIp(srcIp.getDestIpAddress().split("-")[0]);
dstIp.setDstIpMask(IpUtil.getMask(srcIp.getDestIpAddress().split("-")[0], srcIp.getDestIpAddress().split("-")[1]));
}else if(matcherV6Range.matches()) {
IPv6Address address1 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[0]);
IPv6Address address2 = IPv6Address.fromString(srcIp.getDestIpAddress().split("-")[1]);
IPv6Network network = IPv6Network.fromTwoAddresses(address1,address2);
dstIp.setDstIp(address1.toString());
dstIp.setDstIpMask(network.getNetmask().asAddress().toString());
}else {
throw new RuntimeException("Invalid IP range format");
}
} }
}else{ }else{
@@ -471,6 +566,20 @@ public abstract class BaseService {
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6 }else if(srcIp.getIpType()==6|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
dstIp.setDstIp(srcIp.getDestIpAddress()); dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else {//all
Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP);
Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP);
Matcher matcherV4=patternV4.matcher(srcIp.getDestIpAddress());
Matcher matcherV6=patternV6.matcher(srcIp.getDestIpAddress());
if(matcherV4.matches()) {
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("255.255.255.255");
}else if(matcherV6.matches()) {
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else {
throw new RuntimeException("invalid ip format");
}
} }
} }
@@ -481,6 +590,9 @@ public abstract class BaseService {
}else if(srcIp.getIpType()==6|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6 }else if(srcIp.getIpType()==6|| srcIp.getIpType()==46){//46表示源ip为ipv4目的ip为ipv6
dstIp.setDstIp(srcIp.getDestIpAddress()); dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"); dstIp.setDstIpMask("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF");
}else {//all
dstIp.setDstIp(srcIp.getDestIpAddress());
dstIp.setDstIpMask("255.255.255.255");
} }
} }
if(srcIp.getSrcPort()!=null){ if(srcIp.getSrcPort()!=null){

View File

@@ -62,6 +62,7 @@
<spring:message code="${regionValue}"></spring:message> <spring:message code="${regionValue}"></spring:message>
<small><spring:message code="date_list"/></small> <small><spring:message code="date_list"/></small>
</h3> </h3>
<h5 class="page-header"></h5>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="portlet"> <div class="portlet">

View File

@@ -67,6 +67,7 @@
<spring:message code="${regionValue}"></spring:message> <spring:message code="${regionValue}"></spring:message>
<small><spring:message code="date_list"/></small> <small><spring:message code="date_list"/></small>
</h3> </h3>
<h5 class="page-header"></h5>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="portlet"> <div class="portlet">

View File

@@ -115,6 +115,10 @@
} }
} }
}); });
var flag1=validateInvisibleCharTag();
if(flag){
flag=flag1;
}
if(flag){ if(flag){
//将disable属性的元素删除 //将disable属性的元素删除
$(".disabled").each(function(){ $(".disabled").each(function(){

View File

@@ -62,6 +62,8 @@
specServiceCodeCheck:"Protocol No is repeat.", specServiceCodeCheck:"Protocol No is repeat.",
compareDate:"The end time should not be earlier than the start time.", compareDate:"The end time should not be earlier than the start time.",
hexCheck:"Please enter the HEX format character", hexCheck:"Please enter the HEX format character",
invisibleChar:"Please enter the visible character" invisibleChar:"Please enter the visible character",
hasInvisibleChar:"The tag {0} has invisible character",
haveInvisibleChar:"The tags {0} have invisible character"
}); });
}(jQuery)); }(jQuery));

View File

@@ -62,6 +62,8 @@
specServiceCodeCheck:"协议号重复", specServiceCodeCheck:"协议号重复",
compareDate:"结束时间不能早于开始时间", compareDate:"结束时间不能早于开始时间",
hexCheck:"请输入十六进制字符", hexCheck:"请输入十六进制字符",
invisibleChar:"请输入可见字符" invisibleChar:"请输入可见字符",
hasInvisibleChar:"标签{0}包含不可见字符",
haveInvisibleChar:"标签{0}包含不可见字符"
}); });
}(jQuery)); }(jQuery));

View File

@@ -270,15 +270,22 @@ $(function(){
'delimiter':'***and***',//特殊字符串分隔与表达式的多关键词 'delimiter':'***and***',//特殊字符串分隔与表达式的多关键词
maxCount:4, maxCount:4,
onAddTag:function(tag,size){ onAddTag:function(tag,size){
//var keywordValue = ""; var reg = new RegExp(/\t|\r|\n/);
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0]; if (tag.match(reg)) {
/*$("span[class='tag']").each(function(){ $(this).parents(".col-md-6").next("div").html("<label class='error'>"+$.validator.messages.hasInvisibleChar.replace("{0}","'"+tag+"'")+"</label>");
keywordValue = keywordValue+"***iie***"+$(this).find("span").text().trim(); }else{
}); $(this).parents(".col-md-6").next("div").html("");
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/ }
//var keywordValue = "";
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
/*$("span[class='tag']").each(function(){
keywordValue = keywordValue+"***iie***"+$(this).find("span").text().trim();
});
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/
exprTypeChecked(objNamePrefix,size); exprTypeChecked(objNamePrefix,size);
}, },
onRemoveTag:function(tag,size){ onRemoveTag:function(tag,size){
$(this).parents(".col-md-6").next("div").html("");
//var keywordValue = ""; //var keywordValue = "";
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0]; var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
/*$("span[class='tag']").each(function(){ /*$("span[class='tag']").each(function(){
@@ -1139,4 +1146,22 @@ var importCfg=function(){
} }
$("#import_modal").modal('hide');//导入文件隐藏 $("#import_modal").modal('hide');//导入文件隐藏
$("#importForm1").submit(); $("#importForm1").submit();
} }
var validateInvisibleCharTag=function(){
var hasInvisibleCharTags=[];
var reg = new RegExp(/\t|\r|\n/);
$(".tagsinput").find(".tag").each(function(){
var text=$(this).children("span").text();
if (text.match(reg)) {
hasInvisibleCharTags.push("'"+text.trim()+"'");
}
});
if(hasInvisibleCharTags.length==1){
$(".tagsinput").parents(".col-md-6").next("div").html("<label class='error'>"+$.validator.messages.hasInvisibleChar.replace("{0}",hasInvisibleCharTags.join(","))+"</label>");
return false;
}else if(hasInvisibleCharTags.length>=1){
$(".tagsinput").parents(".col-md-6").next("div").html("<label class='error'>"+$.validator.messages.haveInvisibleChar.replace("{0}",hasInvisibleCharTags.join(","))+"</label>");
return false;
}
return true;
}