Merge pull request #85 from hacklcx/dev

Dev
This commit is contained in:
SanJin 2020-05-09 20:59:36 +08:00 committed by GitHub
commit dce5bc95f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 3912 additions and 646 deletions

247
README.md
View File

@ -1,238 +1,129 @@
![hfish.png](./images/hfish.png)
<p align="center">
<a href="https://hfish.io/" target="_blank">
<img width="200" src="images/logo.png">
</a>
</p>
# 介绍
<h1 align="center">HFish </h1>
<p align="center">A Most Convenient Honeypot Platform</p>
> 本项目使用 **GPL** 协议,未经授权,禁止使用商业用途。
>
> *本 Team 研发此平台,仅为企业安全测试使用,禁止其他人员使用非法用途!一切行为与本 Team 无关。*
<p align="center">
<a href="https://hfish.io/docs/#/" target="_bank">Document</a>
<span>|</span>
<a href="https://github.com/hacklcx/HFish" target="_bank">Github</a>
<span>|</span>
<a href="https://gitee.com/lauix/HFish" target="_bank">Gitee</a>
<span>|</span>
<a href="https://github.com/hacklcx/HFish/releases" target="_bank">Download</a>
<span>|</span>
<a href="README_CN.md" target="_bank">中文</a>
</p>
**HFish** 是一款基于 Golang 开发的跨平台多功能主动诱导型蜜罐框架系统,为了企业安全防护测试做出了精心的打造
- 多功能 不仅仅支持 HTTP(S) 蜜罐,还支持 SSH、SFTP、Redis、Mysql、FTP、Telnet、暗网 等
- 扩展性 提供 API 接口,使用者可以随意扩展蜜罐模块 ( WEB、PC、APP )
- 便捷性 使用 Golang 开发,使用者可以在 Win + Mac + Linux 上快速部署一套蜜罐平台
## Introduce
# 地址
**HFish** It is a cross platform honeypot platform developed based on golang, which has been meticulously built for enterprise security
## HFish 官方
- **Multi-function** Not just support `HTTP(S)` PotIt also supports `SSH`、`SFTP`、`Redis`、`Mysql`、`FTP`、`Telnet`、`Deep` etc.
- **Expansibility** Provide `API` InterfaceUsers can expand honeypot module at will ( `WEB`、`PC`、`APP` )
- **Convenience** Use **Golang** Development , Users can
`Win` + `Mac` + `Linux` Quickly deploy a honeypot platform on
- 官网: https://hfish.io
- 使用文档: https://hfish.io/docs
## Support honeypot
## Github
- **`SSH`** Pot
- **`Redis`** Pot
- **`Mysql`** Pot
- **`MemCache`** Pot
- **`Telnet`** Pot
- **`FTP`** Pot
- **`WEB`** Pot
- **`Deep`** Pot
- **`HTTP`** Pot
- **`TFTP`** Pot
- **`VNC`** Pot
- **`ES`** Pot
- **`Custom`** Pot
- Git: https://github.com/hacklcx/HFish
- Download: https://github.com/hacklcx/HFish/releases
## Rapid deployment
## 码云(Gitee)
- Git: https://gitee.com/lauix/HFish
- Download: https://gitee.com/lauix/HFish/releases
- Download current system binary compression package
- **`cd`** To program root , Update **`config.ini`** file
- Implement **`./HFish run`** Start service
- Browser input **http://localhost:9001** open
# 快速部署
## Partial interface display
## 部署说明
### Help
- 下载当前系统二进制包
- cd 到程序根目录,修改 config.ini 配置文件
- 执行 ./HFish run 启动服务
- 浏览器输入 http://localhost:9001 打开
![](./images/help.png)
## 命令行帮助
![help.png](./images/help.png)
### Start service
## 启动服务
![run.png](./images/run.png)
![](./images/run.png)
# 部分界面展示
## HFish 态势感知
### Landing page
![data.jpg](./images/data.jpg)
## 登录页
![](./images/login.png)
![login.png](./images/login.png)
## 仪表盘
### Dashboard
![dashboard.png](./images/dashboard.png)
## 上钩页
![](./images/dashboard.png)
![fish.png](./images/fish.png)
## 分布式集群
### Situational awareness
![colony.png](./images/colony.png)
## 邮件群发
![](./images/data.jpg)
![mail.png](./images/mail.png)
## 设置页
### Upper hook page
![mail.png](./images/setting.png)
# 部分功能使用演示
![](./images/fish.png)
## WEB 蜜罐
![web.png](./images/web.png)
### Distributed cluster
## SSH 蜜罐
![ssh.png](./images/ssh.png)
![](./images/colony.png)
## Redis 蜜罐
![redis.png](./images/redis.png)
### Mass mailing
## Mysql 蜜罐
![mysql.png](./images/mysql.png)
![](./images/mail.png)
## FTP 蜜罐
![ftp.png](./images/ftp.png)
### settings page
## Telnet 蜜罐
![telnet.png](./images/telnet.png)
![](./images/setting.png)
## MemCache 蜜罐
![memcache.png](./images/memcache.png)
## About
## HTTP 蜜罐
![http.png](./images/http.png)
> I'm the only one right now
## TFTP 蜜罐
![tftp.png](./images/tftp.png)
**Team** HackLC
## ES 蜜罐
![es.png](./images/es.png)
**Website** https://hack.lc
## VNC 蜜罐
![vnc.png](./images/vnc.png)
**Focus on the safety industry, focus on building good products**
# 注意事项
## Contact me
- 邮箱 SMTP 配置后需要开启方可使用
- API 接口 info 字段,&& 为换行符
- 启动 WEB 蜜罐,请先启动 API 模块
- WEB 插件 需在 WEB 目录下 编写
- WEB 插件 下面必须存在两个目录
- 集群 心跳为60秒,断开显示会延迟60秒
# API 接口
## WEB 蜜罐
```
URL: http://WEB蜜罐地址/api/v1/post/report
POST
name : WEB管理后台蜜罐 # 项目名
info : admin&&12345 # 上报信息,&& 为换行符号
sec_key : 9cbf8a4dcb8e30682b927f352d6559a0 # API 安全密钥
特殊说明:
URL api/v1/post/report 可在 config.ini 配置里修改
sec_key 可在 config.ini 配置里修改,修改后 WEB 模板也需要同时修改
```
## 暗网 蜜罐
```
URL: http://暗网蜜罐地址/api/v1/post/deep_report
POST
name : 暗网后台蜜罐 # 项目名
info : admin&&12345 # 上报信息,&& 为换行符号
sec_key : 9cbf8a4dcb8e30682b927f352d6559a0 # API 安全密钥
特殊说明:
URL api/v1/post/deep_report 可在 config.ini 配置里修改
sec_key 可在 config.ini 配置里修改,修改后 暗网 模板也需要同时修改
```
## 黑名单IP
```
URL(Get): http://localhost:9001/api/v1/get/ip?key=585e2ba265d965b1929148d0f0e33133
特殊说明:
提供此接口为了配合防火墙使用,具体方案欢迎来讨论!
```
## 获取全部钓鱼信息
```
URL(Get): http://localhost:9001/api/v1/get/fish_info?key=585e2ba265d965b1929148d0f0e33133
返回数据格式:
{
code: 200,
data: [
{
agent: "本机",
city: "",
country: "本机地址",
create_time: "2019-08-26 21:29:00",
id: 224,
info: "127.0.0.1:51548 已经连接&&stats&&&&set foo 0 6",
ip: "127.0.0.1",
project_name: "MemCache蜜罐",
region: "本机地址",
type: "MEMCACHE"
},
],
msg: "success"
}
字段说明:
agent : 集群名称
country : 国家
region : 省份/地区
city : 城市
ip : IP 地址
project_name : 项目名称
type : 蜜罐类型
info : 上钩信息
id : 数据库唯一标识
create_time : 上钩时间
```
## 获取全部账号密码信息
```
URL(Get): http://localhost:9001/api/v1/get/passwd_list?key=585e2ba265d965b1929148d0f0e33133
```
# 关于
- Team: HackLC
- URL: https://hack.lc
# 反馈群
加微信拉人,请备注 **HackLC**
![wechat.png](./images/wechat.jpg)
**E-mail:** **`lauixData#gmail.com`**

149
README_CN.md Normal file
View File

@ -0,0 +1,149 @@
<p align="center">
<a href="https://hfish.io/" target="_blank">
<img width="200" src="images/logo.png">
</a>
</p>
<h1 align="center">HFish </h1>
<p align="center">一个最便捷的蜜罐平台</p>
<p align="center">
<a href="https://hfish.io/docs/#/" target="_bank">文档</a>
<span>|</span>
<a href="https://github.com/hacklcx/HFish" target="_bank">Github</a>
<span>|</span>
<a href="https://gitee.com/lauix/HFish" target="_bank">码云</a>
<span>|</span>
<a href="https://github.com/hacklcx/HFish/releases" target="_bank">下载</a>
<span>|</span>
<a href="README.md" target="_bank">English</a>
</p>
## 介绍
> 本项目使用 **GPL** 协议,未经授权,禁止使用商业用途。
>
> *本 Team 研发此平台,仅为企业安全测试使用,禁止其他人员使用非法用途!一切行为与本 Team 无关。*
**HFish** 是一款基于 Golang 开发的跨平台蜜罐平台,为了企业安全做出了精心的打造
- **多功能** 不仅仅支持 `HTTP(S)` 蜜罐,还支持 `SSH`、`SFTP`、`Redis`、`Mysql`、`FTP`、`Telnet`、`暗网` 等
- **扩展性** 提供 `API` 接口,使用者可以随意扩展蜜罐模块 ( `WEB`、`PC`、`APP` )
- **便捷性** 使用 **Golang** 开发,使用者可以在 `Win` + `Mac` + `Linux` 上快速部署一套蜜罐平台
## 支持蜜罐
- **`SSH`** 蜜罐
- **`Redis`** 蜜罐
- **`Mysql`** 蜜罐
- **`MemCache`** 蜜罐
- **`Telnet`** 蜜罐
- **`FTP`** 蜜罐
- **`WEB`** 蜜罐
- **`暗网`** 蜜罐
- **`HTTP`** 蜜罐
- **`TFTP`** 蜜罐
- **`VNC`** 蜜罐
- **`ES`** 蜜罐
- **`自定义`** 蜜罐
## 快速部署
- 下载当前系统二进制压缩包
- **`cd`** 到程序根目录,修改 **`config.ini`** 配置文件
- 执行 **`./HFish run`** 启动服务
- 浏览器输入 **http://localhost:9001** 打开
## 部分界面展示
### 命令行帮助
![](./images/help.png)
### 启动服务
![](./images/run.png)
### 登录页
![](./images/login.png)
### 仪表盘
![](./images/dashboard.png)
### 态势感知
![](./images/data.jpg)
### 上钩页
![](./images/fish.png)
### 分布式集群
![](./images/colony.png)
### 邮件群发
![](./images/mail.png)
### 设置页
![](./images/setting.png)
## 关于
> 目前只有我一个人
**Team** HackLC
**官网:** https://hack.lc
**专注安全行业,一心打造好产品**
## 联系我
**E-mail:** **`lauixData#gmail.com`**
## 反馈群
加微信拉人,请备注 **`蜜罐`**
![](./images/wx.jpg)

View File

@ -28,7 +28,7 @@
}
.data_ul_head {
background: #307fa8;
background: #175165;
}
.data_ul_head li {
@ -48,7 +48,7 @@
}
.title {
color: #67c8fd;
color: #bfc7cc;
text-align: center;
margin-top: -5px;
font-weight: bold;
@ -62,14 +62,27 @@
font-size: 16px;
cursor: pointer;
}
.timex{
color: #45b4f5;
float: right;
position: absolute;
margin-top: -21px;
font-size: 16px;
right: 0;
margin-right: 22px;
}
</style>
</head>
<body>
<body class="bg01">
<header class="header">
<h3>HFish 全球态势感知</h3>
</header>
<a href="/dashboard"><span class="glyphicon glyphicon-home homex" aria-hidden="true"></span></a>
<div class="timex">
<span>当前时间: </span><span id="timex">2020-04-28 21:31:01</span>
</div>
<div class="wrapper">
<div class="container-fluid">
<div class="row fill-h">
@ -95,12 +108,9 @@
</div>
<div class="col-lg-6 fill-h">
<div class="xpanel-wrapper xpanel-wrapper-2">
<div style="height: 100%;">
<div class="fill-h" style="text-align: center;background: #0e1729;border-radius: 5px;">
<video style="mix-blend-mode: lighten;height: 100%;" autoplay loop muted>
<source src="/static/data/dq.mp4" type="video/mp4">
</video>
</div>
<div class="xpanel">
<!-- 地图散点 -->
<div class="fill-h" id="worldMap"></div>
</div>
</div>
<div class="xpanel-wrapper xpanel-wrapper-2">
@ -110,10 +120,11 @@
<table class="data_list_head table" id="info_list">
<tbody class="data_ul_head">
<tr>
<th style="border: 0px;width: 25%;">类型</th>
<th style="border: 0px;width: 10%;">类型</th>
<th style="border: 0px;width: 25%;">节点</th>
<th style="border: 0px;width: 25%;">来源IP</th>
<th style="border: 0px;width: 25%;">地理信息</th>
<th style="border: 0px;width: 29%;">地理信息</th>
<th style="border: 0px;width: 11%;">攻击时间</th>
</tr>
</tbody>
</table>
@ -144,405 +155,17 @@
</div>
</div>
</div>
<input id="dataAttack" type="hidden" value="{{.dataAttack}}">
<script type="text/javascript" src="/static/data/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/static/data/js/echarts-3.8.5.min.js"></script>
<script type="text/javascript" src="/static/data/js/echarts-wordcloud.min.js"></script>
<script type="text/javascript" src="/static/data/js/echarts-map-world.js"></script>
<script type="text/javascript" src="/static/data/js/dark.js"></script>
<script type="text/javascript" src="/static/js/xss.min.js"></script>
<script type="text/javascript">
window.onresize = function () {
main1.resize();
main2.resize();
main3.resize();
main4.resize();
main5.resize();
main6.resize();
};
var main1 = echarts.init(document.getElementById('main1'));
var main2 = echarts.init(document.getElementById('main2'));
var main3 = echarts.init(document.getElementById('main3'));
var main4 = echarts.init(document.getElementById('main4'));
var main5 = echarts.init(document.getElementById('main5'));
var main6 = echarts.init(document.getElementById('main6'));
function main1_data() {
$.ajax({
type: "GET",
url: "/data/get/china",
dataType: "json",
success: function (e) {
var d = e.data;
var listx = [];
for (var i = 0; i < d.regionList.length; i++) {
listx.push(d.regionList[i].name);
}
var option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
bottom: 10,
left: 'center',
data: listx,
textStyle: {
color: "#fff"
}
},
series: [{
name: '来源地区',
type: 'pie',
radius: '60%',
center: ['50%', '40%'],
label: {
normal: {
show: false,
position: 'center'
}
},
data: d.regionList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main1.setOption(option);
}
});
}
function main2_data() {
$.ajax({
type: "GET",
url: "/data/get/country",
dataType: "json",
success: function (e) {
var d = e.data;
var listx = [];
for (var i = 0; i < d.regionList.length; i++) {
listx.push(d.regionList[i].name);
}
var option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
bottom: 10,
left: 'center',
data: listx,
textStyle: {
color: "#fff"
}
},
series: [{
name: '来源国家',
type: 'pie',
radius: '60%',
center: ['50%', '40%'],
label: {
normal: {
show: false,
position: 'center'
}
},
data: d.regionList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main2.setOption(option);
}
});
}
function main3_data() {
$.ajax({
type: "GET",
url: "/data/get/ip",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
series: [{
name: 'IP分布',
type: 'pie',
radius: '30%',
center: ['50%', '50%'],
data: d.ipList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main3.setOption(option);
}
});
}
function main4_data() {
$.ajax({
type: "GET",
url: "/data/get/type",
dataType: "json",
success: function (e) {
var d = e.data;
var dataN = [];
var dataV = [];
for (var i = d.typeList.length - 1; i >= 0; i--) {
dataN.push(d.typeList[i].name);
dataV.push(d.typeList[i].value);
}
var option = {
tooltip: {},
xAxis: {
type: 'value',
show: false
},
yAxis: {
type: 'category',
data: dataN,
axisLine: {
lineStyle: {
color: '#67c8fd'
}
}
},
grid: {
left: '0%',
right: '0%',
bottom: '0%',
top: '3%',
containLabel: true
},
series: [{
data: dataV,
type: 'bar',
label: {
normal: {
show: true,
position: 'inside',
color: '#fff'
}
},
itemStyle: {
normal: {
color: '#307fa8'
}
}
}]
};
main4.setOption(option);
}
});
}
function main5_data() {
$.ajax({
type: "GET",
url: "/data/get/account",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
show: true
},
series: [{
name: '账号',
type: "wordCloud",
gridSize: 6,
shape: 'circle',
sizeRange: [12, 50],
width: '100%',
height: '80%',
textStyle: {
normal: {
color: function () {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
}
},
data: d
}]
};
main5.setOption(option);
}
});
}
function main6_data() {
$.ajax({
type: "GET",
url: "/data/get/password",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
show: true
},
series: [{
name: '密码',
type: "wordCloud",
gridSize: 6,
shape: 'circle',
sizeRange: [12, 50],
width: '100%',
height: '80%',
textStyle: {
normal: {
color: function () {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
}
},
data: d
}]
};
main6.setOption(option);
}
});
}
function mainInfo() {
$.ajax({
type: "GET",
url: "/data/get/info",
dataType: "json",
success: function (e) {
var d = e.data;
var _h = '';
var result = d.result;
for (var i = 0; i < result.length; i++) {
_h += ' <tr class="data_list">';
_h += ' <td>' + filterXSS(result[i].type) + '</td>';
_h += ' <td>' + filterXSS(result[i].agent) + '</td>';
_h += ' <td>' + filterXSS(result[i].ip) + '</td>';
_h += ' <td>' + filterXSS(result[i].country) + ' ' + filterXSS(result[i].region) + '</td>';
_h += ' </tr>';
}
$("#info_list").append(_h);
}
});
}
function mainWs() {
var wsuri = "ws://" + window.location.host + "/data/ws";
var sock = new WebSocket(wsuri);
sock.onopen = function () {
console.log("connected to " + wsuri);
};
sock.onclose = function (e) {
console.log("connection closed (" + e.code + ")");
};
sock.onmessage = function (e) {
var data = JSON.parse(e.data);
if (data.data.type === "center_data") {
var d = data.data.data;
var _h = '';
_h += ' <tr class="data_list">';
_h += ' <td>' + filterXSS(d.type) + '</td>';
_h += ' <td>' + filterXSS(d.agent) + '</td>';
_h += ' <td>' + filterXSS(d.ipx) + '</td>';
_h += ' <td>' + filterXSS(d.country) + ' ' + filterXSS(d.region) + '</td>';
_h += ' </tr>';
$(".data_list").before(_h);
}
}
}
function init_chart() {
main1_data();
main2_data();
main3_data();
main4_data();
main5_data();
main6_data();
}
init_chart();
mainInfo();
mainWs();
setInterval(init_chart, 300000);
var attckCity = $("#dataAttack").val();
</script>
<script type="text/javascript" src="/static/data/js/data.js"></script>
</body>
</html>

View File

@ -7,6 +7,7 @@ name = Server # 状态1 服务端 名称 状
addr = 0.0.0.0:9001 # 管理后台启动地址
account = admin # 登录账号,不能带 #
password = admin # 登录密码,不能带 #
attack_city = 北京 # 数据大屏攻击地区设置
db_type = sqlite # sqlite or mysql
db_max_open = 50 # 最大连接池0 表示无限制
db_max_idle = 50 # 最大空闲数0 表示无限制
@ -43,7 +44,7 @@ static = deep/static # 暗网 WEB 静态文件路径
url = / # 暗网 WEB 访问目录,默认 / 可更改成 index.html index.asp index.php
[ssh]
status = 1 # 是否启动 SSH 0 关闭 1 低交互 2 高交互
status = 2 # 是否启动 SSH 0 关闭 1 低交互 2 高交互
addr = 0.0.0.0:22 # SSH 服务端地址 注意端口冲突,请先关闭服务器 openssh 服务 或 修改端口
[redis]

View File

@ -36,9 +36,13 @@ func Start(addr string) {
res := getJson()
term := terminal.NewTerminal(s, res.Get("hostname").MustString())
line := ""
for {
line, _ = term.ReadLine()
line, rerr := term.ReadLine()
if rerr != nil {
break
}
if line == "exit" {
break
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

BIN
images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 711 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 945 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 720 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

BIN
images/wx.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View File

@ -7,7 +7,7 @@ import (
)
func main() {
//setting.Run()
setting.Run()
args := os.Args
if args == nil || len(args) < 2 {
setting.Help()

View File

@ -47,7 +47,7 @@ body.bg04 {
line-height: 50px;
text-align: center;
font-size: 24px;
color: #5dc2fe;
color: #fff;
}
.wrapper {

Binary file not shown.

518
static/data/js/dark.js Normal file
View File

@ -0,0 +1,518 @@
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports', 'echarts'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports, require('echarts'));
} else {
// Browser globals
factory({}, root.echarts);
}
}(this, function (exports, echarts) {
var log = function (msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg);
}
};
if (!echarts) {
log('ECharts is not Loaded');
return;
}
echarts.registerTheme('dark', {
"color": [
"#dd6b66",
"#759aa0",
"#e69d87",
"#8dc1a9",
"#ea7e53",
"#eedd78",
"#73a373",
"#73b9bc",
"#7289ab",
"#91ca8c",
"#f49f42"
],
"textStyle": {},
"title": {
"textStyle": {
"color": "#eeeeee"
},
"subtextStyle": {
"color": "#aaaaaa"
}
},
"line": {
"itemStyle": {
"normal": {
"borderWidth": 1
}
},
"lineStyle": {
"normal": {
"width": 2
}
},
"symbolSize": 4,
"symbol": "circle",
"smooth": false
},
"radar": {
"itemStyle": {
"normal": {
"borderWidth": 1
}
},
"lineStyle": {
"normal": {
"width": 2
}
},
"symbolSize": 4,
"symbol": "circle",
"smooth": false
},
"bar": {
"itemStyle": {
"normal": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
},
"emphasis": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
}
}
},
"pie": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"scatter": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"boxplot": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"parallel": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"sankey": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"funnel": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"gauge": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"candlestick": {
"itemStyle": {
"normal": {
"color": "#fd1050",
"color0": "#0cf49b",
"borderColor": "#fd1050",
"borderColor0": "#0cf49b",
"borderWidth": 1
}
}
},
"graph": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"lineStyle": {
"normal": {
"width": 1,
"color": "#aaaaaa"
}
},
"symbolSize": 4,
"symbol": "circle",
"smooth": false,
"color": [
"#dd6b66",
"#759aa0",
"#e69d87",
"#8dc1a9",
"#ea7e53",
"#eedd78",
"#73a373",
"#73b9bc",
"#7289ab",
"#91ca8c",
"#f49f42"
],
"label": {
"normal": {
"textStyle": {
"color": "#eeeeee"
}
}
}
},
"map": {
"itemStyle": {
"normal": {
"areaColor": "#eee",
"borderColor": "#444",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "rgba(255,215,0,0.8)",
"borderColor": "#444",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#000"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(100,0,0)"
}
}
}
},
"geo": {
"itemStyle": {
"normal": {
"areaColor": "#eee",
"borderColor": "#444",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "rgba(255,215,0,0.8)",
"borderColor": "#444",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#000"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(100,0,0)"
}
}
}
},
"categoryAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisTick": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#eeeeee"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#aaaaaa"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"#eeeeee"
]
}
}
},
"valueAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisTick": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#eeeeee"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#aaaaaa"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"#eeeeee"
]
}
}
},
"logAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisTick": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#eeeeee"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#aaaaaa"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"#eeeeee"
]
}
}
},
"timeAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisTick": {
"show": true,
"lineStyle": {
"color": "#eeeeee"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#eeeeee"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#aaaaaa"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"#eeeeee"
]
}
}
},
"toolbox": {
"iconStyle": {
"normal": {
"borderColor": "#999999"
},
"emphasis": {
"borderColor": "#666666"
}
}
},
"legend": {
"textStyle": {
"color": "#eeeeee"
}
},
"tooltip": {
"axisPointer": {
"lineStyle": {
"color": "#eeeeee",
"width": "1"
},
"crossStyle": {
"color": "#eeeeee",
"width": "1"
}
}
},
"timeline": {
"lineStyle": {
"color": "#eeeeee",
"width": 1
},
"itemStyle": {
"normal": {
"color": "#dd6b66",
"borderWidth": 1
},
"emphasis": {
"color": "#a9334c"
}
},
"controlStyle": {
"normal": {
"color": "#eeeeee",
"borderColor": "#eeeeee",
"borderWidth": 0.5
},
"emphasis": {
"color": "#eeeeee",
"borderColor": "#eeeeee",
"borderWidth": 0.5
}
},
"checkpointStyle": {
"color": "#e43c59",
"borderColor": "rgba(194,53,49,0.5)"
},
"label": {
"normal": {
"textStyle": {
"color": "#eeeeee"
}
},
"emphasis": {
"textStyle": {
"color": "#eeeeee"
}
}
}
},
"visualMap": {
"color": [
"#bf444c",
"#d88273",
"#f6efa6"
]
},
"dataZoom": {
"backgroundColor": "rgba(47,69,84,0)",
"dataBackgroundColor": "rgba(255,255,255,0.3)",
"fillerColor": "rgba(167,183,204,0.4)",
"handleColor": "#a7b7cc",
"handleSize": "100%",
"textStyle": {
"color": "#eeeeee"
}
},
"markPoint": {
"label": {
"normal": {
"textStyle": {
"color": "#eeeeee"
}
},
"emphasis": {
"textStyle": {
"color": "#eeeeee"
}
}
}
}
});
}));

884
static/data/js/data.js Normal file
View File

@ -0,0 +1,884 @@
window.onresize = function () {
main1.resize();
main2.resize();
main3.resize();
main4.resize();
main5.resize();
main6.resize();
worldMap.resize();
};
var main1 = echarts.init(document.getElementById('main1'), 'dark');
var main2 = echarts.init(document.getElementById('main2'), 'dark');
var main3 = echarts.init(document.getElementById('main3'), 'dark');
var main4 = echarts.init(document.getElementById('main4'), 'dark');
var main5 = echarts.init(document.getElementById('main5'));
var main6 = echarts.init(document.getElementById('main6'));
var worldMap = echarts.init(document.getElementById('worldMap'));
function main1_data() {
$.ajax({
type: "GET",
url: "/data/get/china",
dataType: "json",
success: function (e) {
var d = e.data;
var listx = [];
for (var i = 0; i < d.regionList.length; i++) {
listx.push(d.regionList[i].name);
}
var option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
bottom: 10,
left: 'center',
data: listx,
textStyle: {
color: "#fff"
}
},
series: [{
name: '来源地区',
type: 'pie',
radius: '60%',
center: ['50%', '40%'],
label: {
normal: {
show: false,
position: 'center'
}
},
data: d.regionList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main1.setOption(option);
}
});
}
function main2_data() {
$.ajax({
type: "GET",
url: "/data/get/country",
dataType: "json",
success: function (e) {
var d = e.data;
var listx = [];
for (var i = 0; i < d.regionList.length; i++) {
listx.push(d.regionList[i].name);
}
var option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
bottom: 10,
left: 'center',
data: listx,
textStyle: {
color: "#fff"
}
},
series: [{
name: '来源国家',
type: 'pie',
radius: '60%',
center: ['50%', '40%'],
label: {
normal: {
show: false,
position: 'center'
}
},
data: d.regionList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main2.setOption(option);
}
});
}
function main3_data() {
$.ajax({
type: "GET",
url: "/data/get/ip",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
series: [{
name: 'IP分布',
type: 'pie',
radius: '30%',
center: ['50%', '50%'],
data: d.ipList,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
main3.setOption(option);
}
});
}
function main4_data() {
$.ajax({
type: "GET",
url: "/data/get/type",
dataType: "json",
success: function (e) {
var d = e.data;
var dataN = [];
var dataV = [];
for (var i = d.typeList.length - 1; i >= 0; i--) {
dataN.push(d.typeList[i].name);
dataV.push(d.typeList[i].value);
}
var option = {
tooltip: {},
xAxis: {
type: 'value',
show: false
},
yAxis: {
type: 'category',
data: dataN,
axisLine: {
lineStyle: {
color: '#67c8fd'
}
}
},
grid: {
left: '0%',
right: '0%',
bottom: '0%',
top: '3%',
containLabel: true
},
series: [{
data: dataV,
type: 'bar',
label: {
normal: {
show: true,
position: 'inside',
color: '#fff'
}
},
itemStyle: {
normal: {
color: '#49b2c0'
}
}
}]
};
main4.setOption(option);
}
});
}
function main5_data() {
$.ajax({
type: "GET",
url: "/data/get/account",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
show: true
},
series: [{
name: '账号',
type: "wordCloud",
gridSize: 6,
shape: 'circle',
sizeRange: [12, 50],
width: '100%',
height: '80%',
textStyle: {
normal: {
color: function () {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
}
},
data: d
}]
};
main5.setOption(option);
}
});
}
function main6_data() {
$.ajax({
type: "GET",
url: "/data/get/password",
dataType: "json",
success: function (e) {
var d = e.data;
var option = {
tooltip: {
show: true
},
series: [{
name: '密码',
type: "wordCloud",
gridSize: 6,
shape: 'circle',
sizeRange: [12, 50],
width: '100%',
height: '80%',
textStyle: {
normal: {
color: function () {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
shadowBlur: 10,
shadowColor: '#333'
}
},
data: d
}]
};
main6.setOption(option);
}
});
}
function mainInfo() {
$.ajax({
type: "GET",
url: "/data/get/info",
dataType: "json",
success: function (e) {
var d = e.data;
var _h = '';
var result = d.result;
for (var i = 0; i < result.length; i++) {
_h += ' <tr class="data_list">';
_h += ' <td>' + filterXSS(result[i].type) + '</td>';
_h += ' <td>' + filterXSS(result[i].agent) + '</td>';
_h += ' <td>' + filterXSS(result[i].ip) + '</td>';
_h += ' <td>' + filterXSS(result[i].country) + ' ' + filterXSS(result[i].region) + '</td>';
_h += ' <td>' + filterXSS(result[i].create_time).split(" ")[1] + '</td>';
_h += ' </tr>';
}
$("#info_list").append(_h);
}
});
}
function mainWs() {
var wsuri = "ws://" + window.location.host + "/data/ws";
var sock = new WebSocket(wsuri);
sock.onopen = function () {
console.log("connected to " + wsuri);
};
sock.onclose = function (e) {
console.log("connection closed (" + e.code + ")");
};
sock.onmessage = function (e) {
var data = JSON.parse(e.data);
if (data.data.type === "center_data") {
var d = data.data.data;
var _h = '';
_h += ' <tr class="data_list">';
_h += ' <td>' + filterXSS(d.type) + '</td>';
_h += ' <td>' + filterXSS(d.agent) + '</td>';
_h += ' <td>' + filterXSS(d.ipx) + '</td>';
_h += ' <td>' + filterXSS(d.country) + ' ' + filterXSS(d.region) + '</td>';
_h += ' <td>' + filterXSS(d.time).split(" ")[1] + '</td>';
_h += ' </tr>';
$(".data_list").before(_h);
}
}
}
function main7_data() {
function randomData() {
return Math.round(Math.random() * 300);
}
var geoCoordMap = {
"阿富汗": [67.709953, 33.93911],
"安哥拉": [17.873887, -11.202692],
"阿尔巴尼亚": [20.168331, 41.153332],
"阿联酋": [53.847818, 23.424076],
"阿根廷": [-63.61667199999999, -38.416097],
"亚美尼亚": [45.038189, 40.069099],
"法属南半球和南极领地": [69.348557, -49.280366],
"澳大利亚": [133.775136, -25.274398],
"奥地利": [14.550072, 47.516231],
"阿塞拜疆": [47.576927, 40.143105],
"布隆迪": [29.918886, -3.373056],
"比利时": [4.469936, 50.503887],
"贝宁": [2.315834, 9.30769],
"布基纳法索": [-1.561593, 12.238333],
"孟加拉国": [90.356331, 23.684994],
"保加利亚": [25.48583, 42.733883],
"巴哈马": [-77.39627999999999, 25.03428],
"波斯尼亚和黑塞哥维那": [17.679076, 43.915886],
"白俄罗斯": [27.953389, 53.709807],
"伯利兹": [-88.49765, 17.189877],
"百慕大": [-64.7505, 32.3078],
"玻利维亚": [-63.58865299999999, -16.290154],
"巴西": [-51.92528, -14.235004],
"文莱": [114.727669, 4.535277],
"不丹": [90.433601, 27.514162],
"博茨瓦纳": [24.684866, -22.328474],
"中非共和国": [20.939444, 6.611110999999999],
"加拿大": [-106.346771, 56.130366],
"瑞士": [8.227511999999999, 46.818188],
"智利": [-71.542969, -35.675147],
"中国": [104.195397, 35.86166],
"象牙海岸": [-5.547079999999999, 7.539988999999999],
"喀麦隆": [12.354722, 7.369721999999999],
"刚果民主共和国": [21.758664, -4.038333],
"刚果共和国": [15.827659, -0.228021],
"哥伦比亚": [-74.297333, 4.570868],
"哥斯达黎加": [-83.753428, 9.748916999999999],
"古巴": [-77.781167, 21.521757],
"北塞浦路斯": [33.429859, 35.126413],
"塞浦路斯": [33.429859, 35.126413],
"捷克共和国": [15.472962, 49.81749199999999],
"德国": [10.451526, 51.165691],
"吉布提": [42.590275, 11.825138],
"丹麦": [9.501785, 56.26392],
"多明尼加共和国": [-70.162651, 18.735693],
"阿尔及利亚": [1.659626, 28.033886],
"厄瓜多尔": [-78.18340599999999, -1.831239],
"埃及": [30.802498, 26.820553],
"厄立特里亚": [39.782334, 15.179384],
"西班牙": [-3.74922, 40.46366700000001],
"爱沙尼亚": [25.013607, 58.595272],
"埃塞俄比亚": [40.489673, 9.145000000000001],
"芬兰": [25.748151, 61.92410999999999],
"斐": [178.065032, -17.713371],
"福克兰群岛": [-59.523613, -51.796253],
"法国": [2.213749, 46.227638],
"加蓬": [11.609444, -0.803689],
"英国": [-3.435973, 55.378051],
"格鲁吉亚": [-82.9000751, 32.1656221],
"加纳": [-1.023194, 7.946527],
"几内亚": [-9.696645, 9.945587],
"冈比亚": [-15.310139, 13.443182],
"几内亚比绍": [-15.180413, 11.803749],
"赤道几内亚": [10.267895, 1.650801],
"希腊": [21.824312, 39.074208],
"格陵兰": [-42.604303, 71.706936],
"危地马拉": [-90.23075899999999, 15.783471],
"法属圭亚那": [-53.125782, 3.933889],
"圭亚那": [-58.93018, 4.860416],
"洪都拉斯": [-86.241905, 15.199999],
"克罗地亚": [15.2, 45.1],
"海地": [-72.285215, 18.971187],
"匈牙利": [19.503304, 47.162494],
"印尼": [113.921327, -0.789275],
"印度": [78.96288, 20.593684],
"爱尔兰": [-8.24389, 53.41291],
"伊朗": [53.688046, 32.427908],
"伊拉克": [43.679291, 33.223191],
"冰岛": [-19.020835, 64.963051],
"以色列": [34.851612, 31.046051],
"意大利": [12.56738, 41.87194],
"牙买加": [-77.297508, 18.109581],
"约旦": [36.238414, 30.585164],
"日本": [138.252924, 36.204824],
"哈萨克斯坦": [66.923684, 48.019573],
"肯尼亚": [37.906193, -0.023559],
"吉尔吉斯斯坦": [74.766098, 41.20438],
"柬埔寨": [104.990963, 12.565679],
"韩国": [127.766922, 35.907757],
"科索沃": [20.902977, 42.6026359],
"科威特": [47.481766, 29.31166],
"老挝": [102.495496, 19.85627],
"黎巴嫩": [35.862285, 33.854721],
"利比里亚": [-9.429499000000002, 6.428055],
"利比亚": [17.228331, 26.3351],
"斯里兰卡": [80.77179699999999, 7.873053999999999],
"莱索托": [28.233608, -29.609988],
"立陶宛": [23.881275, 55.169438],
"卢森堡": [6.129582999999999, 49.815273],
"拉脱维亚": [24.603189, 56.879635],
"摩洛哥": [-7.092619999999999, 31.791702],
"摩尔多瓦": [28.369885, 47.411631],
"马达加斯加": [46.869107, -18.766947],
"墨西哥": [-102.552784, 23.634501],
"马其顿": [21.745275, 41.608635],
"马里": [-3.996166, 17.570692],
"缅甸": [95.956223, 21.913965],
"黑山": [19.37439, 42.708678],
"蒙古": [103.846656, 46.862496],
"莫桑比克": [35.529562, -18.665695],
"毛里塔尼亚": [-10.940835, 21.00789],
"马拉维": [34.301525, -13.254308],
"马来西亚": [101.975766, 4.210484],
"纳米比亚": [18.49041, -22.95764],
"新喀里多尼亚": [165.618042, -20.904305],
"尼日尔": [8.081666, 17.607789],
"尼日利亚": [8.675277, 9.081999],
"尼加拉瓜": [-85.207229, 12.865416],
"荷兰": [5.291265999999999, 52.132633],
"挪威": [8.468945999999999, 60.47202399999999],
"尼泊尔": [84.12400799999999, 28.394857],
"新西兰": [174.885971, -40.900557],
"阿曼": [55.923255, 21.512583],
"巴基斯坦": [69.34511599999999, 30.375321],
"巴拿马": [-80.782127, 8.537981],
"秘鲁": [-75.015152, -9.189967],
"菲律宾": [121.774017, 12.879721],
"巴布亚新几内亚": [143.95555, -6.314992999999999],
"波兰": [19.145136, 51.919438],
"波多黎各": [-66.590149, 18.220833],
"北朝鲜": [127.510093, 40.339852],
"葡萄牙": [-8.224454, 39.39987199999999],
"巴拉圭": [-58.443832, -23.442503],
"卡塔尔": [51.183884, 25.354826],
"罗马尼亚": [24.96676, 45.943161],
"俄罗斯": [105.318756, 61.52401],
"卢旺达": [29.873888, -1.940278],
"西撒哈拉": [-12.885834, 24.215527],
"沙特阿拉伯": [45.079162, 23.885942],
"苏丹": [30.217636, 12.862807],
"南苏丹": [31.3069788, 6.876991899999999],
"塞内加尔": [-14.452362, 14.497401],
"所罗门群岛": [160.156194, -9.64571],
"塞拉利昂": [-11.779889, 8.460555],
"萨尔瓦多": [-88.89653, 13.794185],
"索马里兰": [46.8252838, 9.411743399999999],
"索马里": [46.199616, 5.152149],
"塞尔维亚共和国": [21.005859, 44.016521],
"苏里南": [-56.027783, 3.919305],
"斯洛伐克": [19.699024, 48.669026],
"斯洛文尼亚": [14.995463, 46.151241],
"瑞典": [18.643501, 60.12816100000001],
"斯威士兰": [31.465866, -26.522503],
"叙利亚": [38.996815, 34.80207499999999],
"乍得": [18.732207, 15.454166],
"多哥": [0.824782, 8.619543],
"泰国": [100.992541, 15.870032],
"塔吉克斯坦": [71.276093, 38.861034],
"土库曼斯坦": [59.556278, 38.969719],
"东帝汶": [125.727539, -8.874217],
"特里尼达和多巴哥": [-61.222503, 10.691803],
"突尼斯": [9.537499, 33.886917],
"土耳其": [35.243322, 38.963745],
"坦桑尼亚联合共和国": [34.888822, -6.369028],
"乌干达": [32.290275, 1.373333],
"乌克兰": [31.16558, 48.379433],
"乌拉圭": [-55.765835, -32.522779],
"美国": [-95.712891, 37.09024],
"乌兹别克斯坦": [64.585262, 41.377491],
"委内瑞拉": [-66.58973, 6.42375],
"越南": [108.277199, 14.058324],
"瓦努阿图": [166.959158, -15.376706],
"西岸": [35.3027226, 31.9465703],
"也门": [48.516388, 15.552727],
"南非": [22.937506, -30.559482],
"赞比亚": [27.849332, -13.133897],
"津巴布韦": [29.154857, -19.015438],
'新疆': [87.500966, 43.983832],
'西藏': [90.959657, 29.881987],
'青海': [101.703679, 36.733408],
'甘肃': [103.764176, 36.198433],
'内蒙古': [111.711808, 40.98898],
'宁夏': [106.192619, 38.605171],
'四川': [103.984944, 30.712171],
'云南': [102.733927, 25.025991],
'陕西': [112.521289, 38.025365],
'山西': [108.84183, 34.510421],
'重庆': [106.413387, 29.689402],
'贵州': [106.560565, 26.756654],
'广西': [108.326706, 22.99805],
'海南': [110.129641, 20.14162],
'广东': [113.183592, 23.202287],
'澳门': [113.551538, 22.109432],
'香港': [114.066662, 22.588638],
'台湾': [121.49917, 25.12653],
'福建': [119.107522, 26.193691],
'江西': [115.722419, 28.882959],
'湖南': [112.778851, 28.363482],
'湖北': [114.177046, 30.743959],
'安徽': [117.120614, 31.943998],
'浙江': [119.990592, 30.361806],
'江苏': [118.665986, 32.194658],
'河南': [113.441154, 34.8448],
'山东': [116.973435, 36.763019],
'上海': [121.315197, 31.314325],
'河北': [114.397814, 38.170754],
'天津': [117.194203, 39.180291],
'北京': [116.384722, 39.977552],
'辽宁': [123.412489, 41.875105],
'吉林': [125.252219, 43.850841],
'黑龙江': [126.503235, 45.865719]
};
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var dataItem = data[i];
var fromCoord = geoCoordMap[dataItem[0].name];
var toCoord = geoCoordMap[dataItem[1].name];
if (fromCoord && toCoord) {
res.push([{
coord: fromCoord,
value: dataItem[0].value
},
{
coord: toCoord
}
]);
}
}
return res;
};
$.ajax({
type: "GET",
url: "/data/get/word",
dataType: "json",
success: function (e) {
var d = e.data;
var geoCoordArry = [];
for (var item in geoCoordMap) {
geoCoordArry.push(item);
}
var attckData = [];
for (var i = 0; i < d.length; i++) {
if (geoCoordArry.indexOf(d[i].name) > -1) {
var acctckJson = [
{
"name": d[i].name,
"value": d[i].value
},
{
"name": attckCity
}
];
attckData.push(acctckJson)
}
}
var series = [];
[
[attckCity, attckData]
].forEach(function (item, i) {
series.push({
name: '攻击线1',
type: "lines",
zlevel: 2,
effect: {
show: true,
color: "#0bc7f3",
period: 4, //箭头指向速度,值越小速度越快
trailLength: 0.02, //特效尾迹长度[0,1]值越大,尾迹越长重
symbol: "arrow", //箭头图标
symbolSize: 5 //图标大小
},
lineStyle: {
normal: {
color: '#0bc7f3',
width: 1, //尾迹线条宽度
opacity: 0, //尾迹线条透明度
curveness: 0.3 //尾迹线条曲直度
}
},
data: convertData(item[1])
}, {
type: "effectScatter",
coordinateSystem: "geo",
zlevel: 2,
rippleEffect: {
//涟漪特效
period: 4, //动画时间,值越小速度越快
brushType: "stroke", //波纹绘制方式 stroke, fill
scale: 4 //波纹圆环最大限制,值越大波纹越大
},
symbol: "circle",
symbolSize: function (val) {
return 4 + val[2] / 1000; //圆环大小
},
itemStyle: {
normal: {
show: true,
},
emphasis: {
show: true,
color: "#FF6A6A"
}
},
data: item[1].map(function (dataItem) {
return {
name: dataItem[0].name,
value: geoCoordMap[dataItem[0].name].concat([dataItem[0].value])
};
})
},
//被攻击点
{
type: "scatter",
coordinateSystem: "geo",
zlevel: 2,
rippleEffect: {
period: 4,
brushType: "stroke",
scale: 4
},
label: {
normal: {
show: true,
color: "red",
position: "right",
formatter: "{b}",
},
emphasis: {
show: true,
color: "#FF6A6A"
}
},
symbol: "pin",
symbolSize: 25,
itemStyle: {
normal: {
show: true,
color: "red",
},
emphasis: {
show: true,
color: "#FF6A6A"
}
},
data: [{
name: item[0],
value: geoCoordMap[item[0]].concat([100]),
visualMap: false
}]
}
);
});
var worldMapOpt = {
tooltip: {
trigger: "item",
backgroundColor: "#1540a1",
borderColor: "#FFFFCC",
showDelay: 0,
hideDelay: 0,
enterable: true,
transitionDuration: 0,
extraCssText: "z-index:100",
formatter: function (params, ticket, callback) {
var res = "";
var name = params.name;
var value = params.value[params.seriesIndex + 1];
res =
"<span style='color:#fff;'>" +
name +
"</span><br/>数据:" +
value;
return res;
}
},
visualMap: {
//图例值控制
show: false,
type: 'piecewise',
pieces: [{
max: 80,
color: '#00e200'
},
{
min: 80,
max: 120,
color: '#f5ff00'
},
{
min: 120,
color: '#ff0500'
}
],
calculable: true
},
geo: {
map: "world",
show: true,
label: {
emphasis: {
show: false
}
},
roam: true,
layoutCenter: ["50%", "50%"], //地图位置
layoutSize: "190%",
itemStyle: {
normal: {
show: 'true',
color: "#04284e", //地图背景色
borderColor: "#5bc1c9" //省市边界线
},
emphasis: {
show: 'true',
color: "rgba(37, 43, 61, .5)" //悬浮背景
}
}
},
legend: {
orient: 'vertical',
top: '30',
left: 'center',
align: 'right',
textStyle: {
color: '#fff',
fontSize: 20
},
itemWidth: 50,
itemHeight: 30,
selectedMode: 'multiple'
},
series: series
};
worldMap.setOption(worldMapOpt);
}
});
}
function init_chart() {
main1_data();
main2_data();
main3_data();
main4_data();
main5_data();
main6_data();
main7_data();
}
init_chart();
mainInfo();
mainWs();
setInterval(init_chart, 60000);
// ==================================
function getTime() {
var date = new Date();
var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
var hours = date.getHours(); //小时 ,返回 Date 对象的小时 (0 ~ 23)
var minutes = date.getMinutes(); //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
var seconds = date.getSeconds(); //秒 ,返回 Date 对象的秒数 (0 ~ 59)
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (day >= 0 && day <= 9) {
day = "0" + day;
}
if (hours >= 0 && hours <= 9) {
hours = "0" + hours;
}
if (minutes >= 0 && minutes <= 9) {
minutes = "0" + minutes;
}
if (seconds >= 0 && seconds <= 9) {
seconds = "0" + seconds;
}
var currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
$("#timex").text(currentFormatDate);
}
setInterval(getTime, 1000);

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(function (root, factory) {if (typeof define === 'function' && define.amd) {define(['exports', 'echarts'], factory);} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {factory(exports, require('echarts'));} else {factory({}, root.echarts);}}(this, function (exports, echarts) {var log = function (msg) {if (typeof console !== 'undefined') {console && console.error && console.error(msg);}};if (!echarts) {log('ECharts is not Loaded');return;}if (!echarts.registerMap) {log('ECharts Map is not loaded');return;}echarts.registerMap('昆山市', {"type":"FeatureCollection","features":[{"type":"Feature","id":"320583","properties":{"name":"昆山市","cp":[120.980736,31.385597],"childNum":1},"geometry":{"type":"Polygon","coordinates":["@@GACASDEBWFMBSBYDCAEAGAICGAE@AAC@A@MDA@MASAA@AAA@AAAACCAAAAACAC@A@A@CCCEE@@AAA@AAA@@CCCA@A@@A@ACBGFAA@@A@A@A@A@@@@@@@@@@@@B@@@@A@AB@@DBA@ADCBGDSJMFKB@N@BAJ@F@N@BBBJ@B@B@@F@BAH@F@B@BA@@B@@BB@@BB@B@B@@A@AB@@@@A@@@@@A@@@@BA@@@@A@@EDAAABGBEFCBJTHN^FLHB@LHPFHFHDHBRBHCFADAD@BHF@@DF@HAH@D@BFF@AF@DABFB@FC@AD@B@@@@CJ@@@@@BAB@@C@AB@BAB@@C@AAA@@D@BAFBBBBD@BB@B@B@@@@A@C@AD@@CAAJAB@BAD@@@BA@BB@BABAB@B@B@D@@@@@BBB@@D@@@@BA@@@E@BD@@AFD@@@DD@@@BGA@DD@@@D@@B@B@BE@@BC@@D@B@@AB@DABA@A@EBABA@@NADADAD@@ABADAB@B@@GNERCJCF@JCLCNG\\CAAFEACDFBADOAB@EAADC@@BOC@HFDE^@BFV@FBNDPH\\BD@@DHDT@RK^ADAJADGHAB@BAB@BE@@DA@@@AB@BBFBF@H@B@@@@A@A@A@A@DB@@@B@@@B@@CAA@@B@D@B@@ABC@@BA@@@@B@@@BB@BBF@B@@BBB@@A@BB@DB@D@@@@A@@B@@BB@@@B@F@LBJ@RBB@DBFA@C@@ACCB@GB@@DD@BK@@A@A@@@BBA@A@@@@@@AC@@BC@@A@@@@D@BAB@@@AA@@AA@ADBB@BAB@@@FBB@@EF@@D@@F@D@BAF@BEB@@BBJC@@F@BNE@BEB@DFABBC@BBC@BB@@BBABB@AB@BB@AB@FF@@BA@@BD@@BD@@HB@@@@B@@B@BAD@@@BBB@BB@@@BAB@@BDHCBB@@BB@ABB@@B@HCDFCD@BAB@BD@B@DADC@AEGEEAAAAFGDBVHDKAAJGBDHDJDFDHFHD@A@CD@@EBEE@BAB@BGDBBEB@@@BBABDBDMH@DIB@@C@@@CD@@CCA@AFB@AB@@AB@@@@@@DB@@@BBD@@@D@DA@CBABABA@@B@BBB@@@B@@ABADBB@@A@BBCFDBBJF@@B@BADELFDGFBBCDBD@DAB@CBBBDABDD@@CAA@EHEAAFEFB@CECC@AA@ABAAA@ABACC@AAA@C@AC@@CA@A@@GD@@C@A@A@A@@HCHABAH@AAACCCEABE@GDA@@@@@CB@AEH@BCJABBB@D@D@DBJEBCBABABBFC@@DB@BBBDBDBBBB@B@B@B@@ABGD@@CH@@CB@NHFHDFDDB@B@B@DCHEBAFIDCCABA@@@@MEACACL@AIACCEAACE@E@CAA@@@C@AD@DGBAB@BA@BDB@BBB@BB@@@@@B@@@@A@@FSB@DKA@FO@@@@@A@A@ABC@@@@@A@C@@@A@AA@BA@@AA@@B@BAAA@@@CB@D@@@B@@AB@BBD@DB@ABABA@ABAA@C@@GF@B@B@BAFBB@DBB@@@@A@A@@@A@@AABA@@@A@@@A@A@@@AA@BAB@AABA@@B@@AB@AAB@@A@AA@AAB@B@@A@AA@@@A@@A@A@@@A@@AA@@A@@A@@@AA@@@A@@A@@@A@A@@BA@A@@@A@@@A@A@@BAAAB@@A@A@A@A@ABAAABAB@B@B@NBAD@@@BFDDDDEBADI@@DCC@@AA@@AB@BA@BBAB@@@BCCA@CBBBA@@@CDB@@@C@@D@@AD@@@B@BEBAA@@AC@BAAAA@C@@A@AAAAA@@EAEAA@C@CB@DC@@AA@A@A@@@ABBBCBAAC@BDEB@CGBED@B@@BBGB@BA@@@@A@AC@ABA@C@AAACCAACCCAAEC@@D@AAC@CBCBAD@B@BABAFAFADA@@BA@ABABCBCABA@@EECMAGFACE@ACCA@E@EAA@CAC@C@G@@@AA@@B@AI@GBAA@@A@@AA@@B@@CAG@A@@@CA@ABAA@@@@B@BA@@B@@@@@@@@@@@B@@BB@B@@C@ABA@AAB@C@A@ACAA@BC@AB@B@@AB@@AD@@A@AA@A@@C@CC@@A@@@A@@@A@@@@@A@@@@@A@@@ABA@@@A@A@ABA@@@A@@@A@@@@@A@ABA@@@A@@@A@ABA@E@ABA@C@@BA@A@@@CA@A@@@@CF@@ADABAA@AA@A@@@ABA@@@A@AA@CABCJBBAICBCBADCBEEA@AA@@ABAFB@ADE@CIABCFB@A@AA@BCEC@@A@@A@CA@@DAA@ACAAABC@A@AEBA@BB@BC@@BA@@BE@E@AAA@BAC@C@C@@BAFGA@CCACA@@@EBAB@B@CIACACC@@BAAA@AFCB@@ABC@CA@B@@@DC@@A@@AA@AE@AABCGGA@A@SAA@]@C@"],"encodeOffsets":[[123894,31881]]}}],"UTF8Encoding":true});}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,7 @@ import (
"gopkg.in/gomail.v2"
"strconv"
"HFish/utils/log"
"crypto/tls"
)
func SendMail(mailTo []string, subject string, body string, config []string) error {
@ -15,13 +16,17 @@ func SendMail(mailTo []string, subject string, body string, config []string) err
m.SetHeader("Subject", subject) //设置邮件主题
m.SetBody("text/html", body) //设置邮件正文
d := &gomail.Dialer{
Host: config[0],
Port: port,
Username: config[2],
Password: config[3],
SSL: false,
}
//d := &gomail.Dialer{
// Host: config[0],
// Port: port,
// Username: config[2],
// Password: config[3],
// SSL: false,
//}
d := gomail.NewDialer(config[0], port, config[2], config[3])
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
err := d.DialAndSend(m)

View File

@ -9,10 +9,14 @@ import (
"strconv"
"HFish/utils/log"
"HFish/error"
"HFish/utils/conf"
)
func Html(c *gin.Context) {
c.HTML(http.StatusOK, "data.html", gin.H{})
attackCity := conf.Get("admin", "attack_city")
c.HTML(http.StatusOK, "data.html", gin.H{
"dataAttack": attackCity,
})
}
// 统计中国攻击地区
@ -200,6 +204,31 @@ func GetPasswdInfo(c *gin.Context) {
})
}
// 获取全球攻击数量
func GetWordInfo(c *gin.Context) {
var result []map[string]interface{}
err := dbUtil.DB().Table(&result).Query("select region,sum(1) as sum from hfish_info GROUP BY region;")
if err != nil {
log.Pr("HFish", "127.0.0.1", "查询SQL失败", err)
}
var resultMap []map[string]string
for k := range result {
rMap := make(map[string]string)
rMap["name"] = result[k]["region"].(string)
rMap["value"] = strconv.FormatInt(result[k]["sum"].(int64), 10)
resultMap = append(resultMap, rMap)
}
c.JSON(http.StatusOK, gin.H{
"code": error.ErrSuccessCode,
"msg": error.ErrSuccessMsg,
"data": resultMap,
})
}
// 往下是 Web Socket 代码
// 存储全部客户端连接

View File

@ -42,6 +42,7 @@ func LoadUrl(r *gin.Engine) {
r.GET("/data/get/info", login.Jump, data.GetNewInfo)
r.GET("/data/get/account", login.Jump, data.GetAccountInfo)
r.GET("/data/get/password", login.Jump, data.GetPasswdInfo)
r.GET("/data/get/word", login.Jump, data.GetWordInfo)
r.GET("/data/ws", data.Ws)
// 分布式集群