Merge remote-tracking branch 'origin/develop' into ent-8075-Informe-de-acciones-de-alerta

This commit is contained in:
Daniel Barbero Martin 2021-11-30 14:45:07 +01:00
commit 6d9b3d209c
7 changed files with 253 additions and 4 deletions

View File

@ -13,6 +13,18 @@ CREATE TABLE IF NOT EXISTS `talert_calendar` (
INSERT IGNORE INTO `talert_calendar` VALUES (1, 'Default', 0, 'Default calendar');
CREATE TABLE IF NOT EXISTS `tipam_network_location` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `tipam_network_location` (`name`) SELECT `location` FROM `tipam_network` WHERE `location` <> '';
UPDATE `tipam_network` INNER JOIN `tipam_network_location` ON tipam_network_location.name=tipam_network.location SET tipam_network.location=tipam_network_location.id;
ALTER TABLE `tipam_network` MODIFY `location` int(10) unsigned NULL;
ALTER TABLE `tipam_network` ADD FOREIGN KEY (`location`) REFERENCES `tipam_network_location`(`id`) ON DELETE CASCADE;
ALTER TABLE `talert_special_days` ADD COLUMN `id_calendar` int(10) unsigned NOT NULL DEFAULT 1;
ALTER TABLE `talert_special_days` ADD COLUMN `day_code` tinyint(2) unsigned NOT NULL DEFAULT 0;

View File

@ -4045,6 +4045,18 @@ CREATE TABLE IF NOT EXISTS `tipam_supernet_network` (
FOREIGN KEY (`id_network`) REFERENCES tipam_network(`id`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tipam_network_location` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT IGNORE INTO `tipam_network_location` (`name`) SELECT `location` FROM `tipam_network` WHERE `location` <> '';
UPDATE `tipam_network` INNER JOIN `tipam_network_location` ON tipam_network_location.name=tipam_network.location SET tipam_network.location=tipam_network_location.id;
ALTER TABLE `tipam_network` MODIFY `location` int(10) unsigned NULL;
ALTER TABLE `tipam_network` ADD FOREIGN KEY (`location`) REFERENCES `tipam_network_location`(`id`) ON DELETE CASCADE;
SET @insert_type = 3;
SET @insert_name = 'IPAM Recon';
SET @insert_description = 'This script is used to automatically detect network hosts availability and name, used as Recon Custom Script in the recon task. Parameters used are:\n\n* custom_field1 = network. i.e.: 192.168.100.0/24\n* custom_field2 = associated IPAM network id. i.e.: 4. Please do not change this value, it is assigned automatically in IPAM management.\n\nSee documentation for more information.';

View File

@ -3409,6 +3409,15 @@ class NetworkMap
$output .= '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url(
'include/styles/tooltipster.bundle.min.css'
).'" />'."\n";
ui_require_css_file('jquery.contextMenu', 'include/styles/js/');
$output .= '<script type="text/javascript" src="';
$output .= ui_get_full_url(
'include/javascript/jquery.contextMenu.js',
false,
false,
false
);
$output .= '" charset="utf-8"></script>';
$output .= '<div id="simple_map" data-id="'.$this->idMap.'" ';
$output .= 'class="border_1px_dd" style="';

View File

@ -381,6 +381,52 @@ SimpleMapController.prototype.paint_nodes = function() {
});
}
});
if (
typeof node["type_net"] !== "undefined" &&
node["type_net"] === "supernet"
) {
var items_list = {};
items_list["details"] = {
name: "Show/hide subnets",
icon: "show",
disabled: false,
callback: function(key, options) {
self.nodes.forEach(function(subnode) {
if (
subnode.id != node["id"] &&
subnode.id_parent != null &&
subnode.id_parent == node["id"]
) {
if ($("#node_" + subnode.id).css("display") == "none") {
$("#node_" + subnode.id).show();
} else {
$("#node_" + subnode.id).hide();
}
}
});
self.arrows.forEach(function(arrow) {
if (arrow.source == node["id"] || arrow.target == node["id"]) {
if (
$("#arrow_" + arrow.source + "_" + arrow.target).css(
"display"
) == "none"
) {
$("#arrow_" + arrow.source + "_" + arrow.target).show();
} else {
$("#arrow_" + arrow.source + "_" + arrow.target).hide();
}
}
});
}
};
$.contextMenu({
selector: "#node_" + node["id"],
items: items_list
});
}
}
});
};
@ -416,6 +462,9 @@ SimpleMapController.prototype.paint_arrows = function() {
})
.attr("y2", function(d) {
return self.center_y + self.getSecondPoint(d["dest"], "y");
})
.attr("id", function(d) {
return "arrow_" + d["source"] + "_" + d["target"];
});
}
};

View File

@ -104,7 +104,7 @@
.context-menu-item.icon {
min-height: 18px;
background-repeat: no-repeat;
background-position: 4px 2px;
background-position: 4px center;
}
.context-menu-item.icon-edit {
background-image: url(../../../images/page_white_edit.png);
@ -163,6 +163,9 @@
.context-menu-item.icon-interface_link_cancel {
background-image: url(../../../images/link_abortar.png);
}
.context-menu-item.icon-show {
background-image: url(../../../images/eye_show.png);
}
/* vertically align inside labels */
.context-menu-input > label > * {

View File

@ -3941,6 +3941,16 @@ CREATE TABLE `tnode_relations` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tipam_network_location`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tipam_network_location` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tipam_network`
-- ----------------------------------------------------------------------
@ -3949,7 +3959,7 @@ CREATE TABLE IF NOT EXISTS `tipam_network` (
`network` varchar(100) NOT NULL default '',
`name_network` varchar(255) default '',
`description` text NOT NULL,
`location` tinytext NOT NULL,
`location` int(10) unsigned NULL,
`id_recon_task` int(10) unsigned NOT NULL,
`scan_interval` tinyint(2) default 1,
`monitoring` tinyint(2) default 0,
@ -3957,7 +3967,8 @@ CREATE TABLE IF NOT EXISTS `tipam_network` (
`lightweight_mode` tinyint(2) default 0,
`users_operator` text,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE
FOREIGN KEY (`id_recon_task`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE,
FOREIGN KEY (`location`) REFERENCES `tipam_network_location`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------

View File

@ -376,6 +376,159 @@ my %ENT2CHR = (
'ouml' => chr(246),
'uacute' => chr(250),
'uuml' => chr(252),
# multibyte characters
'OElig' => chr(338),
'oelig' => chr(339),
'Scaron' => chr(352),
'scaron' => chr(353),
'Yuml' => chr(376),
'fnof' => chr(402),
'circ' => chr(710),
'tilde' => chr(732),
'Alpha' => chr(913),
'Beta' => chr(914),
'Gamma' => chr(915),
'Delta' => chr(916),
'Epsilon' => chr(917),
'Zeta' => chr(918),
'Eta' => chr(919),
'Theta' => chr(920),
'Iota' => chr(921),
'Kappa' => chr(922),
'Lambda' => chr(923),
'Mu' => chr(924),
'Nu' => chr(925),
'Xi' => chr(926),
'Omicron' => chr(927),
'Pi' => chr(928),
'Rho' => chr(929),
'Sigma' => chr(931),
'Tau' => chr(932),
'Upsilon' => chr(933),
'Phi' => chr(934),
'Chi' => chr(935),
'Psi' => chr(936),
'Omega' => chr(937),
'alpha' => chr(945),
'beta' => chr(946),
'gamma' => chr(947),
'delta' => chr(948),
'epsilon' => chr(949),
'zeta' => chr(950),
'eta' => chr(951),
'theta' => chr(952),
'iota' => chr(953),
'kappa' => chr(954),
'lambda' => chr(955),
'mu' => chr(956),
'nu' => chr(957),
'xi' => chr(958),
'omicron' => chr(959),
'pi' => chr(960),
'rho' => chr(961),
'sigmaf' => chr(962),
'sigma' => chr(963),
'tau' => chr(964),
'upsilon' => chr(965),
'phi' => chr(966),
'chi' => chr(967),
'psi' => chr(968),
'omega' => chr(969),
'thetasym' => chr(977),
'upsih' => chr(978),
'piv' => chr(982),
'ensp' => chr(8194),
'emsp' => chr(8195),
'thinsp' => chr(8201),
'zwnj' => chr(8204),
'zwj' => chr(8205),
'lrm' => chr(8206),
'rlm' => chr(8207),
'ndash' => chr(8211),
'mdash' => chr(8212),
'lsquo' => chr(8216),
'rsquo' => chr(8217),
'sbquo' => chr(8218),
'ldquo' => chr(8220),
'rdquo' => chr(8221),
'bdquo' => chr(8222),
'dagger' => chr(8224),
'Dagger' => chr(8225),
'bull' => chr(8226),
'hellip' => chr(8230),
'permil' => chr(8240),
'prime' => chr(8242),
'Prime' => chr(8243),
'lsaquo' => chr(8249),
'rsaquo' => chr(8250),
'oline' => chr(8254),
'frasl' => chr(8260),
'euro' => chr(8364),
'image' => chr(8465),
'weierp' => chr(8472),
'real' => chr(8476),
'trade' => chr(8482),
'alefsym' => chr(8501),
'larr' => chr(8592),
'uarr' => chr(8593),
'rarr' => chr(8594),
'darr' => chr(8595),
'harr' => chr(8596),
'crarr' => chr(8629),
'lArr' => chr(8656),
'uArr' => chr(8657),
'rArr' => chr(8658),
'dArr' => chr(8659),
'hArr' => chr(8660),
'forall' => chr(8704),
'part' => chr(8706),
'exist' => chr(8707),
'empty' => chr(8709),
'nabla' => chr(8711),
'isin' => chr(8712),
'notin' => chr(8713),
'ni' => chr(8715),
'prod' => chr(8719),
'sum' => chr(8721),
'minus' => chr(8722),
'lowast' => chr(8727),
'radic' => chr(8730),
'prop' => chr(8733),
'infin' => chr(8734),
'ang' => chr(8736),
'and' => chr(8743),
'or' => chr(8744),
'cap' => chr(8745),
'cup' => chr(8746),
'int' => chr(8747),
'there4' => chr(8756),
'sim' => chr(8764),
'cong' => chr(8773),
'asymp' => chr(8776),
'ne' => chr(8800),
'equiv' => chr(8801),
'le' => chr(8804),
'ge' => chr(8805),
'sub' => chr(8834),
'sup' => chr(8835),
'nsub' => chr(8836),
'sube' => chr(8838),
'supe' => chr(8839),
'oplus' => chr(8853),
'otimes' => chr(8855),
'perp' => chr(8869),
'sdot' => chr(8901),
'lceil' => chr(8968),
'rceil' => chr(8969),
'lfloor' => chr(8970),
'rfloor' => chr(8971),
'lang' => chr(9001),
'rang' => chr(9002),
'loz' => chr(9674),
'spades' => chr(9824),
'clubs' => chr(9827),
'hearts' => chr(9829),
'diams' => chr(9830),
);
# Construct the character to entity mapping.
@ -475,7 +628,7 @@ sub safe_input($) {
return "" unless defined($value);
$value =~ s/([\x00-\xFF])/$CHR2ENT{$1}||$1/ge;
$value =~ s/(.)/$CHR2ENT{$1}||$1/ge;
return $value;
}