劫持、注入、镜像、阻断页面、拦截证书内容引用时的处理
This commit is contained in:
@@ -132,10 +132,8 @@ public class InterceptController extends CommonController {
|
||||
String keyring = request.getParameter("keyring");
|
||||
if(StringUtils.isNotBlank(keyring)) {
|
||||
entity.getUserRegion().put("keyring", Long.parseLong(keyring));
|
||||
entity.setUserRegion4(keyring);
|
||||
}else {
|
||||
entity.getUserRegion().put("keyring", 0);
|
||||
entity.setUserRegion4("0");
|
||||
}
|
||||
Map<String,Object> map = new HashMap();
|
||||
//exclusions
|
||||
@@ -237,10 +235,9 @@ public class InterceptController extends CommonController {
|
||||
if("1".equals(enable)) {
|
||||
if(StringUtils.isNotBlank(mirror_profile)){
|
||||
map.put("mirror_profile", mirror_profile.trim());
|
||||
entity.setUserRegion5(mirror_profile.trim());
|
||||
}
|
||||
}
|
||||
entity.getUserRegion().put("decrypt_mirror", map);
|
||||
}
|
||||
entity.getUserRegion().put("decrypt_mirror", map);
|
||||
}
|
||||
interceptCfgService.saveInterceptCfg(entity);
|
||||
//配置仅保存
|
||||
|
||||
@@ -1012,31 +1012,4 @@ public class PxyObjKeyringController extends BaseController {
|
||||
}
|
||||
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证Keyring是否有被使用
|
||||
*
|
||||
* @param entity
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "/ajaxKeyinfIsUsed" })
|
||||
public boolean ajaxKeyinfIsUsed(String[] compileIds, HttpServletRequest request, HttpServletResponse response) {
|
||||
for(String compileId:compileIds){
|
||||
CfgIndexInfo cfg = new CfgIndexInfo();
|
||||
cfg.setIsAudit(1);
|
||||
cfg.setIsValid(1);
|
||||
cfg.setFunctionId(200);//代理拦截策略
|
||||
cfg.setServiceId(512);
|
||||
cfg.setUserRegion1(compileId);
|
||||
List<CfgIndexInfo> list = httpRedirectCfgService.getCfgIndexInfos(cfg);
|
||||
if (list.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.nis.web.controller.configuration.proxy;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.nis.web.service.configuration.StatusOfUsedService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/proxy/statusOfUsed")
|
||||
public class StatusOfUsedController extends BaseController{
|
||||
@Autowired
|
||||
protected StatusOfUsedService statusOfUsedService;
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "/ajaxRequest" })
|
||||
public boolean statusOfUsed(String[] compileIds, HttpServletRequest request, HttpServletResponse response) {
|
||||
Integer isValid = Integer.parseInt(request.getParameter("isValid"));
|
||||
Integer ServiceId = Integer.parseInt(request.getParameter("serviceId"));
|
||||
Integer functionId = 0;
|
||||
String key = "";
|
||||
//拦截证书策略
|
||||
if(ServiceId==520){
|
||||
functionId = 200;
|
||||
ServiceId = 512;
|
||||
key = "keyring";
|
||||
}//流量转发目的地址
|
||||
if(ServiceId==645){
|
||||
functionId = 200;
|
||||
ServiceId = 512;
|
||||
key = "mirror_profile";
|
||||
}
|
||||
//劫持文件、注入脚本文件
|
||||
else if(ServiceId==643 || ServiceId==644){
|
||||
functionId = 215;
|
||||
ServiceId = 656;
|
||||
}//访问阻断页面
|
||||
else if(ServiceId==646){
|
||||
functionId = 207;
|
||||
ServiceId = 576;
|
||||
}
|
||||
if(ServiceId == 576 || ServiceId==656){
|
||||
for(String compileId:compileIds){
|
||||
CfgIndexInfo cfg = new CfgIndexInfo();
|
||||
if(ServiceId==656){
|
||||
cfg.setUserRegion4(compileId);
|
||||
}else if(ServiceId==576){
|
||||
cfg.setUserRegion3(compileId);
|
||||
}
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setFunctionId(functionId);
|
||||
cfg.setServiceId(ServiceId);
|
||||
|
||||
List<CfgIndexInfo> list = statusOfUsedService.getStatusOfUsed(cfg);
|
||||
if (list.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}else if(ServiceId==512){
|
||||
CfgIndexInfo cfg = new CfgIndexInfo();
|
||||
cfg.setIsValid(isValid);
|
||||
cfg.setFunctionId(functionId);
|
||||
cfg.setServiceId(ServiceId);
|
||||
List<CfgIndexInfo> list = statusOfUsedService.getStatusOfUsed(cfg);
|
||||
Map<String,Map<String,Object>> tempMap = new HashMap<>();
|
||||
for(CfgIndexInfo temp:list){
|
||||
tempMap = BaseService.gsonFromJson(temp.getUserRegion1(), Map.class);
|
||||
String value = "";
|
||||
if("keyring".equals(key)){
|
||||
value = String.valueOf(tempMap.get(key));
|
||||
}else if("mirror_profile".equals(key)){
|
||||
value = String.valueOf(tempMap.get("decrypt_mirror").get("mirror_profile"));
|
||||
}
|
||||
|
||||
for(String s: compileIds){
|
||||
if(s.equals(value))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user