我每五分钟收集一次nmap数据并将其存储在数据库中。有关每次扫描的信息(例如开始和结束时间)存储在scans表中:
CREATE TABLE `scans` (
`scan_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`start_time` datetime NOT NULL,
`end_time` datetime NOT NULL,
`nmap_version` varchar(20) DEFAULT NULL,
`nmap_args` varchar(255) DEFAULT NULL,
PRIMARY KEY (`scan_id`)
) ENGINE=InnoDB AUTO_INCREMENT=34901 DEFAULT CHARSET=utf8
Run Code Online (Sandbox Code Playgroud)
有关扫描的主机的信息(例如主机名、MAC 地址)存储在表中hosts:
CREATE TABLE `hosts` (
`scan_id` int(10) unsigned NOT NULL,
`host_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`hostname` varchar(255) NOT NULL,
`ip_address` int(10) unsigned NOT NULL,
`mac_address` bigint(20) unsigned DEFAULT NULL,
`mac_vendor` varchar(255) DEFAULT NULL,
`status` varchar(20) NOT NULL, …Run Code Online (Sandbox Code Playgroud)