diff --git a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java index 87f8945c0..779681480 100644 --- a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java @@ -43,6 +43,19 @@ public class AppComplexFeatureCfg extends BaseCfg { private String appName; private List ipPortList = new ArrayList(); private String cfgRegionCode1; + //以下参数为APP PAYLOAD L3_HEADER的特殊属性(使用偏移表达式处理) + private String ver; + private String ihl; + private String tos; + private String totalLength; + private String flags; + private String fragmentOffset; + private String protocol; + private String icmpType; + private String icmpCode; + private String icmpIdentifier; + private String headerType; + public String getCfgRegionCode1() { return cfgRegionCode1; } @@ -197,5 +210,94 @@ public class AppComplexFeatureCfg extends BaseCfg { public void setIpPortList(List ipPortList) { this.ipPortList = ipPortList; } + + public String getVer() { + return ver; + } + + public void setVer(String ver) { + this.ver = ver; + } + + public String getIhl() { + return ihl; + } + + public void setIhl(String ihl) { + this.ihl = ihl; + } + + public String getTos() { + return tos; + } + + public void setTos(String tos) { + this.tos = tos; + } + + public String getTotalLength() { + return totalLength; + } + + public void setTotalLength(String totalLength) { + this.totalLength = totalLength; + } + + public String getFlags() { + return flags; + } + + public void setFlags(String flags) { + this.flags = flags; + } + + public String getFragmentOffset() { + return fragmentOffset; + } + + public void setFragmentOffset(String fragmentOffset) { + this.fragmentOffset = fragmentOffset; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getIcmpType() { + return icmpType; + } + + public void setIcmpType(String icmpType) { + this.icmpType = icmpType; + } + + public String getIcmpCode() { + return icmpCode; + } + + public void setIcmpCode(String icmpCode) { + this.icmpCode = icmpCode; + } + + public String getIcmpIdentifier() { + return icmpIdentifier; + } + + public void setIcmpIdentifier(String icmpIdentifier) { + this.icmpIdentifier = icmpIdentifier; + } + + public String getHeaderType() { + return headerType; + } + + public void setHeaderType(String headerType) { + this.headerType = headerType; + } + } diff --git a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml index 8c2bb17ed..e601d22d6 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml @@ -104,6 +104,17 @@ + + + + + + + + + + + @@ -191,7 +202,9 @@ r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY, r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE, - r.DISTRICT,r.CFG_KEYWORDS,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG + r.DISTRICT,r.CFG_KEYWORDS,r.EXPR_TYPE,r.MATCH_METHOD,r.IS_HEXBIN,r.DO_LOG, + r.ver,r.ihl,r.tos,r.total_length,r.flags,r.fragment_offset,r.protocol,r.icmp_type,r.icmp_code,r.icmp_identifier, + r.header_type @@ -526,14 +539,18 @@ CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME, SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY, ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE, - DISTRICT,CFG_KEYWORDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5 + DISTRICT,CFG_KEYWORDS,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5, + ver,ihl,tos,total_length,flags,fragment_offset,protocol,icmp_type,icmp_code,icmp_identifier,header_type )values ( , #{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER}, #{district,jdbcType=VARCHAR},#{cfgKeywords,jdbcType=VARCHAR}, #{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},#{isHexbin,jdbcType=INTEGER}, #{doLog,jdbcType=INTEGER},#{userRegion1,jdbcType=VARCHAR},#{userRegion2,jdbcType=VARCHAR}, - #{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR} + #{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}, + #{ver,jdbcType=VARCHAR},#{ihl,jdbcType=VARCHAR},#{tos,jdbcType=VARCHAR},#{totalLength,jdbcType=VARCHAR}, + #{flags,jdbcType=VARCHAR},#{fragmentOffset,jdbcType=VARCHAR},#{protocol,jdbcType=VARCHAR},#{icmpType,jdbcType=VARCHAR}, + #{icmpCode,jdbcType=VARCHAR},#{icmpIdentifier,jdbcType=VARCHAR},#{headerType,jdbcType=VARCHAR} ) diff --git a/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java b/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java index 1d8e2bbe3..9d3cf06f1 100644 --- a/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java @@ -105,8 +105,51 @@ public class AppMultiFeatureCfgService extends BaseService { } if(entity.getComplexList()!=null){ for(AppComplexFeatureCfg cfg:entity.getComplexList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("L3_header")){ BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setIsHex(1); + cfg.setIsCaseInsenstive(0); + cfg.setExprType(0); + String keyword = ""; + if(cfg.getHeaderType().equals("IP_header")){ + if(StringUtils.isNoneBlank(cfg.getVer())){ + keyword += "0-3:"+cfg.getVer()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getIhl())){ + keyword += "4-7:"+cfg.getIhl()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getTos())){ + keyword += "8-15:"+cfg.getTos()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getTotalLength())){ + keyword += "16-31:"+cfg.getTotalLength()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getFlags())){ + keyword += "48-50:"+cfg.getFlags()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getFragmentOffset())){ + keyword += "56-63:"+cfg.getFragmentOffset()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getProtocol())){ + keyword += "72-79:"+cfg.getProtocol()+"***and***"; + } + }else{ + if(StringUtils.isNoneBlank(cfg.getIcmpType())){ + keyword += "0-7:"+cfg.getIcmpType()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getIcmpCode())){ + keyword += "8-15:"+cfg.getIcmpCode()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getIcmpIdentifier())){ + keyword += "32-47:"+cfg.getIcmpIdentifier()+"***and***"; + } + } + keyword=keyword.substring(0,keyword.lastIndexOf("***and***")); + cfg.setCfgKeywords(keyword); + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + }else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setHeaderType(null); appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); } @@ -155,9 +198,52 @@ public class AppMultiFeatureCfgService extends BaseService { } if(entity.getComplexList()!=null){ for(AppComplexFeatureCfg cfg:entity.getComplexList()){ - if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ - BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + if(StringUtils.isNotBlank(cfg.getDistrict()) && cfg.getDistrict().equals("L3_header")){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setIsHex(1); + cfg.setIsCaseInsenstive(0); + cfg.setExprType(0); + String keyword = ""; + if(cfg.getHeaderType().equals("IP_header")){ + if(StringUtils.isNoneBlank(cfg.getVer())){ + keyword += "0-3:"+cfg.getVer()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getIhl())){ + keyword += "4-7:"+cfg.getIhl()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getTos())){ + keyword += "8-15:"+cfg.getTos()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getTotalLength())){ + keyword += "16-31:"+cfg.getTotalLength()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getFlags())){ + keyword += "48-50:"+cfg.getFlags()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getFragmentOffset())){ + keyword += "56-63:"+cfg.getFragmentOffset()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getProtocol())){ + keyword += "72-79:"+cfg.getProtocol()+"***and***"; + } + }else{ + if(StringUtils.isNoneBlank(cfg.getIcmpType())){ + keyword += "0-7:"+cfg.getIcmpType()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getIcmpCode())){ + keyword += "8-15:"+cfg.getIcmpCode()+"***and***"; + } + if(StringUtils.isNotBlank(cfg.getIcmpIdentifier())){ + keyword += "32-47:"+cfg.getIcmpIdentifier()+"***and***"; + } + } + keyword=keyword.substring(0,keyword.lastIndexOf("***and***")); + cfg.setCfgKeywords(keyword); + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + }else if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + cfg.setHeaderType(null); + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); } } } diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 4819e8f28..5774d2e46 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1409,4 +1409,8 @@ desc=Desc unique_num=Unique import_limit_is=The maximum import size is upload_limit_is=The limitation of file uplaod is -count=Count \ No newline at end of file +count=Count +do_blacklist=Blacklist Option +l3_header_error=Only four attribute values are allowed to be entered at most +IP_HEADER=IP Header +ICMP_HEADER=ICMP Header \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 37b0822be..56c73d27c 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1413,4 +1413,8 @@ desc=Desc unique_num=Unique import_limit_is=The maximum import size is upload_limit_is=The limitation of file uplaod is -count=Count \ No newline at end of file +count=Count +do_blacklist=Blacklist Option +l3_header_error=Only four attribute values are allowed to be entered at most +IP_HEADER=IP Header +ICMP_HEADER=ICMP Header \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index bcfdff079..c4b531593 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1409,4 +1409,8 @@ desc=Desc unique_num=Unique import_limit_is=\u5BFC\u5165\u9650\u5236\u6700\u5927\u6761\u6570 upload_limit_is=\u6587\u4EF6\u4E0A\u4F20\u4E2A\u6570\u9650\u5236 -count=\u6570\u91CF \ No newline at end of file +count=\u6570\u91CF +do_blacklist=Blacklist Option +l3_header_error=Only four attribute values are allowed to be entered at most +IP_HEADER=IP Header +ICMP_HEADER=ICMP Header \ No newline at end of file diff --git a/src/main/resources/sql/20181222/add_app_feature_column b/src/main/resources/sql/20181222/add_app_feature_column new file mode 100644 index 000000000..9054704b5 --- /dev/null +++ b/src/main/resources/sql/20181222/add_app_feature_column @@ -0,0 +1,11 @@ +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `header_type` varchar(16) NULL DEFAULT '' AFTER `user_region5`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `ver` varchar(4) NULL DEFAULT '' AFTER `header_type`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `ihl` varchar(4) NULL DEFAULT '' AFTER `ver`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `tos` varchar(8) NULL DEFAULT '' AFTER `ihl`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `total_length` varchar(16) NULL DEFAULT '' AFTER `tos`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `flags` varchar(3) NULL DEFAULT '' AFTER `total_length`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `fragment_offset` varchar(8) NULL DEFAULT '' AFTER `flags`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `protocol` varchar(8) NULL DEFAULT '' AFTER `fragment_offset`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `icmp_type` varchar(8) NULL DEFAULT '' AFTER `protocol`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `icmp_code` varchar(8) NULL DEFAULT '' AFTER `icmp_type`; +ALTER TABLE `app_complex_feature_cfg` ADD COLUMN `icmp_identifier` varchar(16) NULL DEFAULT '' AFTER `icmp_code`; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgForm.jsp index 6f13ddcfa..7063326bc 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgForm.jsp @@ -8,6 +8,41 @@ $(function(){ $(".action").on("change", function() { $("#serviceId").val($(this).attr("serviceId")); }); + $(".district").on("change", function() { + if($(this).val()=='L3_header'){ + $(this).parents(".boxSolid").find(".keywords").addClass("hidden"); + $(this).parents(".boxSolid").find(".L3_header").removeClass("hidden"); + $(this).parents(".boxSolid").find(".matchMethod").addClass("hidden"); + $(this).parents(".boxSolid").find(".exprType").addClass("hidden"); + $(this).parents(".boxSolid").find("input:radio[name$='isHex'][value=1]").prop("checked",true); + $(this).parents(".boxSolid").find("input:radio[name$='isCaseSenstive'][value=0]").prop("checked",true); + $(this).parents(".boxSolid").find("input:radio[name$='isHex']").attr("disabled",true); + $(this).parents(".boxSolid").find("input:radio[name$='isCaseSenstive']").attr("disabled",true); + $(this).parents(".boxSolid").find(".headerType").change(); + }else{ + $(this).parents(".boxSolid").find(".keywords").removeClass("hidden"); + $(this).parents(".boxSolid").find(".L3_header").addClass("hidden"); + $(this).parents(".boxSolid").find(".matchMethod").removeClass("hidden"); + $(this).parents(".boxSolid").find(".exprType").removeClass("hidden"); + $(this).parents(".boxSolid").find(".IP_header").addClass("hidden"); + $(this).parents(".boxSolid").find(".ICMP_header").addClass("hidden"); + $(this).parents(".boxSolid").find("input:radio[name$='isHex']").attr("disabled",false); + $(this).parents(".boxSolid").find("input:radio[name$='isCaseSenstive']").attr("disabled",false); + } + }); + + $(".headerType").on("change", function() { + if($(this).val()=='IP_header'){ + $(this).parents(".boxSolid").find(".ICMP_header").addClass("hidden"); + $(this).parents(".boxSolid").find(".IP_header").removeClass("hidden"); + }else{ + $(this).parents(".boxSolid").find(".IP_header").addClass("hidden"); + $(this).parents(".boxSolid").find(".ICMP_header").removeClass("hidden"); + } + }); + $(".boxSolid:visible").find(".district").each(function(){ + $(this).change(); + }); $("#serviceId").val($(".action:checked").attr("serviceId")); $("#cfgFrom").validate({ errorPlacement: function(error,element){ @@ -25,21 +60,35 @@ $(function(){ return; } $(".boxSolid:visible").find("input[name$='cfgKeywords']").each(function(){ + if($(this).val()==''){ - $(this).parents(".form-group").find( - "div[for='" - + $(this).attr("name") - + "']").html(""); - flag = false; + var length = 0; + $(this).parents(".boxSolid").find(".l3_header_prop").each(function(){ + if($(this).val()!=''){ + length += 1; + } + }) + if(length==0){ + $(this).parents(".form-group").find( + "div[for='" + + $(this).attr("name") + + "']").html(""); + flag = false; + }else if(length>4){ + $(this).parents(".boxSolid").find( + "div[class='l3_header_tips']").html(""); + flag = false; + } + } - }) + }); //keywords非空校验完成校验二进制字符串 $(".boxSolid:visible").find("select[name$='isHexbin']").each(function(){ var isHexbin=$(this).val(); if(isHexbin == 1){ //十六进制 var keywords=$("input[name$='"+$(this).attr("name").replace("isHexbin","cfgKeywords")+"']").val(); - keywords=keywords.replace("***and***","") - if(keywords != ''){ + keywords=keywords.replace("***and***",""); + if(keywords != ''){ if(!(/^([0-9|a-f|A-F]*)$/.test(keywords))){ $(this).parents(".boxSolid").find( "div[for='" @@ -109,6 +158,8 @@ var delContent = function(contentClassName, addBtnClassName) { code="required"> +
@@ -143,6 +194,7 @@ var delContent = function(contentClassName, addBtnClassName) { +
@@ -191,6 +243,7 @@ var delContent = function(contentClassName, addBtnClassName) { + diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appSubFeatureList.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appSubFeatureList.jsp index f23e4ebd7..f84164a85 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appSubFeatureList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appSubFeatureList.jsp @@ -256,13 +256,89 @@
-
-
-
- + + +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
-
-
+ +
diff --git a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp index 882cb7229..8691b240f 100644 --- a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp @@ -49,7 +49,7 @@
-
+
@@ -108,8 +108,127 @@
-
+ + + + + + + + + + +
+
-
+