Skip to content

Commit

Permalink
~ 上钩列表分页优化
Browse files Browse the repository at this point in the history
~ 上钩列表支持批量删除
~ 上钩列表长度展示
~ 上钩列表支持集群筛选
~ 集群页面支持删除
~ 改用 IPIP 本地库获取地理信息
~ 支持 WebHook Api 通知
~ 提供获取上钩列表 API
~ WEB,暗网蜜罐 API 移到各种服务上,抛开 Admin
~ 修复暗网蜜罐使用问题
~ 修复集群取 IP 错误问题
~ SSH 高交互支持
  • Loading branch information
sanjinhub committed Aug 24, 2019
1 parent 863ebe5 commit b97dae8
Show file tree
Hide file tree
Showing 57 changed files with 3,817 additions and 258 deletions.
39 changes: 37 additions & 2 deletions admin/colony.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@
margin-top: 0px;
}

.agent_name{
.agent_name {
font-weight: bold;
color: #167bcc;
}

.fa-trash-o {
cursor: pointer;
color: #dc0e0e;
margin-right: 5px;
}
</style>
<div class="row">
<div class="col-sm-12">
Expand All @@ -64,7 +70,7 @@ <h4 class="page-title">分布式集群</h4>
<th width="10%" style="text-align: center;">Mysql</th>
<th width="10%" style="text-align: center;">Telnet</th>
<th width="10%" style="text-align: center;">FTP</th>
{{/*<th width="10%" style="text-align: center;">Http代理</th>*/}}
<th width="1%"></th>
</tr>
</thead>
<tbody id="tableList">
Expand All @@ -79,6 +85,28 @@ <h4 class="page-title">分布式集群</h4>

{{template "footer" }}
<script>

function del(id) {
$.ajax({
type: "POST",
url: "/post/colony/del",
dataType: "json",
data: {
"id": id
},
success: function (e) {
if (e.code == 200) {
window.location.href = "/colony";
} else {
swal("删除失败", e.msg, 'error');
}
},
error: function (e) {
swal("删除失败", "请 Github 提交 Issues", 'error');
}
});
}

$.ajax({
type: "GET",
url: "/get/colony/list",
Expand Down Expand Up @@ -148,6 +176,10 @@ <h4 class="page-title">分布式集群</h4>
// } else {
// _h += ' <td class="td" style="text-align: center;"><span class="closex"></span></td>';
// }

_h += ' <td class="td" style="text-align: center;">';
_h += ' <i class="fa fa-trash-o" onclick="del(' + data[i].id + ')"></i>';
_h += ' </td>';
} else {
_h += ' <td class="td agent_name"><span class="closex"></span>' + data[i].agent_name + '</td>';
_h += ' <td class="td"><span>' + data[i].agent_ip + '</span></td>';
Expand All @@ -159,6 +191,9 @@ <h4 class="page-title">分布式集群</h4>
_h += ' <td class="td" style="text-align: center;"><span class="closex"></span></td>';
_h += ' <td class="td" style="text-align: center;"><span class="closex"></span></td>';
// _h += ' <td class="td" style="text-align: center;"><span class="closex"></span></td>';
_h += ' <td class="td" style="text-align: center;">';
_h += ' <i class="fa fa-trash-o" onclick="del(' + data[i].id + ')"></i>';
_h += ' </td>';
}


Expand Down
188 changes: 135 additions & 53 deletions admin/fish.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{template "header"}}
<link href="/static/libs/page/jquery.sPage.css" rel="stylesheet"/>
<style>
.card-box {
padding: 0px;
Expand All @@ -24,8 +25,7 @@
}

.fa-trash-o {
color: #f00;
cursor: pointer;
margin-right: 5px;
}

.info {
Expand Down Expand Up @@ -96,20 +96,38 @@
}

.agent_name {
border: 1px solid #167bcc;
border: 1px solid #079dfd;
padding: 2px 5px;
border-radius: 5px;
color: #167bcc;
color: #079dfd;
font-size: 12px;
}

.ipinfo{
.ipinfo {
border: 1px solid #434e56;
padding: 2px 5px;
border-radius: 5px;
color: #434e56;
font-size: 12px;
}

.cinfo {
border: 1px solid #1eaec1;
padding: 2px 5px;
border-radius: 5px;
color: #1eaec1;
font-size: 12px;
}

#myPage {
text-align: center;
margin-bottom: 20px;
}

.checkbox {
padding-left: 20px;
margin-bottom: -2px;
}
</style>
<div class="row">
<div class="col-sm-12">
Expand All @@ -126,6 +144,7 @@ <h4 class="page-title">上钩列表</h4>
<select class="form-control" id="selectType" style="height: 34px;" onchange="so()"></select>
</div>
<div class="col-sm-2">
<select class="form-control" id="selectColony" style="height: 34px;" onchange="so()"></select>
</div>
<div class="col-sm-2">
</div>
Expand All @@ -146,22 +165,28 @@ <h4 class="page-title">上钩列表</h4>
<table class="table table-hover">
<thead>
<tr>
<th width="10%">项目</th>
<th width="10%">集群名称</th>
<th width="10%">来源 IP</th>
<th width="10%">地理信息</th>
<th width="10%">信息</th>
<th width="1%">
<div class="checkbox checkbox-single checkbox-danger">
<input type="checkbox" value="all" id="check_all">
<label></label>
</div>
</th>
<th width="11%">项目</th>
<th width="8%">集群名称</th>
<th width="8%">来源 IP</th>
<th width="8%">地理信息</th>
<th width="5%">信息</th>
<th width="5%">长度</th>
<th width="8%">上钩时间</th>
<th width="2%">操作</th>
</tr>
</thead>
<tbody id="tableList"></tbody>
</table>
</div>
<div style="text-align: center;" class="dataTables_paginate paging_simple_numbers">
<ul class="pagination" id="pages">
</ul>
</div>
<button type="button" id="delbtn" class="btn btn-danger waves-effect waves-light btn-sm"
style="float: left;margin-top: 5px;" onclick="del()" disabled><i class="fa fa-trash-o"></i>删除
</button>
<div id="myPage"></div>
</div>
</div>

Expand All @@ -180,6 +205,7 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
</div>

{{template "footer" }}
<script src="/static/libs/page/jquery.sPage.js"></script>
<script>
function show(id) {
$.ajax({
Expand All @@ -205,13 +231,21 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
$('#myModal').modal('show')
}

function del(id) {
function del() {
var val = "";
$('input[name^="check_"]').each(function () {
if (this.checked) {
val += $(this).val() + ',';
}
});
val = val.substring(0, val.length - 1);

$.ajax({
type: "POST",
url: "/post/fish/del",
dataType: "json",
data: {
"id": id
"id": val
},
success: function (e) {
if (e.code == 200) {
Expand All @@ -232,26 +266,65 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
url: "/get/fish/typeList",
dataType: "json",
success: function (e) {
if (e.code == 200) {
var data = e.data;
var _h = '<option value="all">请选择类型</option>';
var data = e.resultInfoType;
var _h = '<option value="all">请选择类型</option>';

for (var i = 0; i < data.length; i++) {
_h += '<option value="' + data[i].type + '">' + data[i].type + '</option>';
}
for (var i = 0; i < data.length; i++) {
_h += '<option value="' + data[i].type + '">' + data[i].type + '</option>';
}

$("#selectType").html(_h);
$("#selectType").html(_h);

} else {
var data1 = e.resultColonyName;
var _h1 = '<option value="all">请选择集群</option>';
_h1 += '<option value="本机">本机</option>';

for (var i = 0; i < data1.length; i++) {
_h1 += '<option value="' + data1[i].agent_name + '">' + data1[i].agent_name + '</option>';
}
$("#selectColony").html(_h1);
},
error: function (e) {
}
});
}

function init(page, type, so_text) {
$("#check_all").click(function () {
var status = 0;

$('input[name="check_x"]').each(function () {
if ($("#check_all").prop('checked') == true) {
status++;
this.checked = true;
} else {
this.checked = false;
}
});

if (status > 0) {
$("#delbtn").attr("disabled", false);
} else {
$("#delbtn").attr("disabled", true);
}
});

function changedel() {
var status = 0;
$('input[name="check_x"]').each(function () {
if (this.checked == true) {
status++;
} else {
}
});

if (status > 0) {
$("#delbtn").attr("disabled", false);
} else {
$("#delbtn").attr("disabled", true);
}
}

function init(page, type, colony, so_text) {
$.ajax({
type: "GET",
url: "/get/fish/list",
Expand All @@ -260,6 +333,7 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
"page": page,
"pageSize": 10,
"type": type,
"colony": colony,
"so_text": so_text
},
success: function (e) {
Expand All @@ -268,6 +342,7 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>

for (var i = 0; i < data.length; i++) {
_h += '<tr>';
_h += ' <td class="td"><div class="checkbox checkbox-single checkbox-danger"><input type="checkbox" value="' + data[i].id + '" name="check_x" onchange="changedel()"><label></label></div></td>'
_h += ' <td class="td">';
if (data[i].type == "WEB") {
_h += ' <span class="label label-primary">WEB</span> ';
Expand All @@ -289,12 +364,20 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
_h += ' </td>';
_h += ' <td class="td"><span class="agent_name">' + data[i].agent + '</span></td>';
_h += ' <td class="td" style="font-weight: bold;">' + data[i].ip + '</td>';
_h += ' <td class="td"><span class="ipinfo">' + data[i].ip_info + '</span></td>';

// country,region,city
if (data[i].country == "本机地址") {
_h += ' <td class="td"><span class="ipinfo">本机地址</span></td>';
} else if (data[i].country == "局域网") {
_h += ' <td class="td"><span class="ipinfo">局域网</span></td>';
}
else {
_h += ' <td class="td"><span class="ipinfo">' + data[i].country + ' ' + data[i].region + ' ' + data[i].city + '</span></td>';
}

_h += ' <td><span class="info" onclick="show(' + data[i].id + ')">点击查看</span></td>';
_h += ' <td class="td"><span class="cinfo">' + data[i].info.length + '</span></td>';
_h += ' <td class="td">' + data[i].create_time + '</td>';
_h += ' <td class="td" style="text-align: center;">';
_h += ' <i class="fa fa-trash-o" onclick="del(' + data[i].id + ')"></i>';
_h += ' </td>';
_h += '</tr>';
}

Expand All @@ -305,44 +388,43 @@ <h6 class="modal-title" id="myModalLabel">上钩信息</h6>
$("#tableList").html(_h);

var pageCount = e.pageCount;
var totalCount = e.totalCount;
var page = e.page;
var _hx = '';

for (var i = 0; i < parseInt(pageCount); i++) {
if (page == (i + 1)) {
_hx += '<li class="paginate_button page-item active">';
_hx += ' <a onclick="page(' + (i + 1) + ')" style="cursor: pointer;" aria-controls="datatable" data-dt-idx="' + (i + 1) + '" tabindex="0" class="page-link">' + (i + 1) + '</a>';
_hx += '</li>';
} else {
_hx += '<li class="paginate_button page-item">';
_hx += ' <a onclick="page(' + (i + 1) + ')" style="cursor: pointer;" aria-controls="datatable" data-dt-idx="' + (i + 1) + '" tabindex="0" class="page-link">' + (i + 1) + '</a>';
_hx += '</li>';
}
}


$("#pages").html(_hx);
$("#myPage").sPage({
page: page,
pageSize: 10,
total: totalCount,
totalTxt: "共{total}条",//数据总条数文字描述,{total}为占位符,默认"共{total}条"
noData: true,//没有数据时是否显示分页,默认false不显示,true显示第一页
showTotal: true,//是否显示总条数,默认关闭:false
showSkip: true,
showPN: true,
prevPage: "上一页",
nextPage: "下一页",
backFun: function (p) {
var selectType = $("#selectType").val();
var selectColony = $("#selectColony").val();
var so_text = $("#so_text").val();
init(p, selectType, selectColony, so_text);
}
});
},
error: function (e) {
}
});
}


init(1, "all", "");
init(1, "all", "all", "");
init_type();

function so() {
var selectType = $("#selectType").val();
var selectColony = $("#selectColony").val();
var so_text = $("#so_text").val();

init(1, selectType, so_text);
}

function page(p) {
var selectType = $("#selectType").val();
var so_text = $("#so_text").val();

init(p, selectType, so_text);
init(1, selectType, selectColony, so_text);
}
</script>
Loading

0 comments on commit b97dae8

Please sign in to comment.