varopts={lines:15,length:18,width:9,radius:61,scale:2,corners:1,color:"#000",opacity:0.2,rotate:13,direction:1,speed:0.5,trail:50,fps:20,zIndex:2000000000,className:"spinner",top:"50%",left:"50%",shadow:false,hwaccel:false,position:"absolute"};varsel_tgts=[];$(function(){vara=document.getElementById("loading");varb=newSpinner(opts).spin(a);$(".close, .backdrop").click(function(){close_box()});$(".notes").click(function(){$(this).siblings("span").show()});$(".toggler").click(collapse_expand);$(".target-notes").click(get_target_notes);$("#save-tgt-notes").click(save_target_notes)});functionupdate_tgt_chk(a){if($(a).is(":checked")){sel_tgts.push($(a).val())}else{sel_tgts.splice($.inArray($(a).val(),sel_tgts),1)}}functionopen_move_to(){if($("#ste").val()<1){alert("Please select an ST&E");return}if($(":checkbox:checked").length<1){alert("Please select a device to move");return}$("#move_to").animate({opacity:"1.00"},300,"linear");$("#move_to").css("display","block");view_box()}functionedit_cat(e){if($("#ste").val()<1){alert("Please select an ST&E");return}for(varain$("#scan_sources option")){$("#scan_sources option").eq(a).attr("selected",false)}varb=$("#cat_name_"+e).text();vard=b.match(/\s+\(([\d]+)\)\s+\(([^\d][ \w]+)\)|\s+\(([\d]+)\)/i);b=b.replace(/\s+\(([\d]+)\)\s+\(([^\d][ \w]+)\)|\s+\(([\d]+)\)/i,"");b=b.replace(/\s{2,}/g,"");$("#new_cat_name").val(b);$("#selected_cat").val(e);if(d&&typeofd[2]!=="undefined"){$("#analyst").val(d[2])}else{$("#analyst").val("")}varc=JSON.parse($("#cat_sources_"+e).val());for(varainc){$("#src_"+c[a]).attr("selected",true)}$("#edit_cat").animate({opacity:"1.00"},300,"linear");$("#edit_cat").css("display","block");view_box()}functionmerge_target(){$("#merge_target").animate({opacity:"1.00"},300,"linear");$("#merge_target").css("display","block");view_box()}functiondelete_cat(a){if($("#ste").val()<1){alert("Please select an ST&E");return}if(!confirm("Are you sure you want to delete this category? Currently assigned targets will be set to the 'Unassigned' category.")){return}$.ajax("/ajax.php",{data:{action:"delete-cat",ste_id:$("#ste").val(),cat_id:a},success:function(b){if(b.error){alert(b.error)}else{location.reload()}},error:function(d,b,c){console.error(c)},dataType:"json",method:"post",timeout:3000})}functiondel_target(){if(!confirm("Are you sure you want to delete the target? This will also delete all findings and interfaces for the selected targets and is irreversible")){return}}functionadd_cat(){if($("#ste").val()<1){alert("Please select an ST&E");return}$("#add_ste").val($("#ste").val());$("#add_cat").animate({opacity:"1.00"},300,"linear");$("#add_cat").css("display","block");view_box()}functionget_category(a){$.ajax("/ajax.php",{data:{action:"get_category_details",cat_id:a},success:function(c){$("#new_cat_name").val(c.name);for(varbinc.sources){$("#src_"+c.sources[b].id).attr("selected",true)}},datatype:"json",method:"post"})}functionclose_box(){$(".backdrop, .box").animate({opacity:"0"},300,"linear",function(){$(".backdrop, .box").css("display","none")})}functionview_box(){$(".backdrop").animate({opacity:".5"},300,"linear");$(".backdrop").css("display","block")}functionupdate_Status(a){if($(a).val()<1){returnfalse}if($(":checkbox:checked").length<1){alert("Please select a device to update");returnfalse}returntrue}functioncollapse_expand(){vara=$(this).data("id");if(!$(".cat_"+a).length){get_hosts(a)}$(this).toggleClass("fa-minus-square fa-plus-square");$(".cat_"+a).toggle(300)}functionselect(a){$(".cat_"+a+" input[type=checkbox]").each(function(){this.checked=!this.checked;update_tgt_chk(this)})}functionassign(b){vara=prompt('Who do you want to assign this category to?\n\nEnter "none" to clear out assignment');if(a){$("#analyst_"+b).val(a);$("#assign_"+b).submit()}}functionupload_host_list(){if($("#ste").val()<1){alert("Please select an ST&E");return}$("#import_host_list").animate({opacity:"1.00"},300,"linear");$("#import_host_list").css("display","block");view_box()}functionget_hosts(a){$.ajax("/ajax.php",{data:{action:"get_hosts",cat_id:a