ishexbinbug更改

ip表单拆成ip domain和payload
This commit is contained in:
duandongmei
2018-09-30 09:56:20 +08:00
parent 190d924195
commit 16f3b0e15a
2 changed files with 19 additions and 196 deletions

View File

@@ -132,11 +132,20 @@
</script>
</head>
<body>
<!-- fucntion_ID 200-IP 201-DOMAIN -->
<c:if test="${_cfg.functionId eq 200}">
<c:set var="interceptType" value="Ip"/>
</c:if>
<c:if test="${_cfg.functionId eq 201}">
<c:set var="interceptType" value="Domain"/>
</c:if>
<c:if test="${_cfg.functionId eq 212}">
<c:set var="interceptType" value="Domain"/>
</c:if>
<span id="keywordError" style="display:none"><spring:message code="required"></spring:message></span>
<span id="tagsinputTip" style="display:none"><spring:message code="multiple_keywords_tip"></spring:message></span>
<div class="page-content">
<h3 class="page-title">
<%-- <h3 class="page-title">
<!-- fucntion_ID 200-IP 201-DOMAIN -->
<c:if test="${_cfg.functionId eq 200}">
<spring:message code="ip_intercept"></spring:message>
@@ -146,7 +155,7 @@
<spring:message code="domain_intercept"></spring:message>
<c:set var="interceptType" value="Domain"/>
</c:if>
</h3>
</h3> --%>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">

View File

@@ -1,14 +1,4 @@
$(function(){
$.ipcommon=function(){
return {};
}
$.extend($.ipcommon, {
ipType:[],
ipPattern:[],
portPattern:[],
protocol:[],
direction:[]
});
$("input[name$='isCaseSenstive']").on("change",function(){
setIsHexBin(this);
});
@@ -425,7 +415,6 @@ $(function(){
window.history.back();
return false;
});
initCommIpVal();
//去掉首尾空格
$("input,textarea").on("blur",function(){
var val=$(this).val();
@@ -752,7 +741,11 @@ var setIsHexBin=function(obj){
$("input[name='"+profix+"isCaseSenstive'][value=1]").prop("checked",false);
$("input[name='"+profix+"isCaseSenstive'][value=1]").parent().addClass("hidden");
}else{
$("input[name='"+profix+"isCaseSenstive'][value=1]").parent().removeClass("hidden");
var configHex=$("input[name='"+profix+"configHex']").val();
configHex=","+configHex+",";
if(configHex.indexOf(",2,") > -1){
$("input[name='"+profix+"isCaseSenstive'][value=1]").parent().removeClass("hidden");
}
}
var isCaseSenstive=$("input[name='"+profix+"isCaseSenstive']:checked").val();
//设置isHexbin下拉框的值
@@ -1283,7 +1276,7 @@ var viewAreaInfo=function(path,areaEffectiveIds,compileId){
var title="";
if(data.areaIsps.length > 0){
title=$.validator.messages.area;//+" "+$.validator.messages.isp;
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;margin-top: 15px;'>";
html+="<thead>";
html+="<th style='width:50%;padding-right:0px'>"+$.validator.messages.area+"</th>";/* +
"<th style='width:50%;padding-right:0px'>"+$.validator.messages.isp+"</th>";*/
@@ -1302,7 +1295,7 @@ var viewAreaInfo=function(path,areaEffectiveIds,compileId){
}
if(data.areaIps.length > 0){
title=$.validator.messages.area+" ip";
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;margin-top: 15px;'>";
html+="<thead>";
html+="<th style='width:20%;padding-right:0px'>"+$.validator.messages.ip_type+"</th>" +
"<th style='width:20%;padding-right:0px'>"+$.validator.messages.ip_pattern+"</th>" +
@@ -1675,185 +1668,6 @@ var setHexCaseSenstive=function(){
});
}
/**
* ip默认选项处理
*/
var initCommIpVal=function(){
var action,regionCode,serviceType,ipPortShow,ipType,
ipPattern,portPattern,direction,protocol,regionType;
if($("input[name$='action']:checked").length>0){
regionCode=$("input[name$='action']:checked").attr("regionCode");
action=$("input[name$='action']:checked").val();
}else{
regionCode=$("input[name$='action']").attr("regionCode");
action=$("input[name$='action']").val();
}
if(regionCode){
if(regionCode.indexOf(",")==-1){
$("#cfgRegionCode"+regionCode).attr("name","cfgRegionCode");
$("#cfgType"+regionCode).attr("name","cfgType");
}else{
var _region='';
var regionArr=regionCode.split(',');
$("input[name$='cfgRegionCode'][regionType='1']").each(function(){
for(var re in regionArr){
if($(this).val()==regionArr[re]){
_region=regionArr[re];
break;
}
}
});
if(_region!=''){
regionCode=_region;
}
}
}
if(regionCode){//IP域大于1个根据action获取ip属性
ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
}else{//IP域只有一个获取regionType为1的
ipPortShow=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPortShow"),
ipType=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipType"),
ipPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPattern"),
portPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("portPattern"),
direction=$("input[name$='cfgRegionCode'][regionType='1']").attr("direction"),
protocol=$("input[name$='cfgRegionCode'][regionType='1']").attr("protocol"),
regionType=$("input[name$='cfgRegionCode'][regionType='1']").attr("regionType");
}
//ip端口处理
if(ipPortShow){
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
$("input[name$='srcIpAddress']").parents(".form-group").removeClass("hidden");
$("input[name$='srcPort']").parents(".form-group").removeClass("hidden");
}else{
$("input[name$='srcIpAddress']").parents(".form-group").addClass("hidden");
$("input[name$='srcPort']").parents(".form-group").addClass("hidden");
}
if(ipPortShow.indexOf('2')>-1){//展示目的IP,端口
$("input[name$='destIpAddress']").parents(".form-group").removeClass("hidden");
$("input[name$='destPort']").parents(".form-group").removeClass("hidden");
}else{
$("input[name$='destIpAddress']").parents(".form-group").addClass("hidden");
$("input[name$='destPort']").parents(".form-group").addClass("hidden");
}
}
//ip类型处理
if(ipType){
var arr=ipType.split(',');
$.ipcommon.ipType=$("select[name$='ipType'] option");
$("select[name$='ipType'] option").each(function(){
var has=false;
for(var type in arr){
if($(this).val()==arr[type]){
has=true;
if($(this).attr("disabled")){
$(this).removeAttr("disabled")
}
break;
}
}
if(!has){
$(this).remove();
}
});
}else{
$.ipcommon.ipType=[];
}
//ip格式处理
if(ipPattern){
arr=ipPattern.split(',');
$.ipcommon.ipPattern=$("select[name$='ipPattern'] option");
$("select[name$='ipPattern'] option").each(function(){
var has=false;
for(var type in arr){
if($(this).val()==arr[type]){
has=true;
if($(this).attr("disabled")){
$(this).removeAttr("disabled")
}
break;
}
}
if(!has){
$(this).remove();
}
});
}else{
$.ipcommon.ipPattern=[];
}
//端口格式处理
if(portPattern){
arr=portPattern.split(',');
$.ipcommon.portPattern=$("select[name$='portPattern'] option");
$("select[name$='portPattern'] option").each(function(){
var has=false;
for(var type in arr){
if($(this).val()==arr[type]){
has=true;
if($(this).attr("disabled")){
$(this).removeAttr("disabled")
}
break;
}
}
if(!has){
$(this).remove();
}
});
}else{
$.ipcommon.portPattern=[];
}
//方向处理
if(direction){
arr=direction.split(',');
$.ipcommon.direction=$("select[name$='direction'] option");
$("select[name$='direction'] option").each(function(){
var has=false;
for(var type in arr){
if($(this).val()==arr[type]){
has=true;
if($(this).attr("disabled")){
$(this).removeAttr("disabled")
}
break;
}
}
if(!has){
$(this).remove();
}
});
}else{
$.ipcommon.direction=[];
}
//协议处理
if(protocol){
arr=protocol.split(',');
$.ipcommon.protocol=$("select[name$='protocol'] option");
$("select[name$='protocol'] option").each(function(){
var has=false;
for(var type in arr){
if($(this).val()==arr[type]){
has=true;
if($(this).attr("disabled")){
$(this).removeAttr("disabled")
}
break;
}
}
if(!has){
$(this).remove();
}
});
}else{
$.ipcommon.protocol=[];
}
}
function heightDiv(type){
var hei=document.documentElement.clientHeight;