From cfbfd6fcd942c7e2c3576d7f18a1738bc192dd70 Mon Sep 17 00:00:00 2001 From: SanJin Date: Fri, 16 Aug 2019 16:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=A4=E4=B8=AA=E8=9C=9C?= =?UTF-8?q?=E7=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.ini | 8 ++++---- core/protocol/httpx/http.go | 4 ++-- go.mod | 2 ++ go.sum | 5 +++++ utils/setting/setting.go | 25 ++++++++++++------------- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/config.ini b/config.ini index 3191647..ce18b16 100644 --- a/config.ini +++ b/config.ini @@ -51,7 +51,7 @@ addr = 0.0.0.0:23 # Telnet 服务端地址 注意端 status = 0 # 是否启动 Ftp 1 启动 0 关闭 addr = 0.0.0.0:21 # Ftp 服务端地址 注意端口冲突 -[memcache] -status = 0 # 是否启动 Memcache 1 启动 0 关闭 -addr = 0.0.0.0:11211 # Memcache 服务端地址 注意端口冲突 -ratelimit = 4 # 每秒响应次数 \ No newline at end of file +#[mem_cache] +#status = 0 # 是否启动 MemCache 1 启动 0 关闭 +#addr = 0.0.0.0:11211 # Memcache 服务端地址 注意端口冲突 +#rate_limit = 4 # 每秒响应次数 \ No newline at end of file diff --git a/core/protocol/httpx/http.go b/core/protocol/httpx/http.go index b7319fe..9f88326 100644 --- a/core/protocol/httpx/http.go +++ b/core/protocol/httpx/http.go @@ -16,7 +16,7 @@ func Start(addr string, proxyUrl string) { if err == nil { gp.Tr.Proxy = http.ProxyURL(&url.URL{ Scheme: pu.Scheme, - Host: pu.Host, + Host: pu.Host, }) } @@ -27,4 +27,4 @@ func Start(addr string, proxyUrl string) { return req, nil }) http.ListenAndServe(addr, gp) -} \ No newline at end of file +} diff --git a/go.mod b/go.mod index a1af813..e2f88f7 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,8 @@ go 1.12 require ( github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 + github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2 + github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 // indirect github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect github.com/gin-gonic/gin v1.4.0 github.com/gliderlabs/ssh v0.2.2 diff --git a/go.sum b/go.sum index fc7bb5d..e596553 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,10 @@ github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+I github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2 h1:aZtFdDNWY/yH86JPR2WX/PN63635VsE/f/nXNPAbYxY= +github.com/elazarl/goproxy v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM= +github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g= @@ -28,6 +32,7 @@ github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/utils/setting/setting.go b/utils/setting/setting.go index da3611b..ce4daac 100644 --- a/utils/setting/setting.go +++ b/utils/setting/setting.go @@ -14,7 +14,6 @@ import ( "HFish/core/protocol/ssh" "HFish/core/protocol/redis" "HFish/core/protocol/mysql" - "HFish/core/protocol/memcache" "HFish/core/protocol/ftp" "HFish/core/protocol/telnet" "HFish/core/rpc/server" @@ -93,6 +92,18 @@ func RunAdmin() http.Handler { } func Run() { + // 启动 MemCache 蜜罐 + //memCacheStatus := conf.Get("mem_cache", "status") + // + //// 判断 MemCache 蜜罐 是否开启 + //if memCacheStatus == "1" { + // memCacheRateLimit := conf.Get("mem_cache", "rate_limit") + // memCacheAddr := conf.Get("mem_cache", "addr") + // go memcache.Start(memCacheAddr, memCacheRateLimit) + //} + + //=========================// + // 启动 FTP 蜜罐 ftpStatus := conf.Get("ftp", "status") @@ -209,18 +220,6 @@ func Run() { //=========================// - // 启动 Memcache 蜜罐 - memcacheStatus := conf.Get("memcache", "status") - memcacheRateLimit := conf.Get("memcache", "ratelimit") - - // 判断 暗网 Web 蜜罐 是否开启 - if memcacheStatus == "1" { - memcacheAddr := conf.Get("memcache", "addr") - go memcache.Start(memcacheAddr, memcacheRateLimit) - } - - //=========================// - // 启动 RPC rpcStatus := conf.Get("rpc", "status")