DB 说明
默认配置为 Sqlite ,生产环境建议使用 Mysql
- db_type :
sqlite
ormysql
- db_max_open : 连接池 默认
50
- db_max_idle : 空闲数 默认
50
- db_str 连接
DB
字符串- Sqlite :
./db/hfish.db?cache=shared&mode=rwc
默认即可无需修改 - Mysql :
账号:密码@tcp(地址:端口)/数据库名?charset=utf8&parseTime=true&loc=Local
- Sqlite :
Mysql Sql 创建
自行进入 Mysql 导入 SQL 语句 创建表结构
可以复制此处 SQL, 也可以选择
db/sql
下的 SQL 执行(生产环境建议删除 db/sql 目录)
-- ----------------------------
-- Table structure for `hfish_info`
-- ----------------------------
DROP TABLE IF EXISTS `hfish_info`;
CREATE TABLE `hfish_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(20) NOT NULL DEFAULT '',
`project_name` varchar(20) NOT NULL DEFAULT '',
`agent` varchar(20) NOT NULL DEFAULT '',
`ip` varchar(20) NOT NULL DEFAULT '',
`country` varchar(10) NOT NULL DEFAULT '',
`region` varchar(10) NOT NULL DEFAULT '',
`city` varchar(10) NOT NULL,
`info` text NOT NULL,
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
SET FOREIGN_KEY_CHECKS = 1;
-- ----------------------------
-- Table structure for `hfish_colony`
-- ----------------------------
DROP TABLE IF EXISTS `hfish_colony`;
CREATE TABLE `hfish_colony` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`agent_name` varchar(20) NOT NULL DEFAULT '',
`agent_ip` varchar(20) NOT NULL DEFAULT '',
`web_status` int(2) NOT NULL DEFAULT '0',
`deep_status` int(2) NOT NULL DEFAULT '0',
`ssh_status` int(2) NOT NULL DEFAULT '0',
`redis_status` int(2) NOT NULL DEFAULT '0',
`mysql_status` int(2) NOT NULL DEFAULT '0',
`http_status` int(2) NOT NULL DEFAULT '0',
`telnet_status` int(2) NOT NULL DEFAULT '0',
`ftp_status` int(2) NOT NULL DEFAULT '0',
`mem_cache_status` int(2) NOT NULL DEFAULT '0',
`plug_status` int(2) NOT NULL DEFAULT '0',
`last_update_time` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `un_agent` (`agent_name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
SET FOREIGN_KEY_CHECKS = 1;
-- ----------------------------
-- Table structure for `hfish_setting`
-- ----------------------------
DROP TABLE IF EXISTS `hfish_setting`;
CREATE TABLE `hfish_setting` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(50) NOT NULL DEFAULT '',
`info` varchar(50) NOT NULL DEFAULT '',
`update_time` datetime NOT NULL,
`status` int(2) NOT NULL DEFAULT '0',
`setting_name` varchar(50) NOT NULL DEFAULT '',
`setting_dis` varchar(50) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `index_key` (`type`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `hfish_setting`
-- ----------------------------
BEGIN;
INSERT INTO `hfish_setting` VALUES ('1', 'mail', '', '2019-09-02 20:15:00', '0', 'E-mail 群发', '群发邮件SMTP服务器配置'), ('2', 'alertMail', '', '2019-09-02 18:58:12', '0', 'E-mail 通知', '蜜罐告警会通过邮件告知信息'), ('3', 'webHook', '', '2019-09-03 11:49:00', '0', 'WebHook 通知', '蜜罐告警会请求指定API告知信息'), ('4', 'whiteIp', '', '2019-09-02 20:15:00', '0', 'IP 白名单', '蜜罐上钩会过滤掉白名单IP');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;