IP Spoofing增加配置导入功能.

This commit is contained in:
zhangwenqing
2019-01-15 14:12:33 +08:00
parent c78edb4d50
commit d70f53301e
10 changed files with 285 additions and 3 deletions

View File

@@ -522,7 +522,38 @@ public class ExportExcel {
index++;
}
}
/** Ip Spoofing **/
if("spoofing".equals(headerStr) && (region.getFunctionId().equals(214))){
commentStr="";
List<SysDataDictionaryItem> dict=DictUtils.getDictList("SPOOFING_IP_TYPE");
if(dict !=null && dict.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
index++;
}
defaultValue=dict.get(0).getItemCode();
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
if(!StringUtil.isEmpty(defaultValue)){
//1、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
index++;
}
}
if(("With".equals(headerStr)) && (region.getFunctionId().equals(214))){
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、非空
commentStr=commentStr+""+msgProp.getProperty("required")+"\n";
index++;
}
if(region.getRegionType().equals(1)){//IP配置
//ip配置需要导入的信息srcIp srcPort destIp destPort Protocol Direction
//确定需要导入的srcIp srcPort destIp destPort信息

View File

@@ -521,6 +521,38 @@ public class CheckIpFormatThread implements Callable<String>{
}
}
// IpSpoofing
if (regionDict.getFunctionId().equals(214)) {
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("SPOOFING_IP_TYPE");
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1(dicts.get(0).getItemCode());
}
String userRegion1 = baseIpCfg.getUserRegion1(); // SpooFing
String userRegion2 = baseIpCfg.getUserRegion2(); // With
if (StringUtils.isNotBlank(userRegion1)) {
boolean has = false;
for (SysDataDictionaryItem dict : dicts) {
if (dict.getItemCode().equals(userRegion1)) {
has = true;
break;
}
}
if (!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),prop.getProperty("spoofing") + " ") + ";");
}
}
String errMsg = null == prop.getProperty("With")?"With ":prop.getProperty("With");
if(StringUtils.isBlank(userRegion2)) {
errInfo.append(
String.format(prop.getProperty("can_not_null"),errMsg + " ") + ";");
}else {
String regex = "^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$";
if(!userRegion2.matches(regex)) {
errInfo.append(String.format(prop.getProperty("is_in_wrong_format"),errMsg +" ") + ";");
}
}
}
if (regionDict.getRegionType().equals(1)) {
boolean srcIpEmpty = false;
boolean destIpEmpty = false;