This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var UnclassedUtil = Class.create(); | |
| UnclassedUtil.prototype = { | |
| initialize: function() {}, | |
| getRepository: function(ci) { | |
| /* | |
| IN | |
| ci = the Sys_ID of the Configuration Item | |
| OUT | |
| repository = Repository Name String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Name: FQDN HOST Suffix | |
| Source field: FQDN | |
| */ | |
| (function process(rule, sourceValue, sourcePayload) { | |
| var sourceField = {}; | |
| var ignore = global.SecProperty.getProperty("sn_sec_cmn.ignoreCIClass", ""); | |
| sourceField[rule.source_field] = sourceValue; | |
| /* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmdb_ci_dns_name,cmdb_ci_file_system,cmdb_ci_hyper_v_instance,cmdb_ci_hyper_v_server,cmdb_ci | |
| _lb_pool_member,cmdb_ci_lb_service,cmdb_ci_outofband_device,cmdb_ci_print_queue,cmdb_ci_serv | |
| ice_discovered,cmdb_ci_spkg,cmdb_ci_storage_pool,cmdb_ci_vm_instance,cmdb_ci_vm_template,cmd | |
| b_ci_vmware_instance,cmdb_ci_win_cluster,cmdb_ci_windows_cluster,dscy_net_base,dscy_router_int | |
| erface,dscy_swtch_fwd_rule,cmdb_ci_vmware_nic,cmdb_ci_endpoint_tcp,cmdb_ci_lpar_instance,cmd | |
| b_ci_business_app,cmdb_ci_certificate,cmdb_ci_cluster_vm_affinity_rule,cmdb_ci_vcenter_folder,cmd | |
| b_ci_ibm_zos_server,cmdb_ci_vmware_template,cmdb_ci_win_cluster_node,cmdb_ci_db_mssql_data | |
| base | |
| // As a single string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Business Rule | |
| Before Insert 10000 | |
| Source is Tenable.io | |
| */ | |
| (function executeRule(current, previous /*null when async*/ ) { | |
| var sources = null; | |
| var source_scanner = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Ensure that the integration do NOT pull data at the same time | |
| Easy deploy | |
| Vulnerability Integration Spread out Fix-Script | |
| Vulnerability Integration: sn_vul_integration | |
| Time [run_time]: 04:00:00 | |
| Starting [run_start]: 2020-04-03 00:00:00 | |
| */ | |
| var IO_FIXED = {'name':'Tenable.io Fixed Vulnerabilities Integration', 'sys_id':'c7ba646ec77c1010cfb6664703c2605d'}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Set the Current Data/Time in to a Date/Time field | |
| var gr = new GlideRecord('incident'); | |
| gr.get('5f9b5eef1bf774d86c18a8e0604bcbec');//INC008236538 | |
| gr.setDisplayValue('u_detected', gs.nowDateTime());//Global Scope Only | |
| gr.update(); | |
| //new GlideDateTime().getDisplayValue() //for scoped apps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This forces the Reconcile job to NOT consider Unclassed Hardware - force a better match - | |
| A better match should be in the Hardware table and below | |
| Then to prevent duplicates CONSIDER Unclass Hardware | |
| This seems to be necessary if the CI does not exist at first, then it exists but the IRE did not reconcile it | |
| */ | |
| //Add this to Your first rule. This prevents the Reconcile job from matching on Unclassified Hardware | |
| var cmdbci = new GlideRecord("cmdb_ci"); | |
| cmdbci.addQuery("name", sourceValue); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Subset | |
| //CM 9/29/2021 IRE Enhancement. get the Detrived value | |
| if(sourcePayload.derived && sourcePayload.derived[rule.source_field]){ | |
| sourceField[rule.source_field] = sourcePayload.derived[rule.source_field]; | |
| sourceValue = sourcePayload.derived[rule.source_field]; | |
| }else{//Triditional lookup if no "derived" source | |
| //Get host name from fqdn | |
| var host_name = sourceValue.split('.'); | |
| sourceValue = host_name[0]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var todayDateTime = new GlideDateTime(gs.nowDateTime()); | |
| var integerValForToday = todayDateTime.getDayOfWeekLocalTime(); | |
| var jsonObj = '{"1":"Monday","2":"Tuesday","3":"Wednesday","4":"Thursday","5":"Friday","6":"Saturday","7":"Sunday"}'; | |
| var parser = new JSONParser(); | |
| var parsedData = parser.parse(jsonObj); | |
| var dayOfWeek = parsedData[integerValForToday]; | |
| gs.info(dayOfWeek); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Single Record | |
| var rec = new GlideRecord('sn_sec_cmn_watchdog'); //*** Pick Correct Table **** | |
| rec.get('429b07aa0b231200263a089b37673a97'); //*** Find the correct item from the above table to extract *** | |
| //Push the record into the current update set | |
| var um = new GlideUpdateManager2(); | |
| um.saveRecord(rec); | |
| //Query for the record | |
| var rec = new GlideRecord('sn_sec_cmn_watchdog'); //*** Pick Correct Table **** |