Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const decoupled = tlds.split_hostname(rdns, 3);
const vardom = decoupled[0]; // "variable" portion of domain
const dom = decoupled[1]; // "static" portion of domain
// we check for special cases where rdns looks custom/static, but really is dynamic
const special_case_info = plugin.check_rdns_for_special_cases(rdns, vardom);
if (special_case_info) {
return chsit(null, special_case_info.why);
}
let stripped_dom = dom;
if (vardom) {
// check for decimal IP in rDNS
if (vardom.match(String(net_utils.ip_to_long(ip))))
return chsit(null, 'decimal IP');
// craft the +hostid+
const label = vardom.split('.').slice(1).join('.');
if (label)
stripped_dom = `${label}.${stripped_dom}`;
}
return chsit(stripped_dom);
}