Skip to content

Commit

Permalink
更新0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjinhub committed Feb 24, 2020
1 parent bebcc1d commit ed6a698
Show file tree
Hide file tree
Showing 37 changed files with 2,481 additions and 362 deletions.
6 changes: 6 additions & 0 deletions admin/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<div class="tab-content">
<div class="tab-pane fade in active" id="home-2">
<div class="timeline-2">
<div class="time-item">
<div class="item-info">
<small class="text-muted">2020-02-24</small>
<p>发布 v0.5.1 版本</p>
</div>
</div>
<div class="time-item">
<div class="item-info">
<small class="text-muted">2019-12-02</small>
Expand Down
104 changes: 69 additions & 35 deletions admin/setting.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ <h4 class="page-title">系统设置</h4>
<tr id="tr{{$e.type}}" data-id="{{$e.id}}">
<td style="font-weight: bold;">{{$e.setting_name}} </td>
<td>{{$e.setting_dis}}</td>
<td id="trx{{$e.type}}"><script>var t={{$e.update_time}}; document.getElementById("trx{{$e.type}}").innerHTML= t.replace("T", " ").replace("+08:00", " ").replace("Z", "");</script></td>
<td id="trx{{$e.type}}">
<script>var t ={{$e.update_time}};
document.getElementById("trx{{$e.type}}").innerHTML = t.replace("T", " ").replace("+08:00", " ").replace("Z", "");</script>
</td>
<td>{{if ne $e.info ""}}
<span class="yes_config">已配置</span>
{{else}}
Expand Down Expand Up @@ -209,42 +212,68 @@ <h4 class="modal-title">WebHook Api 设置</h4>
</div>
</div>
</div>

<!-- Modal -->
<div class="modal fade" id="passwdTMModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">密码脱敏符号设置</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for=""><span class="text-danger">*</span>加密符号</label>
<input type="url" class="form-control" id="passwdTMText" name="webHookUrl" placeholder="请配置加密符号">
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" onclick="updatePasswdTM()">保存</button>
</div>
</div>
</div>
</div>
<input type="hidden" value="" id="settingId">
{{template "footer" }}
<script>
function settingSubFunc(id, type) {
$("#settingId").val(id)
getSettingInfo(id)
$("#settingId").val(id);
getSettingInfo(id);
switch (type) {
case "mail":
$('#myModal').modal('show')
break
$('#myModal').modal('show');
break;
case "login":
$('#settingLoginModal').modal('show')
break
$('#settingLoginModal').modal('show');
break;
case "alertMail":
$('#receiveEmailModal').modal('show')
break
$('#receiveEmailModal').modal('show');
break;
case "whiteIp":
$('#ipWhitelistModal').modal('show')
break
$('#ipWhitelistModal').modal('show');
break;
case "webHook":
$("#webHookModal").modal('show');
break
break;
case "passwdTM":
$("#passwdTMModal").modal('show');
break;
default:
break
}
}

var syncStmpConfig = function () {
var id = $("#trmail ").data("id")
var id = $("#trmail ").data("id");
getSettingInfo(id, function () {
$("#alertEmail").val($("#email").val())
$("#alertPass").val($("#pass").val())
$("#alertHost").val($("#host").val())
$("#alertPort").val($("#port").val())
$("#alertEmail").val($("#email").val());
$("#alertPass").val($("#pass").val());
$("#alertHost").val($("#host").val());
$("#alertPort").val($("#port").val());
})
}
};

var getSettingInfo = function (id, cb) {
$.ajax({
type: "get",
Expand Down Expand Up @@ -273,6 +302,8 @@ <h4 class="modal-title">WebHook Api 设置</h4>
$("#whiteIpList").text(arr.join("\n"));
} else if (arr.length >= 1 && typeStr == "webHook") {
$("#webHookUrl").val(arr[0]);
} else if (arr.length >= 1 && typeStr == "passwdTM") {
$("#passwdTMText").val(arr[0]);
}
if (typeof cb == "function") {
cb()
Expand Down Expand Up @@ -401,22 +432,25 @@ <h4 class="modal-title">WebHook Api 设置</h4>
})
}

function IsURL(str_url) {
var strRegex = '^((https|http|ftp|rtsp|mms)?://)'
+ '?(([0-9a-z_!~*\'().&=+$%-]+: )?[0-9a-z_!~*\'().&=+$%-]+@)?' //ftp的user@
+ '(([0-9]{1,3}.){3}[0-9]{1,3}' // IP形式的URL- 199.194.52.184
+ '|' // 允许IP和DOMAIN(域名)
+ '([0-9a-z_!~*\'()-]+.)*' // 域名- www.
+ '([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].' // 二级域名
+ '[a-z]{2,6})' // first level domain- .com or .museum
+ '(:[0-9]{1,4})?' // 端口- :80
+ '((/?)|' // a slash isn't required if there is no file name
+ '(/[0-9a-z_!~*\'().;?:@&=+$,%#-]+)+/?)$';
var re = new RegExp(strRegex);
if (re.test(str_url)) {
return (true);
} else {
return (false);
}
function updatePasswdTM() {
var params = {
text: $("#passwdTMText").val(),
id: $("#settingId").val()
};
$.ajax({
type: "post",
url: "/post/setting/updatePasswdTM",
data: params
}).success(function (result) {
if (result.code == 200) {
if (!$("#checkbox-" + params.id).prop("checked")) {
$("#checkbox-" + params.id).click()
}
}
$('#passwdTMModal').modal('hide');

}).fail(function (err) {
console.log(err)
})
}
</script>
6 changes: 3 additions & 3 deletions config.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[rpc]
status = 1 # 模式 0关闭 1服务端 2客户端
status = 0 # 模式 0关闭 1服务端 2客户端
addr = 0.0.0.0:7879 # RPC 服务端地址 or 客户端地址
name = Server # 状态1 服务端 名称 状态2 客户端 名称

Expand All @@ -20,7 +20,7 @@ web_url = /api/v1/post/report # WEB蜜罐上报 API
deep_url = /api/v1/post/deep_report # 暗网蜜罐上报 API
plug_url = /api/v1/post/plug_report # 插件蜜罐上报 API
report_key = 9cbf8a4dcb8e30682b927f352d6559a0 # API 上报认证秘钥
query_key = 585e2ba265d965b1929148d0f0e33133 # API 查询认证秘钥
query_key = X85e2ba265d965b1929148d0f0e33133 # API 查询认证秘钥

[plug]
status = 1 # 是否启动 蜜罐插件 0 关闭 1 启动, 需要先启动 API
Expand All @@ -43,7 +43,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]
Expand Down
15 changes: 15 additions & 0 deletions core/alert/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/gin-gonic/gin"
"HFish/error"
"HFish/utils/cache"
"HFish/utils/passwd"
)

func AlertMail(model string, typex string, agent string, ipx string, country string, region string, city string, infox string) {
Expand All @@ -34,6 +35,20 @@ func AlertMail(model string, typex string, agent string, ipx string, country str
city = ""
}

// 判断是否开启脱敏
passwdConfigStatus, _ := cache.Get("PasswdConfigStatus")

if (passwdConfigStatus == "1") {
if (typex == "FTP" || typex == "SSH") {
// 获取脱敏加密字符
passwdConfigInfo, _ := cache.Get("PasswdConfigInfo")

arr := strings.Split(infox, "&&")

infox = arr[0] + "&&" + passwd.Desensitization(arr[1], passwdConfigInfo.(string))
}
}

text := `
<div><b>Hi,上钩了!</b></div>
<div><b><br /></b></div>
Expand Down
20 changes: 0 additions & 20 deletions core/protocol/ftp/graval/MIT-LICENSE

This file was deleted.

93 changes: 0 additions & 93 deletions core/protocol/ftp/graval/README.markdown

This file was deleted.

Loading

0 comments on commit ed6a698

Please sign in to comment.