diff --git a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java index 230713804..1fd72b9e4 100644 --- a/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppComplexFeatureCfg.java @@ -44,23 +44,43 @@ public class AppComplexFeatureCfg extends BaseCfg { 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; + private String ver; // s: 为session组件复用时的属性含义 // s:传输协议 + private String ihl; // s:L7层协议未知× + private String tos; // s:L7层协议 + private String totalLength; // s:链接建立方式 + private String flags; // s:TCP包发送特性 + private String fragmentOffset; // s:域名初筛标识 + private String protocol; // s:S2C Frequent Payload Size + private String icmpType; // s:S2C Payload Size Sequence + private String icmpCode; // s:C2S Frequent Payload Size + private String icmpIdentifier; // s:C2S Payload Size Sequence + private String headerType; // s:传输服务端端口 + //以下参数为APP payload payload的特殊属性(偏移量表达式时处理) - private Integer payloadOffset; - private Integer payloadSize;//下发综合服务接口时,为单独的域配置 - private String payloadPacketDirection;//下发综合服务接口时,为单独的域配置 - + private Integer payloadOffset; // s:session size min + private Integer payloadSize;//下发综合服务接口时,为单独的域配置 // s:session size max + private String payloadPacketDirection;//下发综合服务接口时,为单独的域配置 // s:清洗标识 + + private String sessionC2sRadio; + private String sessionS2cRadio; + + public String getSessionC2sRadio() { + return sessionC2sRadio; + } + + public void setSessionC2sRadio(String sessionC2sRadio) { + this.sessionC2sRadio = sessionC2sRadio; + } + + public String getSessionS2cRadio() { + return sessionS2cRadio; + } + + public void setSessionS2cRadio(String sessionS2cRadio) { + this.sessionS2cRadio = sessionS2cRadio; + } + public String getCfgRegionCode1() { return cfgRegionCode1; } diff --git a/src/main/java/com/nis/domain/configuration/AppDomainCfg.java b/src/main/java/com/nis/domain/configuration/AppDomainCfg.java index e7d0a76e9..3a38fcb80 100644 --- a/src/main/java/com/nis/domain/configuration/AppDomainCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppDomainCfg.java @@ -8,6 +8,9 @@ */ package com.nis.domain.configuration; +import java.util.ArrayList; +import java.util.List; + import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.nis.util.excel.ExcelField; @@ -38,6 +41,10 @@ public class AppDomainCfg extends BaseCfg { private String cfgKeywords; @ExcelField(title="social_app",sort=2) private String appName; + + private AppFeatureProperties appFeaturePropCfg; + private List appFeaturePropCfgList = new ArrayList(); + /** * 表达式类型 */ @@ -71,6 +78,22 @@ public class AppDomainCfg extends BaseCfg { + public AppFeatureProperties getAppFeaturePropCfg() { + return appFeaturePropCfg; + } + + public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) { + this.appFeaturePropCfg = appFeaturePropCfg; + } + + public List getAppFeaturePropCfgList() { + return appFeaturePropCfgList; + } + + public void setAppFeaturePropCfgList(List appFeaturePropCfgList) { + this.appFeaturePropCfgList = appFeaturePropCfgList; + } + public Integer getIsHex() { return isHex; } diff --git a/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java b/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java index 32c5a2b06..b531d72d2 100644 --- a/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java +++ b/src/main/java/com/nis/domain/configuration/AppFeatureIndex.java @@ -11,7 +11,6 @@ package com.nis.domain.configuration; import java.util.ArrayList; import java.util.List; -import com.nis.domain.basics.AsnIpCfg; import com.nis.util.excel.ExcelField; @@ -37,8 +36,12 @@ public class AppFeatureIndex extends BaseCfg { private AppByteCfg strCfg; private AppIpCfg ipCfg; private List ipPortList = new ArrayList(); + private AppFeatureProperties appFeaturePropCfg; + private List appFeaturePropCfgList = new ArrayList(); + private List strList = new ArrayList(); private List complexList = new ArrayList(); + private List sessionList = new ArrayList(); private List numCfgList = new ArrayList(); protected Integer exprType ; protected Integer matchMethod ; @@ -194,4 +197,23 @@ public class AppFeatureIndex extends BaseCfg { this.relationTime = relationTime; } + public List getSessionList() { + return sessionList; + } + public void setSessionList(List sessionList) { + this.sessionList = sessionList; + } + + public AppFeatureProperties getAppFeaturePropCfg() { + return appFeaturePropCfg; + } + public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) { + this.appFeaturePropCfg = appFeaturePropCfg; + } + public List getAppFeaturePropCfgList() { + return appFeaturePropCfgList; + } + public void setAppFeaturePropCfgList(List appFeaturePropCfgList) { + this.appFeaturePropCfgList = appFeaturePropCfgList; + } } diff --git a/src/main/java/com/nis/domain/configuration/AppFeatureProperties.java b/src/main/java/com/nis/domain/configuration/AppFeatureProperties.java new file mode 100644 index 000000000..857f22e09 --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/AppFeatureProperties.java @@ -0,0 +1,94 @@ + +package com.nis.domain.configuration; + +import com.google.gson.annotations.Expose; +import com.nis.util.excel.ExcelField; + +/** + * + * @ClassName:AppCorrelationIpCfg + * @Description:TODO(这里用一句话描述这个类的作用) + * @author zdx + * @date 2019年1月28日 下午6:09:24 + * @version V1.0 + */ +public class AppFeatureProperties extends BaseCfg { + + private static final long serialVersionUID = -5994798049255256431L; + private static final String tableName="app_feature_prop_cfg"; + @Expose + @ExcelField(title="cfg_id",sort=0) + private Long cfgId; + private Integer compileId; + private Integer dropOpt; + private Integer loopOpt; + private String weakFeature; + private String whitelistFeature; + private Integer extendScanPktNum; + private Integer correlationValidTime; + private String correlationBlockAfter; + private Integer longStreamLockTime; + public Long getCfgId() { + return cfgId; + } + public void setCfgId(Long cfgId) { + this.cfgId = cfgId; + } + public Integer getCompileId() { + return compileId; + } + public void setCompileId(Integer compileId) { + this.compileId = compileId; + } + public Integer getDropOpt() { + return dropOpt; + } + public void setDropOpt(Integer dropOpt) { + this.dropOpt = dropOpt; + } + public Integer getLoopOpt() { + return loopOpt; + } + public void setLoopOpt(Integer loopOpt) { + this.loopOpt = loopOpt; + } + public String getWeakFeature() { + return weakFeature; + } + public void setWeakFeature(String weakFeature) { + this.weakFeature = weakFeature; + } + public String getWhitelistFeature() { + return whitelistFeature; + } + public void setWhitelistFeature(String whitelistFeature) { + this.whitelistFeature = whitelistFeature; + } + public Integer getExtendScanPktNum() { + return extendScanPktNum; + } + public void setExtendScanPktNum(Integer extendScanPktNum) { + this.extendScanPktNum = extendScanPktNum; + } + public Integer getCorrelationValidTime() { + return correlationValidTime; + } + public void setCorrelationValidTime(Integer correlationValidTime) { + this.correlationValidTime = correlationValidTime; + } + public String getCorrelationBlockAfter() { + return correlationBlockAfter; + } + public void setCorrelationBlockAfter(String correlationBlockAfter) { + this.correlationBlockAfter = correlationBlockAfter; + } + public Integer getLongStreamLockTime() { + return longStreamLockTime; + } + public void setLongStreamLockTime(Integer longStreamLockTime) { + this.longStreamLockTime = longStreamLockTime; + } + public static String getTablename() { + return tableName; + } +} diff --git a/src/main/java/com/nis/domain/configuration/AppIpCfg.java b/src/main/java/com/nis/domain/configuration/AppIpCfg.java index b106635e4..bbf532e4f 100644 --- a/src/main/java/com/nis/domain/configuration/AppIpCfg.java +++ b/src/main/java/com/nis/domain/configuration/AppIpCfg.java @@ -1,7 +1,8 @@ package com.nis.domain.configuration; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; +import java.util.ArrayList; +import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; @@ -42,6 +43,9 @@ public class AppIpCfg extends BaseCfg { protected String srcPort; @ExcelField(title="server_port",sort=5) protected String destPort; + private AppFeatureProperties appFeaturePropCfg; + private List appFeaturePropCfgList = new ArrayList(); + /** * 方向 @@ -71,6 +75,18 @@ public class AppIpCfg extends BaseCfg { public Integer getIpType() { return ipType; } + public AppFeatureProperties getAppFeaturePropCfg() { + return appFeaturePropCfg; + } + public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) { + this.appFeaturePropCfg = appFeaturePropCfg; + } + public List getAppFeaturePropCfgList() { + return appFeaturePropCfgList; + } + public void setAppFeaturePropCfgList(List appFeaturePropCfgList) { + this.appFeaturePropCfgList = appFeaturePropCfgList; + } /** * @param ipType the ipType to set */ diff --git a/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java index b93e63115..6cfa2c4bd 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java @@ -1,6 +1,5 @@ package com.nis.web.controller.configuration; -import java.io.File; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -12,52 +11,25 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.taglibs.standard.functions.Functions; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.nis.domain.FunctionRegionDict; import com.nis.domain.Page; -import com.nis.domain.SysDataDictionaryItem; -import com.nis.domain.configuration.AppBuiltInFeatureFile; -import com.nis.domain.configuration.AppByteCfg; import com.nis.domain.configuration.AppComplexFeatureCfg; -import com.nis.domain.configuration.AppDomainCfg; import com.nis.domain.configuration.AppFeatureIndex; -import com.nis.domain.configuration.AppHeaderCfg; -import com.nis.domain.configuration.AppHttpCfg; +import com.nis.domain.configuration.AppFeatureProperties; import com.nis.domain.configuration.AppIpCfg; import com.nis.domain.configuration.AppPolicyCfg; -import com.nis.domain.configuration.AppSslCertCfg; import com.nis.domain.configuration.AppStringFeatureCfg; import com.nis.domain.configuration.AppTcpCfg; -import com.nis.domain.configuration.AppTopicDomainCfg; -import com.nis.domain.configuration.BaseStringCfg; -import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.IpPortCfg; -import com.nis.domain.configuration.NtcSubscribeIdCfg; -import com.nis.domain.configuration.PxyObjTrustedCaCert; -import com.nis.domain.configuration.WebsiteDomainTopic; -import com.nis.domain.maat.ToMaatResult; -import com.nis.domain.maat.ToMaatResult.ResponseData; import com.nis.domain.specific.SpecificServiceCfg; -import com.nis.exceptions.CallExternalProceduresException; import com.nis.exceptions.MaatConvertException; -import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; -import com.nis.util.DictUtils; -import com.nis.util.FileUtils; -import com.nis.util.JsonMapper; import com.nis.util.StringUtil; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; @@ -110,15 +82,24 @@ public class AppFeatureCfgController extends BaseController { appMultiFeatureCfgService.getAppIpRangeCfg(entity.getCompileId(), entity.getFunctionId())); entity.setStrList(appMultiFeatureCfgService.getAppStringFeatureCfg(entity.getCompileId(), entity.getFunctionId(), null)); - entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(), - entity.getFunctionId(), null)); + entity.setComplexList(appMultiFeatureCfgService.getAppComplexFeatureCfgNotRegionCode(entity.getCompileId(), + entity.getFunctionId(), 6)); + entity.setSessionList(appMultiFeatureCfgService.getAppComplexFeatureCfg(entity.getCompileId(), + entity.getFunctionId(), 6)); entity.setNumCfgList( appMultiFeatureCfgService.getAppTcpCfg(entity.getCompileId(), entity.getFunctionId(), null)); + entity.setAppFeaturePropCfgList(appMultiFeatureCfgService.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null)); initUpdateFormCondition(model, entity); } else { initFormCondition(model, entity); } + // 获取L7 Protocol + SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg(); + specificServiceCfg.setCfgType(3); + List l7ProtoList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg, null); + model.addAttribute("_cfg", entity); + model.addAttribute("l7ProtoList", l7ProtoList); return "/cfg/app/appMultiFeatureCfgForm"; } @@ -269,8 +250,26 @@ public class AppFeatureCfgController extends BaseController { Integer.valueOf(cfgRegionCode[i])); map.put("numCfgList", numCfgList); } + if ("8".equals(cfgRegionType[i])) { + List sessionList = appMultiFeatureCfgService + .getAppComplexFeatureCfg(compileId, functionId, Integer.valueOf(cfgRegionCode[i])); + map.put("sessionList", sessionList); + } + if ("9".equals(cfgRegionType[i])) { + List featureList = appMultiFeatureCfgService + .getAppFeaturePropCfg(compileId, functionId, null); + map.put("featureList", featureList); + } + tabList.add(map); } + // 获取L7 Protocol + SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg(); + specificServiceCfg.setCfgType(3); + List l7ProtoList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg, null); + + model.addAttribute("l7ProtoList", l7ProtoList); + } else { Map map = new HashMap(); map.put("regionType", "0"); diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java index 947b0aae2..8ef616965 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java @@ -404,11 +404,11 @@ public class WebsiteController extends BaseController { if (StringUtils.isNotBlank(ids)) { entity = websiteCfgService.getDnsCfg(Long.parseLong(ids), null); entity.setGroupType(12); - entity.setUdFlag(1); + //entity.setUdFlag(1); initUpdateFormCondition(model, entity); } else { entity.setGroupType(12); - entity.setUdFlag(1); + //entity.setUdFlag(1); initFormCondition(model, entity); } // 获取所有响应策略信息 diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java b/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java index 15438dbaf..11a35085f 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java @@ -203,7 +203,7 @@ public class WhiteListController extends CommonController { entity.getHttpUrlList().add(urlCfg); } entity.setGroupType(11); - entity.setUdFlag(1); + //entity.setUdFlag(1); initUpdateFormCondition(model, entity); } else { HttpUrlCfg urlCfg = new HttpUrlCfg(); @@ -213,7 +213,7 @@ public class WhiteListController extends CommonController { urlList.add(urlCfg); entity.setHttpUrlList(urlList); entity.setGroupType(11); - entity.setUdFlag(1); + //entity.setUdFlag(1); initFormCondition(model, entity); } model.addAttribute("_cfg", entity); diff --git a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml index dc4c52815..9ccdf7f79 100644 --- a/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml +++ b/src/main/java/com/nis/web/dao/basics/PolicyGroupInfoDao.xml @@ -272,7 +272,7 @@ FROM policy_group_info r where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER} - + and ud_flag=#{flag} diff --git a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java index 37beaed0c..9be590675 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.java @@ -1,34 +1,16 @@ package com.nis.web.dao.configuration; -import java.util.Date; import java.util.List; import org.apache.ibatis.annotations.Param; -import com.nis.domain.configuration.AppByteCfg; import com.nis.domain.configuration.AppComplexFeatureCfg; -import com.nis.domain.configuration.AppComplexKeywordCfg; -import com.nis.domain.configuration.AppDomainCfg; import com.nis.domain.configuration.AppFeatureIndex; -import com.nis.domain.configuration.AppHeaderCfg; -import com.nis.domain.configuration.AppHttpCfg; -import com.nis.domain.configuration.AppIdCfg; -import com.nis.domain.configuration.AppIdCfg.AppFeaturesIndex; -import com.nis.domain.configuration.AppInnerRuleCfg; +import com.nis.domain.configuration.AppFeatureProperties; import com.nis.domain.configuration.AppIpCfg; -import com.nis.domain.configuration.AppPolicyCfg; -import com.nis.domain.configuration.AppSslCertCfg; -import com.nis.domain.configuration.AppStringCfg; import com.nis.domain.configuration.AppStringFeatureCfg; import com.nis.domain.configuration.AppTcpCfg; -import com.nis.domain.configuration.AppTopicDomainCfg; import com.nis.domain.configuration.BaseCfg; -import com.nis.domain.configuration.BaseStringCfg; -import com.nis.domain.configuration.CfgIndexInfo; -import com.nis.domain.configuration.ComplexkeywordCfg; -import com.nis.domain.configuration.IpPortCfg; -import com.nis.domain.configuration.WebsiteDomainTopic; -import com.nis.web.dao.CrudDao; import com.nis.web.dao.MyBatisDao; @@ -59,6 +41,8 @@ public interface AppMultiFeatureCfgDao { //数值类特征配置 public List getAppTcpCfg(@Param("compileId")Integer compileId, @Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode); + public List getAppComplexFeatureCfgNotRegionCode(@Param("compileId")Integer compileId, + @Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode); public int insertAppTcpCfg(AppTcpCfg entity); public void deleteAppTcpCfg(BaseCfg entity); @@ -71,4 +55,11 @@ public interface AppMultiFeatureCfgDao { public void deleteAppIpRangeCfg(BaseCfg entity); public List findAppByFeatureIndexList(@Param("ids")String ids); + //App特征属性配置 + public List getAppFeaturePropCfg(@Param("compileId")Integer compileId, + @Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode); + + public int insertAppFeaturePropCfg(AppFeatureProperties entity); + public void deleteAppFeaturePropCfg(BaseCfg entity); + } 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 5d77ae0f7..71d8fe251 100644 --- a/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AppMultiFeatureCfgDao.xml @@ -118,6 +118,12 @@ + + + + + + @@ -181,6 +187,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + r.CFG_ID, r.compile_id,r.function_id,r.service_id,r.request_id,r.is_valid, + r.is_audit,r.creator_id,r.create_time,r.editor_id,r.edit_time,r.auditor_id,r.audit_time, + r.drop_opt,r.loop_opt,r.weak_feature,r.whitelist_feature, + r.extend_scan_pkt_num,r.correlation_valid_time,r.correlation_block_after,r.long_stream_lock_time + r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT, @@ -206,6 +242,7 @@ 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.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5, 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,r.payload_offset,r.payload_size,r.payload_packet_direction @@ -511,6 +548,16 @@ AND r.cfg_region_code = #{cfgRegionCode,jdbcType=BIGINT} + + @@ -653,5 +700,39 @@ where r.CFG_ID in (${ids}) + + + SELECT LAST_INSERT_ID() + + insert into app_feature_prop_cfg( + compile_id,function_id,service_id,request_id,is_valid, + is_audit,creator_id,create_time,editor_id,edit_time,auditor_id, + audit_time,drop_opt,loop_opt,weak_feature,whitelist_feature, + extend_scan_pkt_num,correlation_valid_time,correlation_block_after,long_stream_lock_time + )values ( + #{compileId,jdbcType=INTEGER},#{functionId,jdbcType=INTEGER},#{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER},#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER}, + #{creatorId,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP},#{auditorId,jdbcType=INTEGER},#{auditTime,jdbcType=TIMESTAMP}, + #{dropOpt,jdbcType=INTEGER},#{loopOpt,jdbcType=INTEGER}, + #{weakFeature,jdbcType=VARCHAR},#{whitelistFeature,jdbcType=VARCHAR},#{extendScanPktNum,jdbcType=INTEGER}, + #{correlationValidTime,jdbcType=INTEGER},#{correlationBlockAfter,jdbcType=VARCHAR}, + #{longStreamLockTime,jdbcType=INTEGER} + ) + + + + delete from app_feature_prop_cfg where compile_id=#{compileId} and function_id=#{functionId} + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/configuration/AppCfgService.java b/src/main/java/com/nis/web/service/configuration/AppCfgService.java index a7e37ca7d..c21c31204 100644 --- a/src/main/java/com/nis/web/service/configuration/AppCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppCfgService.java @@ -1,6 +1,5 @@ package com.nis.web.service.configuration; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -14,12 +13,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import com.google.common.collect.Lists; import com.nis.domain.Page; -import com.nis.domain.basics.AsnIpCfg; -import com.nis.domain.basics.Varibles; import com.nis.domain.configuration.AppByteCfg; import com.nis.domain.configuration.AppDomainCfg; +import com.nis.domain.configuration.AppFeatureIndex; +import com.nis.domain.configuration.AppFeatureProperties; import com.nis.domain.configuration.AppHeaderCfg; import com.nis.domain.configuration.AppHttpCfg; import com.nis.domain.configuration.AppIpCfg; @@ -28,9 +26,7 @@ import com.nis.domain.configuration.AppSslCertCfg; import com.nis.domain.configuration.AppTcpCfg; import com.nis.domain.configuration.AppTopicDomainCfg; import com.nis.domain.configuration.AreaIpCfg; -import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseStringCfg; -import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.NtcSubscribeIdCfg; @@ -50,11 +46,11 @@ import com.nis.domain.specific.SpecificServiceCfg; import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; -import com.nis.util.DictUtils; import com.nis.util.StringUtil; import com.nis.util.StringUtils; import com.nis.web.dao.basics.AsnIpCfgDao; import com.nis.web.dao.configuration.AppCfgDao; +import com.nis.web.dao.configuration.AppMultiFeatureCfgDao; import com.nis.web.dao.configuration.AreaIpCfgDao; import com.nis.web.dao.configuration.IpCfgDao; import com.nis.web.dao.configuration.StringCfgDao; @@ -86,6 +82,73 @@ public class AppCfgService extends BaseService { protected ConfigGroupInfoDao configGroupInfoDao; @Autowired protected AsnIpCfgDao asnIpCfgDao; + @Autowired + protected AppMultiFeatureCfgDao appMultiFeatureCfgDao; + + @Transactional(readOnly = false, rollbackFor = RuntimeException.class) + public void saveOrUpdateAppFeaturePropCfg(AppFeatureIndex entity) throws Exception { + if (entity.getCfgId() == null) { + Integer compileId = 0; + try { + List idList = ConfigServiceUtil.getId(1, 1); + if (idList != null && idList.size() > 0) { + compileId = idList.get(0); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + entity.setIsValid(0); + entity.setIsAudit(0); + appMultiFeatureCfgDao.insertAppFeatureIndex(entity); + if(entity.getIpPortList()!=null){ + for(AppIpCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + appMultiFeatureCfgDao.insertAppIpRangeCfg(cfg); + } + } + if(!StringUtil.isEmpty(entity.getAppFeaturePropCfgList())){ + for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){ + BeanUtils.copyProperties(entity, cfg); + appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg); + } + } + + + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(e.getMessage()); + } + } else { + entity.setEditorId(entity.getCurrentUser().getId()); + entity.setEditTime(new Date()); + entity.setIsValid(0); + entity.setIsAudit(0); + appMultiFeatureCfgDao.updateAppFeatureIndex(entity); + appMultiFeatureCfgDao.deleteAppIpRangeCfg(entity); + appMultiFeatureCfgDao.deleteAppFeaturePropCfg(entity); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + if(entity.getIpPortList()!=null){ + for(AppIpCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + appMultiFeatureCfgDao.insertAppIpRangeCfg(cfg); + } + } + if(entity.getIpPortList()!=null){ + for(AppIpCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + appMultiFeatureCfgDao.insertAppIpRangeCfg(cfg); + } + } + if(!StringUtil.isEmpty(entity.getAppFeaturePropCfgList())){ + for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){ + BeanUtils.copyProperties(entity, cfg); + appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg); + } + } + } + } public Page findAppPolicyList(Page page, AppPolicyCfg entity) { entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r")); 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 3d1694ff6..86a76a38b 100644 --- a/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AppMultiFeatureCfgService.java @@ -17,17 +17,10 @@ import org.springframework.transaction.annotation.Transactional; import com.nis.domain.Page; import com.nis.domain.configuration.AppComplexFeatureCfg; import com.nis.domain.configuration.AppFeatureIndex; -import com.nis.domain.configuration.AppHttpCfg; +import com.nis.domain.configuration.AppFeatureProperties; import com.nis.domain.configuration.AppIpCfg; import com.nis.domain.configuration.AppStringFeatureCfg; import com.nis.domain.configuration.AppTcpCfg; -import com.nis.domain.configuration.CfgIndexInfo; -import com.nis.domain.configuration.ComplexkeywordCfg; -import com.nis.domain.configuration.HttpUrlCfg; -import com.nis.domain.configuration.IpPortCfg; -import com.nis.domain.configuration.NtcSubscribeIdCfg; -import com.nis.domain.configuration.P2pHashCfg; -import com.nis.domain.configuration.P2pKeywordCfg; import com.nis.domain.maat.MaatCfg; import com.nis.domain.maat.MaatCfg.DigestCfg; import com.nis.domain.maat.MaatCfg.GroupCfg; @@ -39,7 +32,6 @@ import com.nis.domain.maat.ToMaatResult; import com.nis.exceptions.MaatConvertException; import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; -import com.nis.util.DictUtils; import com.nis.util.StringUtil; import com.nis.web.dao.configuration.AppMultiFeatureCfgDao; import com.nis.web.security.UserUtils; @@ -151,6 +143,31 @@ public class AppMultiFeatureCfgService extends BaseService { } } + // Session组件 + if(entity.getSessionList() != null) { + for (AppComplexFeatureCfg cfg : entity.getSessionList()) { + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin","userRegion3","userRegion4","userRegion5"}); + /*cfg.setExprType(1); + cfg.setMatchMethod(0); + cfg.setIsHexbin(0); + cfg.setIsCaseInsenstive(0);*/ + this.setSessionKeyword(cfg); + if("c2sPayload".equals(cfg.getSessionC2sRadio())) { + cfg.setIcmpCode(null); + }else if("c2sFrequent".equals(cfg.getSessionC2sRadio())){ + cfg.setIcmpIdentifier(null); + } + + if("s2cPayload".equals(cfg.getSessionS2cRadio())) { + cfg.setProtocol(null); + }else if("s2cFrequent".equals(cfg.getSessionS2cRadio())){ + cfg.setIcmpType(null); + } + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + + } + } + if(entity.getNumCfgList()!=null){ for(AppTcpCfg cfg:entity.getNumCfgList()){ if(cfg.getLowBoundary()!=null && cfg.getUpBoundary()!=null){ @@ -160,6 +177,13 @@ public class AppMultiFeatureCfgService extends BaseService { } } + if(entity.getAppFeaturePropCfgList()!=null){ + for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){ + BeanUtils.copyProperties(entity, cfg); + appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg); + } + } + } catch (Exception e) { e.printStackTrace(); @@ -176,6 +200,7 @@ public class AppMultiFeatureCfgService extends BaseService { appMultiFeatureCfgDao.deleteAppStringFeatureCfg(entity); appMultiFeatureCfgDao.deleteAppComplexFeatureCfg(entity); appMultiFeatureCfgDao.deleteAppTcpCfg(entity);//复用AppTcpCfg对象作为数值类对象 + appMultiFeatureCfgDao.deleteAppFeaturePropCfg(entity);//复用AppTcpCfg对象作为数值类对象 entity.setCreateTime(new Date()); entity.setCreatorId(entity.getCurrentUser().getId()); if(entity.getIpPortList()!=null){ @@ -235,6 +260,31 @@ public class AppMultiFeatureCfgService extends BaseService { } } } + // Session组件 + if(entity.getSessionList() != null) { + for (AppComplexFeatureCfg cfg : entity.getSessionList()) { + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType","exprType","matchMethod","isHexbin","userRegion3","userRegion4","userRegion5"}); + /*cfg.setExprType(1); + cfg.setMatchMethod(0); + cfg.setIsHexbin(0); + cfg.setIsCaseInsenstive(0);*/ + this.setSessionKeyword(cfg); + if("c2sPayload".equals(cfg.getSessionC2sRadio())) { + cfg.setIcmpCode(null); + }else if("c2sFrequent".equals(cfg.getSessionC2sRadio())){ + cfg.setIcmpIdentifier(null); + } + + if("s2cPayload".equals(cfg.getSessionS2cRadio())) { + cfg.setProtocol(null); + }else if("s2cFrequent".equals(cfg.getSessionS2cRadio())){ + cfg.setIcmpType(null); + } + appMultiFeatureCfgDao.insertAppComplexFeatureCfg(cfg); + + } + } + if(entity.getNumCfgList()!=null){ for(AppTcpCfg cfg:entity.getNumCfgList()){ if(cfg.getLowBoundary()!=null && cfg.getUpBoundary()!=null){ @@ -243,9 +293,82 @@ public class AppMultiFeatureCfgService extends BaseService { } } } + //特征属性配置 + if(entity.getAppFeaturePropCfgList()!=null){ + for(AppFeatureProperties cfg:entity.getAppFeaturePropCfgList()){ + BeanUtils.copyProperties(entity, cfg); + appMultiFeatureCfgDao.insertAppFeaturePropCfg(cfg); + } + } + } } + public void setSessionKeyword(AppComplexFeatureCfg cfg) { + // 处理与表达式字符串 + String keyword = ""; + if(!cfg.getFunctionId().equals(566)) { + if(StringUtils.isNotBlank(cfg.getHeaderType())) { // 传输服务端端口 + keyword += "DPORT=" + cfg.getHeaderType() + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getVer())) { // 传输协议 + keyword += "TSP=" + cfg.getVer() + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getTos())) { // L7层协议 + if(cfg.getTos().equals("0")) { + keyword += "PROTO_ID=0" + Constants.USER_REGION_SPLIT + "C2S_SEQ>=1" + Constants.USER_REGION_SPLIT + "S2C_SEQ>=1" + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + }else { + keyword += "PROTO_ID=" + cfg.getTos() + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + } + } + /*if(StringUtils.isNotBlank(cfg.getIhl())) { // L7层协议未知 + keyword += "PROTO_ID=0" + Constants.USER_REGION_SPLIT + "C2S_SEQ>=1" + Constants.USER_REGION_SPLIT + "S2C_SEQ>=1" + Constants.KEYWORD_EXPR; + }*/ + if(StringUtils.isNotBlank(cfg.getTotalLength())) { // 链接建立方式 + keyword += "CR=2" + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getFlags())) { // Tcp包发送特性 + keyword += "C2S_SEQ=C2S_P" + Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getFragmentOffset())) { // 域名初筛标识 + keyword += "IPD_ID=" + cfg.getAppCode() + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getPayloadPacketDirection())) { // 清洗标识 + keyword += "CLI_APP_ID=" + cfg.getAppCode() + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + } + cfg.setUserRegion3(null); + cfg.setUserRegion4(null); + cfg.setUserRegion5(null); + }else { + if(StringUtils.isNotBlank(cfg.getUserRegion3())) { + keyword += "SSL_RES" + Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getUserRegion4())) { + keyword += "SINGLE_CERT" + Constants.KEYWORD_EXPR; + } + if(StringUtils.isNotBlank(cfg.getUserRegion5())) { + keyword += "SELF_ISSUED" + Constants.KEYWORD_EXPR; + } + cfg.setHeaderType(null); + cfg.setVer(null); + cfg.setTos(null); + cfg.setIhl(null); + cfg.setTotalLength(null); + cfg.setFlags(null); + cfg.setFragmentOffset(null); + cfg.setProtocol(null); + + } + if(StringUtils.isNotBlank(keyword)) { + keyword = keyword.substring(0,keyword.lastIndexOf(Constants.KEYWORD_EXPR)); + cfg.setCfgKeywords(keyword); + }else { + cfg.setCfgKeywords("session_default_keyword"); + } + + } + + public void setL3HeaderKeyword(AppComplexFeatureCfg cfg) { String keyword = ""; if(cfg.getHeaderType().equals("L3_header_IP")){ @@ -334,7 +457,8 @@ public class AppMultiFeatureCfgService extends BaseService { strRegionList=map.get("dstList"); } } - List complexList = appMultiFeatureCfgDao.getAppComplexFeatureCfg(entity.getCompileId(),entity.getFunctionId(),null); + //List complexList = appMultiFeatureCfgDao.getAppComplexFeatureCfg(entity.getCompileId(),entity.getFunctionId(),null); + List complexList = appMultiFeatureCfgDao.getAppComplexFeatureCfgNotRegionCode(entity.getCompileId(),entity.getFunctionId(),6); if(complexList!=null && complexList.size()>0){ AppComplexFeatureCfg cfg = new AppComplexFeatureCfg(); BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); @@ -381,6 +505,116 @@ public class AppMultiFeatureCfgService extends BaseService { } } + // session组件 + // TODO 确保查询出的appSessionList 只有session域配置信息 + List appSessionList = appMultiFeatureCfgDao.getAppComplexFeatureCfg(entity.getCompileId(), entity.getFunctionId(), 6); + if(appSessionList != null && appSessionList.size() > 0) { + AppComplexFeatureCfg featureCfg = new AppComplexFeatureCfg(); + BeanUtils.copyProperties(entity, featureCfg, new String[]{"cfgId"}); + featureCfg.setTableName(AppComplexFeatureCfg.getTablename()); + appMultiFeatureCfgDao.auditCfg(featureCfg); + if(isAudit==1){ + List numCfgList = new ArrayList(); + List appSessionList2 = new ArrayList(); + for (AppComplexFeatureCfg cfg : appSessionList) { + // 【1-8处理 】 + this.setSessionKeyword(cfg); + cfg.setCfgType("APP_PAYLOAD"); + cfg.setDistrict("Attribute"); + + boolean flag = false; + String keyword = ""; + // 非APP_SSL + if(!cfg.getFunctionId().equals(566)) { + AppComplexFeatureCfg cfg2 = new AppComplexFeatureCfg(); + BeanUtils.copyProperties(cfg, cfg2, new String[]{"cfgId"}); + + if(!StringUtil.isBlank(cfg2.getIcmpIdentifier())) { // C2S + keyword += cfg2.getIcmpIdentifier() + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + flag = true; + } + if(!StringUtil.isBlank(cfg2.getIcmpCode())) { + keyword += cfg2.getIcmpCode().replace(";", ";"+Constants.KEYWORD_EXPR) + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + flag = true; + } + if(flag) { + cfg2.setCfgType("APP_PAYLOAD"); + cfg2.setDistrict("C2S_session_size"); + cfg2.setCfgKeywords(keyword.substring(0,keyword.lastIndexOf(Constants.KEYWORD_EXPR))); + appSessionList2.add(cfg2); + } + + AppComplexFeatureCfg cfg3 = new AppComplexFeatureCfg(); + BeanUtils.copyProperties(cfg, cfg3, new String[]{"cfgId"}); + flag = false; + keyword = ""; + + if(!StringUtil.isBlank(cfg3.getIcmpType())) { // S2C + keyword += cfg3.getIcmpType() + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + flag = true; + } + if(!StringUtil.isBlank(cfg3.getProtocol())) { + keyword += cfg3.getProtocol().replace(";", ";"+Constants.KEYWORD_EXPR) + Constants.USER_REGION_SPLIT + Constants.KEYWORD_EXPR; + flag = true; + } + if(flag) { + cfg3.setCfgType("APP_PAYLOAD"); + cfg3.setDistrict("S2C_session_size"); + cfg3.setCfgKeywords(keyword.substring(0,keyword.lastIndexOf(Constants.KEYWORD_EXPR))); + appSessionList2.add(cfg3); + } + + // 数值域 + if(cfg.getPayloadOffset() != null && cfg.getPayloadSize() != null) { + AppTcpCfg numCfg = new AppTcpCfg(); + numCfg.setCfgType("APP_PAYLOAD_SIZE"); + numCfg.setLowBoundary(cfg.getPayloadOffset()); + numCfg.setUpBoundary(cfg.getPayloadSize()); + numCfgList.add(numCfg); + } + + }else { + if(!StringUtil.isBlank(cfg.getUserRegion3())) { + keyword += "SSL_RES;" + Constants.KEYWORD_EXPR; + flag = true; + } + if(!StringUtil.isBlank(cfg.getUserRegion4())) { + keyword += "SINGLE_CERT;" + Constants.KEYWORD_EXPR; + flag = true; + } + if(!StringUtil.isBlank(cfg.getUserRegion5())) { + keyword += "SELF_ISSUED;" + Constants.KEYWORD_EXPR; + flag = true; + } + if(flag) { + keyword = keyword.substring(0,keyword.lastIndexOf(Constants.KEYWORD_EXPR)); + cfg.setCfgKeywords(keyword); + } + + } + + } + + if(appSessionList.get(0).getCfgKeywords().equals("session_default_keyword")) { + appSessionList.remove(0); + } + if(appSessionList2.size() > 0) { + appSessionList.addAll(appSessionList2); + } + + Map map = cfgConvert(strRegionList,appSessionList,2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + + if(numCfgList.size() > 0) { + Map map2 = cfgConvert(numRegionList,numCfgList,4,entity,groupRelationList); + groupRelationList=map2.get("groupList"); + numRegionList=map2.get("dstList"); + } + } + + } + List numCfgList = appMultiFeatureCfgDao.getAppTcpCfg(entity.getCompileId(),entity.getFunctionId(),null); if(numCfgList!=null && numCfgList.size()>0){ AppTcpCfg cfg = new AppTcpCfg(); @@ -393,6 +627,39 @@ public class AppMultiFeatureCfgService extends BaseService { numRegionList=map.get("dstList"); } } + List appFeaturePropCfgList = this.getAppFeaturePropCfg(entity.getCompileId(), entity.getFunctionId(), null); + String featureUserRegion = ""; + if(!StringUtil.isEmpty(appFeaturePropCfgList)){ + AppFeatureProperties cfg = appFeaturePropCfgList.get(0); + // 处理下发userRegion + if(!StringUtil.isEmpty(cfg.getDropOpt())){ + featureUserRegion += "DKC=10;DKS="+cfg.getDropOpt()+";"; + } + if(!StringUtil.isEmpty(cfg.getLoopOpt())){ + featureUserRegion += "DKC=4;DKS="+cfg.getLoopOpt()+";"; + } + if(!StringUtil.isEmpty(cfg.getExtendScanPktNum())){ + featureUserRegion += "DKC=7;DKS="+cfg.getExtendScanPktNum()+";"; + } + if(!StringUtil.isEmpty(cfg.getLongStreamLockTime())){ + featureUserRegion += "DKC=16;DKS="+cfg.getLongStreamLockTime()+";"; + } + if(!StringUtil.isEmpty(cfg.getCorrelationValidTime())){ + featureUserRegion += "DKC=3;DKS="+cfg.getCorrelationValidTime()+";"; + } + + if(!StringUtil.isEmpty(cfg.getWeakFeature())){ + featureUserRegion += cfg.getWeakFeature(); + } + if(!StringUtil.isEmpty(cfg.getWhitelistFeature())){ + featureUserRegion += cfg.getWhitelistFeature(); + } + if(!StringUtil.isEmpty(cfg.getCorrelationBlockAfter())){ + featureUserRegion += cfg.getCorrelationBlockAfter(); + } + + } + // 构造提交综合服务参数格式,一条配置提交一次综合服务 if (isAudit == 1) { maatCfg.initDefaultValue(); @@ -415,7 +682,10 @@ public class AppMultiFeatureCfgService extends BaseService { }else{ maatCfg.setUserRegion(entity.getUserRegion1()); } - + if(!StringUtil.isEmpty(featureUserRegion)){ + maatCfg.setUserRegion(maatCfg.getUserRegion() + ";" +featureUserRegion); + } + configCompileList.add(maatCfg); maatBean.setConfigCompileList(configCompileList); maatBean.setAuditTime(entity.getAuditTime()); @@ -487,9 +757,21 @@ public class AppMultiFeatureCfgService extends BaseService { cfg.setTableName(AppTcpCfg.getTablename()); appMultiFeatureCfgDao.updateCfgValid(cfg); } + //修改特征属性配置表状态 + if (!StringUtil.isEmpty(entity.getAppFeaturePropCfgList())) { + AppFeatureProperties cfg = new AppFeatureProperties(); + BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" }); + cfg.setTableName(AppFeatureProperties.getTablename()); + appMultiFeatureCfgDao.updateCfgValid(cfg); + } + } } + //session + public List getAppComplexFeatureCfgNotRegionCode(Integer compileId,Integer functionId,Integer cfgRegionCode){ + return appMultiFeatureCfgDao.getAppComplexFeatureCfgNotRegionCode(compileId,functionId,cfgRegionCode); + } //字符串类特征配置列表 public List getAppStringFeatureCfg(Integer compileId,Integer functionId,Integer cfgRegionCode){ @@ -507,7 +789,11 @@ public class AppMultiFeatureCfgService extends BaseService { public List getAppTcpCfg(Integer compileId,Integer functionId,Integer cfgRegionCode){ return appMultiFeatureCfgDao.getAppTcpCfg(compileId,functionId,cfgRegionCode); } - + //特征属性配置列表 + public List getAppFeaturePropCfg(Integer compileId,Integer functionId,Integer cfgRegionCode){ + return appMultiFeatureCfgDao.getAppFeaturePropCfg(compileId,functionId,cfgRegionCode); + } + public Map exportFeature(AppFeatureIndex entity){ Map dataMap=new HashMap(); List ipRangeList = appMultiFeatureCfgDao.getAppIpRangeCfg(entity.getCompileId(),entity.getFunctionId()); diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 0a03039e2..416da52a0 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1504,4 +1504,17 @@ urlGroup=Http URL Group url_group_manage=URL Group Manage url_group_configuration=URL Group Config dns_keyword_group_manage=DNS Group Manage -dns_keyword_group_configuration=DNS Group Config \ No newline at end of file +dns_keyword_group_configuration=DNS Group Config +current_hour_no_data=There is no data this hour. +#app +app_ip_correlation=APP Correlation IP +APP_IP_CORRELATION=Correlation IP +APP_FEATURE_PROPERTIES=Feature Properties +drop_option=Drop Keep Time +loop_option=Loop Keep Time +weak_feature=Weak Feature +whitelist_feature=Whitelist Feature +extend_scan_pktNum=Extend Scan PktNum +long_stream_lock_time=Long Stream Lock Time +correlation_valid_time=Correlation Valid Time +correlation_block_after=Block After Correlated diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 6b0eb33be..e0ec63174 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1506,4 +1506,17 @@ urlGroup=Http URL Group url_group_manage=URL Group Manage url_group_configuration=URL Group Config dns_keyword_group_manage=DNS Group Manage -dns_keyword_group_configuration=DNS Group Config \ No newline at end of file +dns_keyword_group_configuration=DNS Group Config +current_hour_no_data=\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445 \u0437\u0430 \u044D\u0442\u043E\u0442 \u0447\u0430\u0441. +#app +app_ip_correlation=APP Correlation IP +APP_IP_CORRELATION=Correlation IP +APP_FEATURE_PROPERTIES=Feature Properties +drop_option=Drop Keep Time +loop_option=Loop Keep Time +weak_feature=Weak Feature +whitelist_feature=Whitelist Feature +extend_scan_pktNum=Extend Scan PktNum +long_stream_lock_time=Long Stream Lock Time +correlation_valid_time=Correlation Valid Time +correlation_block_after=Block After Correlated diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index dbab8e2cc..f5a975113 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1500,4 +1500,18 @@ urlGroup=Http URL \u7ec4 url_group_manage=URL\u5206\u7ec4\u7ba1\u7406 url_group_configuration=URL\u5206\u7ec4\u914d\u7f6e dns_keyword_group_manage=DNS\u5173\u952e\u5b57\u5206\u7ec4\u7ba1\u7406 -dns_keyword_group_configuration=DNS\u5173\u952e\u5b57\u5206\u7ec4\u914d\u7f6e \ No newline at end of file +dns_keyword_group_configuration=DNS\u5173\u952e\u5b57\u5206\u7ec4\u914d\u7f6e +current_hour_no_data=\u672C\u5C0F\u65F6\u65E0\u6570\u636E +#app +app_ip_correlation=APP\u5173\u8054\u7279\u5F81IP\u914D\u7F6E +APP_IP_CORRELATION=\u5173\u8054\u7279\u5F81IP +APP_FEATURE_PROPERTIES=\u7279\u5F81\u7EC4\u4EF6 +drop_option=\u4E22\u5F03\u6301\u7EED\u65F6\u95F4 +loop_option=\u56DE\u6D41\u6301\u7EED\u65F6\u95F4 +weak_feature=\u5F31\u7279\u5F81 +whitelist_feature=\u767D\u540D\u5355 +extend_scan_pktNum=\u626B\u63CF\u5305\u6570\u6269\u5C55 +long_stream_lock_time=\u957F\u6D41\u9501\u5B9A\u65F6\u95F4 +correlation_valid_time=\u5173\u8054\u540E\u63A7\u7BA1\u65F6\u95F4 +correlation_block_after=\u5173\u8054\u540E\u7BA1\u63A7 + diff --git a/src/main/resources/sql/20190215/add_app_correlation_ip.sql b/src/main/resources/sql/20190215/add_app_correlation_ip.sql new file mode 100644 index 000000000..f7b1f2f1f --- /dev/null +++ b/src/main/resources/sql/20190215/add_app_correlation_ip.sql @@ -0,0 +1,45 @@ +--------------App 关联特征IP配置----start--------20190201------------------------------------- +##菜单 +INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('735', '0,1,86,717,735,', 'app_ip_correlation', 'APP关联特征IP配置', '60', '/app/feature/multiFeatureCfgList', '', '', '1', 'app_correlation_ip_monit:config', '1', '2019-01-29 17:07:57', '1', '2019-01-29 17:22:40', '', '1', NULL, '0', '0', '568'); +INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('751', '0,1,150,750,751,', 'app_ip_correlation', 'APP关联特征IP配置', '60', '/app/feature/multiFeatureCfgList', '', '', '1', 'app_correlation_ip_monit:confirm', '1', '2019-01-31 17:14:47', '1', '2019-01-31 17:14:47', '', '1', NULL, '0', '0', '568'); +INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('866', '0,1,151,865,866,', 'app_ip_correlation', 'APP关联特征IP配置', '60', '/app/feature/multiFeatureCfgList', '', '', '1', 'app_correlation_ip_monit:audit', '1', '2019-01-31 17:15:56', '1', '2019-01-31 17:15:56', '', '1', NULL, '0', '0', '568'); + +##添加IP域和特征属性,其中特征属性的region_type=9 config_expr_type控制组件: 1 无控管属性,2 无特征属性, +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('568', '', '1', 'APP_IP_CORRELATION', 'APP IP CORRELATION', '1', '1', '1', NULL, '2019-01-31 15:48:13', NULL, NULL, '', '', '', '4,6', '', '', '1,2,3', '1,2', '0', '0,6,17', '1,2,3,4', '1', '0'); +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('568', '', '7', 'APP_FEATURE_PROPERTIES', 'APP特征属性组件', '1', '1', '9', NULL, '2019-02-01 10:47:28', NULL, '2019-02-01 10:47:32', '', '0', '', '', '', '', NULL, NULL, NULL, NULL, NULL, '2', '0'); +##添加service和action 暂定service=1031,action=1; +INSERT INTO `function_service_dict` (`function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES ('568', '0', '1', 'monit', '1031', 'app_correlation_ip_monit', '', '1', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '1', '1', '1', NULL); + + +##添加App特征组件配置表 +DROP TABLE IF EXISTS `app_feature_prop_cfg`; +CREATE TABLE `app_feature_prop_cfg` ( + `cfg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `drop_opt` int(11) COMMENT 'DROP 持续时间(秒):0-7200', + `loop_opt` int(11) COMMENT 'LOOP 持续时间(秒):0-7200', + `weak_feature` varchar(64) COMMENT '特征强弱属性', + `whitelist_feature` varchar(64) COMMENT '白名单属性', + `extend_scan_pkt_num` int(11) COMMENT '扫描包数', + `correlation_valid_time` int(11) COMMENT '多流汇聚关联时间', + `correlation_block_after` varchar(64) COMMENT '多流汇聚关联后控管', + `long_stream_lock_time` int(11) COMMENT '长流锁定时间', + `compile_id` int(11) NOT NULL, + `function_id` int(11) NOT NULL, + `service_id` int(11) NOT NULL COMMENT '业务id', + `request_id` int(11) NOT NULL COMMENT '来自request_info.id', + `is_valid` int(11) NOT NULL, + `is_audit` int(11) NOT NULL, + `creator_id` int(11) NOT NULL COMMENT 'sys_user.id', + `create_time` datetime NOT NULL, + `editor_id` int(11) DEFAULT NULL COMMENT '来自sys_user.id', + `edit_time` datetime DEFAULT NULL, + `auditor_id` int(11) DEFAULT NULL COMMENT '来自sys_user.id', + `audit_time` datetime DEFAULT NULL, + `user_region1` varchar(1024) DEFAULT NULL COMMENT '预留自定义域1', + `user_region2` varchar(1024) DEFAULT NULL COMMENT '预留自定义域2', + `user_region3` varchar(1024) DEFAULT NULL COMMENT '预留自定义域3', + `user_region4` varchar(1024) DEFAULT NULL COMMENT '预留自定义域4', + `user_region5` varchar(1024) DEFAULT NULL COMMENT '预留自定义域5', + PRIMARY KEY (`cfg_id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; +--------------App 关联特征IP配置----end------------------------------------------------------ diff --git a/src/main/resources/sql/20190215/add_function_region&service.sql b/src/main/resources/sql/20190215/add_function_region&service.sql index 4378b73dc..2c4a44500 100644 --- a/src/main/resources/sql/20190215/add_function_region&service.sql +++ b/src/main/resources/sql/20190215/add_function_region&service.sql @@ -1,5 +1,5 @@ --添加dns和url公共组的function_region和function_service字典 -INSERT INTO `function_region_dict` (`dict_id`, `function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('622', '409', 'QNAME', '2', 'NTC_DNS_REGION', 'DNS域名配置', '1', '1', '3', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', '0', '0,1,2,3', '', '0,1,2', '0', '', '', '', '', '', '1', '1'); -INSERT INTO `function_region_dict` (`dict_id`, `function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('623', '111', '', '2', 'NTC_URL_REGION', 'URL公共组域配置', '1', '1', '2', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', '0,1', '0,1,2,3', '', '0', '1', NULL, NULL, NULL, NULL, NULL, '2', '1'); -INSERT INTO `function_service_dict` (`dict_id`, `function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES ('164', '409', '0', '0', '', '-2', 'NTC_DNS_REGION', NULL, '1', '1', '2019-02-15 16:48:56', NULL, NULL, '1', '1', '1', NULL); -INSERT INTO `function_service_dict` (`dict_id`, `function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES ('165', '111', '0', '0', '', '-1', 'NTC_URL_REGION', NULL, '1', '1', '2019-02-15 16:49:49', NULL, NULL, '1', '1', '1', NULL); +INSERT INTO `function_region_dict` ( `function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('409', 'QNAME', '2', 'NTC_DNS_REGION', 'DNS域名配置', '1', '1', '3', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', '0', '0,1,2,3', '', '0,1,2', '0', '', '', '', '', '', '1', '1'); +INSERT INTO `function_region_dict` ( `function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ( '111', '', '2', 'NTC_URL_REGION', 'URL公共组域配置', '1', '1', '2', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', '0,1', '0,1,2,3', '', '0', '1', NULL, NULL, NULL, NULL, NULL, '2', '1'); +INSERT INTO `function_service_dict` ( `function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES ( '409', '0', '0', '', '-2', 'NTC_DNS_REGION', NULL, '1', '1', '2019-02-15 16:48:56', NULL, NULL, '1', '1', '1', NULL); +INSERT INTO `function_service_dict` ( `function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES ( '111', '0', '0', '', '-1', 'NTC_URL_REGION', NULL, '1', '1', '2019-02-15 16:49:49', NULL, NULL, '1', '1', '1', NULL); diff --git a/src/main/resources/sql/20190215/add_function_region_dict.sql b/src/main/resources/sql/20190215/add_function_region_dict.sql new file mode 100644 index 000000000..2a50b502d --- /dev/null +++ b/src/main/resources/sql/20190215/add_function_region_dict.sql @@ -0,0 +1,15 @@ +-- APP Payload、HTTP、SSL增加session组件 +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('563', 'Attribute', '6', 'APP_SESSION', 'APP SESSION组件', '1', '1', '8', NULL, '2019-01-22 13:57:49', NULL, NULL, '', '1', '0', '', '0', '', NULL, NULL, NULL, NULL, NULL, '7', '0'); +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('566', 'Attribute', '6', 'APP_SESSION', 'APP SESSION组件', '1', '1', '8', NULL, '2019-01-24 09:33:13', NULL, NULL, '', '1', '0', '', '0', '', NULL, NULL, NULL, NULL, NULL, '7', '0'); +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('565', 'Attribute', '6', 'APP_SESSION', 'APP SESSION组件', '1', '1', '8', NULL, '2019-01-24 09:41:17', NULL, NULL, '', '1', '0', '', '0', '', NULL, NULL, NULL, NULL, NULL, '7', '0'); + +-- 修改字段注释 +ALTER TABLE `function_region_dict` MODIFY COLUMN `region_type` INT(1) NOT NULL COMMENT '1IP类,2字符串类,3增强字符串类,4数值类,5摘要类,6回调类,7 ASN,8 APP特征Session组件'; + + +-- APP Payload/http/ssl/domain/ip 增加控管参数组件、特征属性组件 +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('563', '', '7', 'APP_FEATURE_PROPERTIES', 'APP特征属性组件', '1', '1', '9', NULL, '2019-02-01 10:47:28', NULL, '2019-02-01 10:47:32', '', '0', '', '', '', '', NULL, NULL, NULL, NULL, NULL, '8', '0'); +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('565', '', '7', 'APP_FEATURE_PROPERTIES', 'APP特征属性组件', '1', '1', '9', NULL, '2019-02-01 10:47:28', NULL, '2019-02-01 10:47:32', '', '0', '', '', '', '', NULL, NULL, NULL, NULL, NULL, '8', '0'); +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('566', '', '7', 'APP_FEATURE_PROPERTIES', 'APP特征属性组件', '1', '1', '9', NULL, '2019-02-01 10:47:28', NULL, '2019-02-01 10:47:32', '', '0', '', '', '', '', NULL, NULL, NULL, NULL, NULL, '8', '0'); +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('403', '', '7', 'APP_FEATURE_PROPERTIES', 'APP特征属性组件', '1', '1', '9', NULL, '2019-02-01 10:47:28', NULL, '2019-02-01 10:47:32', '', '0', '', '', '', '', NULL, NULL, NULL, NULL, NULL, '2', '0'); +INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('405', '', '7', 'APP_FEATURE_PROPERTIES', 'APP特征属性组件', '1', '1', '9', NULL, '2019-02-01 10:47:28', NULL, '2019-02-01 10:47:32', '', '1', '', '', '', '', NULL, NULL, NULL, NULL, NULL, '2', '0'); diff --git a/src/main/resources/sql/20190215/update_app_complex_feature_cfg.sql b/src/main/resources/sql/20190215/update_app_complex_feature_cfg.sql new file mode 100644 index 000000000..85f870462 --- /dev/null +++ b/src/main/resources/sql/20190215/update_app_complex_feature_cfg.sql @@ -0,0 +1,14 @@ +-- APP特征 Session组件复用字段添加注释 +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `header_type` VARCHAR(16) DEFAULT '' COMMENT 'Session组件复用:传输服务端端口'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `ver` VARCHAR(4) DEFAULT '' COMMENT 'Session组件复用:传输协议'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `tos` VARCHAR(16) DEFAULT '' COMMENT 'Session组件复用:L7层协议'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `total_length` VARCHAR(16) DEFAULT '' COMMENT 'Session组件复用:链接建立方式'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `flags` VARCHAR(32) DEFAULT '' COMMENT 'Session组件复用:TCP包发送特性'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `fragment_offset` VARCHAR(32) DEFAULT '' COMMENT 'Session组件复用:域名初筛标识'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `payload_packet_direction` VARCHAR(8) DEFAULT NULL COMMENT 'payload包方向 | Session组件复用:清洗标识'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `payload_offset` INT(11) DEFAULT NULL COMMENT 'payload特征偏移量 | Session组件复用:session size min'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `payload_size` INT(11) DEFAULT NULL COMMENT 'payload包大小 | Session组件复用:session size max'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `icmp_identifier` VARCHAR(32) DEFAULT '' COMMENT 'Session组件复用:C2S Payload Size Sequence'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `icmp_type` VARCHAR(32) DEFAULT '' COMMENT 'Session组件复用:S2C Payload Size Sequence'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `icmp_code` VARCHAR(32) DEFAULT '' COMMENT 'Session组件复用:C2S Frequent Payload Size'; +ALTER TABLE `app_complex_feature_cfg` MODIFY COLUMN `protocol` VARCHAR(32) DEFAULT '' COMMENT 'Session组件复用:S2C Frequent Payload Size'; diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp index 327b898aa..225f316b0 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appDomainCfgForm.jsp @@ -40,6 +40,22 @@ $(function(){ errorContainer: "#messageBox", }); }); +//业务窗口打开 +var addContent = function(obj, contentClassName) { + var showDiv = $(obj).parent().parent().next(); + $(showDiv).removeClass("hidden").removeClass("disabled"); + $("select[name$='portPattern']").parents(".port").removeClass("hidden"); + $("input[name$='destIpAddress']").parents(".destPort").removeClass("hidden"); + $(".moreBtn").data("click-times",2); + $(obj).addClass("hidden"); +} + +//业务窗口关闭 +var delContent = function(contentClassName, addBtnClassName) { + $("." + contentClassName).addClass("hidden").addClass("disabled"); + $("." + addBtnClassName).removeClass("hidden"); +} + @@ -168,7 +184,7 @@ $(function(){ - + @@ -363,7 +379,22 @@ $(function(){ - + + +

+ + +

+ +
hidden disabled"> + + + + <%@include file="/WEB-INF/views/cfg/app/appFeatureProp.jsp"%> +
+
+ <%-- <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> --%> diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appFeatureProp.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appFeatureProp.jsp new file mode 100644 index 000000000..ae995ed8e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/app/appFeatureProp.jsp @@ -0,0 +1,203 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + +
+
+ +
+
+
+ +
+
+
+ +
+
+ checked /> + + +
+
+
+
+
+
+
+ +
+
+ checked /> + + +
+
+
+
+
+
+ + +
hidden> +
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ checked /> + + +
+
+
+
+
+
+
+ +
+
+ checked /> + + +
+
+
+
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ checked /> + + +
+
+
+
+
+
+
+ + + diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appFeatureSessionForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appFeatureSessionForm.jsp new file mode 100644 index 000000000..f29b00d94 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/app/appFeatureSessionForm.jsp @@ -0,0 +1,614 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + +<%-- + --%> + + + + + + +<%-- + --%> + +
+
+ +
+
+
+ + + + + +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+ <%--
+
+ +
+
+ +
+
+
+
--%> +
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+
+ + +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+
+ + +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +<%--
+
+
+ + + + +
+ +
+
+ + +
+ + domainCheck + " + type="text" + name="${cfgName}.cfgKeywords" + value="${cfg.cfgKeywords}"> +
+
+ +
+
+
+
--%> + + + +
hidden"> + +
+
+ +
+ + + +
+
+
+
+
+
+ +
+ + +
+
+
+
+
+ +
+
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp index 5dde687e4..16cb28500 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appIpCfgForm.jsp @@ -23,6 +23,22 @@ $(function(){ errorContainer: "#messageBox", }); }); +//业务窗口打开 +var addContent = function(obj, contentClassName) { + var showDiv = $(obj).parent().parent().next(); + $(showDiv).removeClass("hidden").removeClass("disabled"); + $("select[name$='portPattern']").parents(".port").removeClass("hidden"); + $("input[name$='destIpAddress']").parents(".destPort").removeClass("hidden"); + $(".moreBtn").data("click-times",2); + $(obj).addClass("hidden"); +} + +//业务窗口关闭 +var delContent = function(contentClassName, addBtnClassName) { + $("." + contentClassName).addClass("hidden").addClass("disabled"); + $("." + addBtnClassName).removeClass("hidden"); +} + @@ -53,7 +69,7 @@ $(function(){ - + + + + +

+ + +

+ +
hidden disabled"> + + + + <%@include file="/WEB-INF/views/cfg/app/appFeatureProp.jsp"%> +
+
+
+ <%-- <%@include file="/WEB-INF/include/form/areaInfo.jsp" %> --%> 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 37b1f681a..c417894c8 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appMultiFeatureCfgForm.jsp @@ -168,7 +168,80 @@ $(function(){ }, errorContainer: "#messageBox", }); + // APP SESSION域 Session Size Min 和 Session Size Max属性限制 + $(".sessionSizeMin").on("change",function(){ + var minValue = parseInt($(".sessionSizeMin").val()); + $(".sessionSizeMax").prop("min",minValue+1); + $(".sessionSizeMax").addClass("required"); + if($(".sessionSizeMin").val() == ""){ + $(".sessionSizeMax").removeClass("required"); + } + + }); + $(".sessionSizeMax").on("change",function(){ + var maxValue = parseInt($(".sessionSizeMax").val()); + $(".sessionSizeMin").prop("max",maxValue-1); + $(".sessionSizeMin").addClass("required"); + if($(".sessionSizeMax").val() == ""){ + $(".sessionSizeMin").removeClass("required"); + } + + }); + + $(".c2s_radio").on("click",function(){ + if($(this).val() == "c2sPayload"){ + $(".c2sPayload").removeClass("hidden"); + $(".c2sFrequent").addClass("hidden"); + }else if($(this).val() == "c2sFrequent"){ + $(".c2sFrequent").removeClass("hidden"); + $(".c2sPayload").addClass("hidden"); + + } + }); + $(".s2c_radio").on("click",function(){ + if($(this).val() == "s2cPayload"){ + $(".s2cPayload").removeClass("hidden"); + $(".s2cFrequent").addClass("hidden"); + }else if($(this).val()=="s2cFrequent"){ + $(".s2cFrequent").removeClass("hidden"); + $(".s2cPayload").addClass("hidden"); + } + }); + + $(".c2sAndS2cInput").tagsInput({ + width:$(".c2sAndS2cInput").find(".form-control").width(), + defaultText:'please input ignore query string in URL', + 'delimiter':';',//特殊字符串分隔与表达式的多关键词 + maxCount:4, + onAddTag:function(tag,size){ + //var reg = new RegExp(/\t|\r|\n|,/); + var reg = new RegExp(/^([0-9]*)$/); + if (!tag.match(reg)) { + $(this).parent(".col-md-6").next("div").html(""); + }else{ + $(this).parent(".col-md-6").next("div").html(""); + } + }, + onRemoveTag:function(tag,size){ + $(this).parent(".col-md-6").next("div").html(""); + } + }); + + $(".tagsinput").popover({ + animation:true, + container:'body', + placement:'right', + html:true, + trigger:"hover", + title:"", + content:function(){ + var content = $("#tagsinputTip").text(); + return content; + } + }); + }); + //业务窗口打开 var addContent = function(obj, contentClassName) { var showDiv = $(obj).parent().parent().next(); @@ -341,6 +414,7 @@ function changeKeywordFormate(exprType,obj){ + @@ -435,7 +509,7 @@ function changeKeywordFormate(exprType,obj){ - +

@@ -443,6 +517,71 @@ function changeKeywordFormate(exprType,obj){ class="glyphicon glyphicon-plus ${tabName}Add hidden" onClick="addContent(this,'${tabName}')" title="add">

+ + <%-- --%> + + + + + + +
+ + + + <%@include file="/WEB-INF/views/cfg/app/appFeatureSessionForm.jsp"%> +
+ + +
+
+
+ + + + +
+ +
1 and status.index>0}"> hidden disabled"> + + + + <%@include file="/WEB-INF/views/cfg/app/appFeatureSessionForm.jsp"%> +
+ +
+
+
+ + +

+ + +

+ +
hidden disabled"> + + + + <%@include file="/WEB-INF/views/cfg/app/appFeatureProp.jsp"%> +
+
+ + + +

+ + +

<%-- --%> 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 2c94ed0fe..8e780cb3c 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appSubFeatureList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appSubFeatureList.jsp @@ -35,101 +35,112 @@
--%> -
- <%-- _${regionStatus.index} --%> - + + <%-- _${regionStatus.index} --%> +
- + ${region.regionValue}_${regionStatus.index} -
+
- -
-
-
-
-
- - -
-
-
- -
-
-
-
-
- -
-
-
-
- +
- -
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
- -
@@ -137,129 +148,132 @@
- + -
+
- +
- +
- -
-
-
-
-
- - -
-
-
- -
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- -
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- -
-
-
- - -
-
-
-
-
-
- - -
-
-
-
-
- - - - - - -
+
- +
+
+ +
+
+
+ +
+
- - -
- <%--
+
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + +
+
+
+
+ +
+
+
+ + +
+ <%--
@@ -269,195 +283,391 @@
--%> -
-
- -
-
-
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
-
-
- -
-
-
-
- -
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
+
-
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
-
-
-
- - -
-
-
- -
- + +
- -
- -
-
-
- - ${cfg.payloadOffset } -
-
-
-
-
+ + +
- -
+
+
+ +
+
+
+ + ${cfg.payloadOffset } +
+
+
+
+
+
+
+
-
- -
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- -
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- -
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- + +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+ + +
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+
+
+
-
+
@@ -473,6 +683,98 @@
+ + +
+
hidden> +
+
+
+ +
+
+
+
+ +
+
+
+
+
hidden> +
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js index 36f9f7ee7..95772dfd6 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js @@ -798,6 +798,15 @@ jQuery.validator.addMethod("portCheck",function(value, element) { } } }); +jQuery.validator.addMethod("sessionDPortCheck",function(value, element) { + //port 1~65535 + if(this.optional(element)||(/^([1-9][0-9]{0,4})$/.test(value)&& RegExp.$1 <=65535)){ + return true; + } + return false; + +}); + jQuery.validator.addMethod("chooseAreaOrIsp",function(value, element) { var isp=""; if($(element).is(":visible")){ diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js index cff038c88..9cb3e4851 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js @@ -90,6 +90,7 @@ log_trend:"Log Trend", info:"Prompt", protect_warn:"Policy with relax precondition may consume too much resources.Use with cautions!", - log_no_data:"This hour no data" + log_no_data:"This hour no data", + sessionDPortCheck:"Port must between 1 and 65535" }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js index 9f7490a33..b0a64de63 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_ru.js @@ -90,6 +90,7 @@ log_trend:"Журнал Тенденция", info:"Инфо", protect_warn:"Policy with relax precondition may consume too much resources.Use with cautions!", - log_no_data:"Нет данных за этот час" + log_no_data:"Нет данных за этот час", + sessionDPortCheck:"Порт должен между 1 и 65535" }); }(jQuery)); diff --git a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js index 11cf137d9..a6851dc0d 100644 --- a/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js +++ b/src/main/webapp/static/global/plugins/jquery-validation/1.11.0/localization/messages_zh.js @@ -90,6 +90,7 @@ log_trend:"日志趋势", info:"提示", protect_warn:"该策略执行条件过于宽泛,会消耗较多的计算资源。慎用!", - log_no_data:"本小时无数据" + log_no_data:"本小时无数据", + sessionDPortCheck:"端口应介于1到65535之间,数字不能以0开头" }); }(jQuery)); diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index dd4812ab4..56386d795 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -1548,10 +1548,14 @@ var validCharLength=function(){ $(this).find(".tag").each(function(){ text+=$(this).children("span").text().trim(); }); - if(text.length < 4 || text.length > 1024){ - $(this).parents(".col-md-6").next("div").html(""); - if(flag){ - flag=false; + if(text.length < 4 || text.length > 1024 && (!sessionTagsFlag)){ + // APP特征配置Session组件tagsInput不校验字符长度 + var sessionTagsFlag = $(this).prev().hasClass("c2sAndS2cInput"); + if((text.length < 4 || text.length > 1024) && (!sessionTagsFlag)){ + $(this).parents(".col-md-6").next("div").html(""); + if(flag){ + flag=false; + } } } });