appsession组件 特征组件,管控组件
This commit is contained in:
@@ -44,23 +44,43 @@ public class AppComplexFeatureCfg extends BaseCfg<AppComplexFeatureCfg> {
|
||||
private List<AppIpCfg> 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;
|
||||
}
|
||||
|
||||
@@ -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<AppDomainCfg> {
|
||||
private String cfgKeywords;
|
||||
@ExcelField(title="social_app",sort=2)
|
||||
private String appName;
|
||||
|
||||
private AppFeatureProperties appFeaturePropCfg;
|
||||
private List<AppFeatureProperties> appFeaturePropCfgList = new ArrayList();
|
||||
|
||||
/**
|
||||
* 表达式类型
|
||||
*/
|
||||
@@ -71,6 +78,22 @@ public class AppDomainCfg extends BaseCfg<AppDomainCfg> {
|
||||
|
||||
|
||||
|
||||
public AppFeatureProperties getAppFeaturePropCfg() {
|
||||
return appFeaturePropCfg;
|
||||
}
|
||||
|
||||
public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) {
|
||||
this.appFeaturePropCfg = appFeaturePropCfg;
|
||||
}
|
||||
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfgList() {
|
||||
return appFeaturePropCfgList;
|
||||
}
|
||||
|
||||
public void setAppFeaturePropCfgList(List<AppFeatureProperties> appFeaturePropCfgList) {
|
||||
this.appFeaturePropCfgList = appFeaturePropCfgList;
|
||||
}
|
||||
|
||||
public Integer getIsHex() {
|
||||
return isHex;
|
||||
}
|
||||
|
||||
@@ -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<AppFeatureIndex> {
|
||||
private AppByteCfg strCfg;
|
||||
private AppIpCfg ipCfg;
|
||||
private List<AppIpCfg> ipPortList = new ArrayList();
|
||||
private AppFeatureProperties appFeaturePropCfg;
|
||||
private List<AppFeatureProperties> appFeaturePropCfgList = new ArrayList();
|
||||
|
||||
private List<AppStringFeatureCfg> strList = new ArrayList();
|
||||
private List<AppComplexFeatureCfg> complexList = new ArrayList();
|
||||
private List<AppComplexFeatureCfg> sessionList = new ArrayList();
|
||||
private List<AppTcpCfg> numCfgList = new ArrayList();
|
||||
protected Integer exprType ;
|
||||
protected Integer matchMethod ;
|
||||
@@ -194,4 +197,23 @@ public class AppFeatureIndex extends BaseCfg<AppFeatureIndex> {
|
||||
this.relationTime = relationTime;
|
||||
}
|
||||
|
||||
public List<AppComplexFeatureCfg> getSessionList() {
|
||||
return sessionList;
|
||||
}
|
||||
public void setSessionList(List<AppComplexFeatureCfg> sessionList) {
|
||||
this.sessionList = sessionList;
|
||||
}
|
||||
|
||||
public AppFeatureProperties getAppFeaturePropCfg() {
|
||||
return appFeaturePropCfg;
|
||||
}
|
||||
public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) {
|
||||
this.appFeaturePropCfg = appFeaturePropCfg;
|
||||
}
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfgList() {
|
||||
return appFeaturePropCfgList;
|
||||
}
|
||||
public void setAppFeaturePropCfgList(List<AppFeatureProperties> appFeaturePropCfgList) {
|
||||
this.appFeaturePropCfgList = appFeaturePropCfgList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<AppFeatureProperties> {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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<AppIpCfg> {
|
||||
protected String srcPort;
|
||||
@ExcelField(title="server_port",sort=5)
|
||||
protected String destPort;
|
||||
private AppFeatureProperties appFeaturePropCfg;
|
||||
private List<AppFeatureProperties> appFeaturePropCfgList = new ArrayList();
|
||||
|
||||
|
||||
/**
|
||||
* 方向
|
||||
@@ -71,6 +75,18 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
|
||||
public Integer getIpType() {
|
||||
return ipType;
|
||||
}
|
||||
public AppFeatureProperties getAppFeaturePropCfg() {
|
||||
return appFeaturePropCfg;
|
||||
}
|
||||
public void setAppFeaturePropCfg(AppFeatureProperties appFeaturePropCfg) {
|
||||
this.appFeaturePropCfg = appFeaturePropCfg;
|
||||
}
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfgList() {
|
||||
return appFeaturePropCfgList;
|
||||
}
|
||||
public void setAppFeaturePropCfgList(List<AppFeatureProperties> appFeaturePropCfgList) {
|
||||
this.appFeaturePropCfgList = appFeaturePropCfgList;
|
||||
}
|
||||
/**
|
||||
* @param ipType the ipType to set
|
||||
*/
|
||||
|
||||
@@ -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<SpecificServiceCfg> 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<AppComplexFeatureCfg> sessionList = appMultiFeatureCfgService
|
||||
.getAppComplexFeatureCfg(compileId, functionId, Integer.valueOf(cfgRegionCode[i]));
|
||||
map.put("sessionList", sessionList);
|
||||
}
|
||||
if ("9".equals(cfgRegionType[i])) {
|
||||
List<AppFeatureProperties> featureList = appMultiFeatureCfgService
|
||||
.getAppFeaturePropCfg(compileId, functionId, null);
|
||||
map.put("featureList", featureList);
|
||||
}
|
||||
|
||||
tabList.add(map);
|
||||
}
|
||||
// 获取L7 Protocol
|
||||
SpecificServiceCfg specificServiceCfg = new SpecificServiceCfg();
|
||||
specificServiceCfg.setCfgType(3);
|
||||
List<SpecificServiceCfg> l7ProtoList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg, null);
|
||||
|
||||
model.addAttribute("l7ProtoList", l7ProtoList);
|
||||
|
||||
} else {
|
||||
Map<String, Object> map = new HashMap();
|
||||
map.put("regionType", "0");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
// 获取所有响应策略信息
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
<include refid="PolicyGroupInfoColumns"/>
|
||||
FROM policy_group_info r
|
||||
where r.is_valid=1 and r.group_type=#{groupType,jdbcType=INTEGER}
|
||||
<if test="flag!=null">
|
||||
<if test="flag!=null and flag != ''">
|
||||
and ud_flag=#{flag}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -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<AppTcpCfg> getAppTcpCfg(@Param("compileId")Integer compileId,
|
||||
@Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode);
|
||||
public List<AppComplexFeatureCfg> 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<AppFeatureIndex> findAppByFeatureIndexList(@Param("ids")String ids);
|
||||
//App特征属性配置
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfg(@Param("compileId")Integer compileId,
|
||||
@Param("functionId")Integer functionId,@Param("cfgRegionCode")Integer cfgRegionCode);
|
||||
|
||||
public int insertAppFeaturePropCfg(AppFeatureProperties entity);
|
||||
public void deleteAppFeaturePropCfg(BaseCfg entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -118,6 +118,12 @@
|
||||
<result column="payload_offset" property="payloadOffset" jdbcType="INTEGER" />
|
||||
<result column="payload_size" property="payloadSize" jdbcType="INTEGER" />
|
||||
<result column="payload_packet_direction" property="payloadPacketDirection" jdbcType="VARCHAR" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
<result column="user_region4" property="userRegion4" jdbcType="VARCHAR" />
|
||||
<result column="user_region5" property="userRegion5" jdbcType="VARCHAR" />
|
||||
|
||||
</resultMap>
|
||||
<!-- APP字符串类配置映射 -->
|
||||
<resultMap id="AppStringFeatureCfgMap" type="com.nis.domain.configuration.AppStringFeatureCfg" >
|
||||
@@ -181,6 +187,36 @@
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="do_log" property="doLog" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<!-- APP 特征属性配置映射 -->
|
||||
<resultMap id="AppFeaturePropCfgMap" type="com.nis.domain.configuration.AppFeatureProperties" >
|
||||
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
|
||||
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
|
||||
<result column="request_id" property="requestId" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
|
||||
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
|
||||
<result column="drop_opt" property="dropOpt" jdbcType="INTEGER" />
|
||||
<result column="loop_opt" property="loopOpt" jdbcType="INTEGER" />
|
||||
<result column="weak_feature" property="weakFeature" jdbcType="VARCHAR" />
|
||||
<result column="whitelist_feature" property="whitelistFeature" jdbcType="VARCHAR" />
|
||||
<result column="extend_scan_pkt_num" property="extendScanPktNum" jdbcType="INTEGER" />
|
||||
<result column="correlation_valid_time" property="correlationValidTime" jdbcType="INTEGER" />
|
||||
<result column="correlation_block_after" property="correlationBlockAfter" jdbcType="VARCHAR" />
|
||||
<result column="long_stream_lock_time" property="longStreamLockTime" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="AppFeaturePropCfg_Column" >
|
||||
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
|
||||
</sql>
|
||||
|
||||
<sql id="AppFeatureIndex_Column" >
|
||||
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
|
||||
</sql>
|
||||
@@ -511,6 +548,16 @@
|
||||
AND r.cfg_region_code = #{cfgRegionCode,jdbcType=BIGINT}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getAppComplexFeatureCfgNotRegionCode" resultMap="AppComplexFeatureCfgMap">
|
||||
SELECT
|
||||
<include refid="AppComplexFeatureCfg_Column" />
|
||||
FROM app_complex_feature_cfg r
|
||||
WHERE r.compile_id=#{compileId} and r.function_id=#{functionId}
|
||||
<if test="cfgRegionCode !=null ">
|
||||
AND r.cfg_region_code != #{cfgRegionCode,jdbcType=BIGINT}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 新增app_ip_range子配置 -->
|
||||
<insert id="insertAppIpRangeCfg" parameterType="com.nis.domain.configuration.AppIpCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
@@ -653,5 +700,39 @@
|
||||
where r.CFG_ID in (${ids})
|
||||
</select>
|
||||
|
||||
<insert id="insertAppFeaturePropCfg" parameterType="com.nis.domain.configuration.AppFeatureProperties" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
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}
|
||||
)
|
||||
</insert>
|
||||
<!-- 删除App 特征属性子配置 -->
|
||||
<delete id="deleteAppFeaturePropCfg" >
|
||||
delete from app_feature_prop_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
<!-- 查询特征属性配置列表 -->
|
||||
<select id="getAppFeaturePropCfg" resultMap="AppFeaturePropCfgMap">
|
||||
SELECT
|
||||
<include refid="AppFeaturePropCfg_Column" />
|
||||
FROM app_feature_prop_cfg r
|
||||
WHERE r.compile_id=#{compileId} and r.function_id=#{functionId}
|
||||
<if test="cfgRegionCode !=null ">
|
||||
AND r.cfg_region_code = #{cfgRegionCode,jdbcType=BIGINT}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -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<Integer> 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<AppPolicyCfg> findAppPolicyList(Page<AppPolicyCfg> page, AppPolicyCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(), "r"));
|
||||
|
||||
@@ -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<AppComplexFeatureCfg> complexList = appMultiFeatureCfgDao.getAppComplexFeatureCfg(entity.getCompileId(),entity.getFunctionId(),null);
|
||||
//List<AppComplexFeatureCfg> complexList = appMultiFeatureCfgDao.getAppComplexFeatureCfg(entity.getCompileId(),entity.getFunctionId(),null);
|
||||
List<AppComplexFeatureCfg> 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<AppComplexFeatureCfg> 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<AppTcpCfg> numCfgList = new ArrayList<AppTcpCfg>();
|
||||
List<AppComplexFeatureCfg> appSessionList2 = new ArrayList<AppComplexFeatureCfg>();
|
||||
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<String,List> map = cfgConvert(strRegionList,appSessionList,2,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
|
||||
if(numCfgList.size() > 0) {
|
||||
Map<String,List> map2 = cfgConvert(numRegionList,numCfgList,4,entity,groupRelationList);
|
||||
groupRelationList=map2.get("groupList");
|
||||
numRegionList=map2.get("dstList");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<AppTcpCfg> 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<AppFeatureProperties> 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<AppComplexFeatureCfg> getAppComplexFeatureCfgNotRegionCode(Integer compileId,Integer functionId,Integer cfgRegionCode){
|
||||
return appMultiFeatureCfgDao.getAppComplexFeatureCfgNotRegionCode(compileId,functionId,cfgRegionCode);
|
||||
}
|
||||
|
||||
//字符串类特征配置列表
|
||||
public List<AppStringFeatureCfg> getAppStringFeatureCfg(Integer compileId,Integer functionId,Integer cfgRegionCode){
|
||||
@@ -507,7 +789,11 @@ public class AppMultiFeatureCfgService extends BaseService {
|
||||
public List<AppTcpCfg> getAppTcpCfg(Integer compileId,Integer functionId,Integer cfgRegionCode){
|
||||
return appMultiFeatureCfgDao.getAppTcpCfg(compileId,functionId,cfgRegionCode);
|
||||
}
|
||||
|
||||
//特征属性配置列表
|
||||
public List<AppFeatureProperties> getAppFeaturePropCfg(Integer compileId,Integer functionId,Integer cfgRegionCode){
|
||||
return appMultiFeatureCfgDao.getAppFeaturePropCfg(compileId,functionId,cfgRegionCode);
|
||||
}
|
||||
|
||||
public Map<String, List> exportFeature(AppFeatureIndex entity){
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
List<AppIpCfg> ipRangeList = appMultiFeatureCfgDao.getAppIpRangeCfg(entity.getCompileId(),entity.getFunctionId());
|
||||
|
||||
Reference in New Issue
Block a user