This commit is contained in:
spiritysdx
2024-06-25 16:41:43 +08:00
commit 467231ddcf
33 changed files with 1560 additions and 0 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

9
.idea/ecs.iml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ecs.iml" filepath="$PROJECT_DIR$/.idea/ecs.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 oneclickvirt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

14
README.md Normal file
View File

@@ -0,0 +1,14 @@
# ecs
- [x] 系统基础信息查询[自研]
- [x] IP基础信息并发查询[自研]
- [x] CPU测试[sysbench、geekbench]
- [x] 内存测试[sysbench、dd]
- [x] 硬盘测试[dd、fio、winsat]
- [x] 御三家流媒体解锁信息并发查询[借鉴 [netflix-verify](https://github.com/sjlleo/netflix-verify) [VerifyDisneyPlus](https://github.com/sjlleo/VerifyDisneyPlus) [TubeCheck](https://github.com/sjlleo/TubeCheck) 二次开发]
- [x] 常见流媒体测试并发查询[自研代码,逻辑借鉴 [RegionRestrictionCheck](https://github.com/lmc999/RegionRestrictionCheck)、[MediaUnlockTest](https://github.com/HsukqiLee/MediaUnlockTest) 并自行修复错漏]
- [x] IP质量/安全信息并发查询[自研]
- [x] 端口测试[自研]
- [x] 三网回程测试[借鉴 [backtrace](https://github.com/zhanghanyun/backtrace) 二次开发]
- [ ] 三网路由测试[借鉴 []() 二次开发]
- [ ] 测试网速[借鉴 []() 二次开发]

9
backtrace/backtrace.go Normal file
View File

@@ -0,0 +1,9 @@
package backtrace
import (
"github.com/oneclickvirt/backtrace/bk"
)
func BcakTrace() {
backtrace.BackTrace()
}

View File

@@ -0,0 +1,20 @@
package backtrace
import (
"testing"
)
//func TestGeneratePrefixMap(t *testing.T) {
// prefix := "223.119.8.0/21"
// prefixList := GeneratePrefixList(prefix)
// if prefixList != nil {
// // 打印生成的IP地址前缀列表
// for _, ip := range prefixList {
// fmt.Println(ip)
// }
// }
//}
func TestBackTrace(t *testing.T) {
BcakTrace()
}

7
basic/basic_test.go Normal file
View File

@@ -0,0 +1,7 @@
package basic
import "testing"
func Test_basic(t *testing.T) {
basic()
}

21
basic/basiccheck.go Normal file
View File

@@ -0,0 +1,21 @@
package basic
import (
"fmt"
"github.com/oneclickvirt/basics/network"
"github.com/oneclickvirt/basics/system"
"strings"
)
// 使用gopsutil查询可能会特别慢执行命令查询反而更快
// TODO
// 迁移Shell的完整检测逻辑使用执行命令的方式查询最后都失败才使用gopsutil查询
func basic() {
language := "zh"
ipInfo, _, _ := network.NetworkCheck("both", false, language)
res := system.CheckSystemInfo(language)
fmt.Println("--------------------------------------------------")
fmt.Printf(strings.ReplaceAll(res+ipInfo, "\n\n", "\n"))
fmt.Println("--------------------------------------------------")
}

11
commediatest/media.go Normal file
View File

@@ -0,0 +1,11 @@
package commediatest
import (
"fmt"
"github.com/oneclickvirt/CommonMediaTests/commediatests"
)
func Media() {
res := commediatests.MediaTests("zh")
fmt.Printf(res)
}

View File

@@ -0,0 +1,9 @@
package commediatest
import (
"testing"
)
func TestMedia(t *testing.T) {
Media()
}

12
cputest/cputest.go Normal file
View File

@@ -0,0 +1,12 @@
package cputest
import (
"fmt"
"github.com/oneclickvirt/cputest/cpu"
)
func cputest() {
//res := cpu.SysBenchTest("zh", "1")
res := cpu.WinsatTest("zh", "1")
fmt.Println(res)
}

9
cputest/cputest_test.go Normal file
View File

@@ -0,0 +1,9 @@
package cputest
import (
"testing"
)
func Test(t *testing.T) {
cputest()
}

35
defaultset/defaultset.go Normal file
View File

@@ -0,0 +1,35 @@
package defaultset
import "fmt"
func Red(text string) string {
return fmt.Sprintf("\033[31m\033[01m%s\033[0m", text)
}
func Green(text string) string {
return fmt.Sprintf("\033[32m\033[01m%s\033[0m", text)
}
func DarkGreen(text string) string {
return fmt.Sprintf("\033[32m\033[02m%s\033[0m", text)
}
func Yellow(text string) string {
return fmt.Sprintf("\033[33m\033[01m%s\033[0m", text)
}
func Blue(text string) string {
return fmt.Sprintf("\033[36m\033[01m%s\033[0m", text)
}
func Purple(text string) string {
return fmt.Sprintf("\033[35m\033[01m%s\033[0m", text)
}
func Cyan(text string) string {
return fmt.Sprintf("\033[36m\033[01m%s\033[0m", text)
}
func White(text string) string {
return fmt.Sprintf("\033[37m\033[01m%s\033[0m", text)
}

40
defaultset/zap.go Normal file
View File

@@ -0,0 +1,40 @@
package defaultset
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var Logger *zap.Logger
func getZapConfig() zap.Config {
cfg := zap.Config{
Encoding: "console", // 日志编码格式
Level: zap.NewAtomicLevelAt(zap.InfoLevel), // 日志级别
OutputPaths: []string{"ecs.log"}, // 输出路径,可以是多个文件
ErrorOutputPaths: []string{}, // 错误输出路径,可以是多个文件
EncoderConfig: zapcore.EncoderConfig{
TimeKey: "timestamp", // 时间字段名称
LevelKey: "level", // 日志级别字段名称
NameKey: "logger", // 日志记录器名称字段名称
CallerKey: "caller", // 调用者信息字段名称
MessageKey: "message", // 日志消息字段名称
StacktraceKey: "stacktrace", // 堆栈跟踪信息字段名称
EncodeLevel: zapcore.LowercaseLevelEncoder, // 小写格式的日志级别编码器
EncodeTime: zapcore.ISO8601TimeEncoder, // ISO8601 时间格式编码器
EncodeCaller: zapcore.ShortCallerEncoder, // 编码短调用者信息
},
}
return cfg
}
// InitLogger 初始化日志记录器
func InitLogger() {
// 配置日志记录器
cfg := getZapConfig()
var err error
Logger, err = cfg.Build()
if err != nil {
panic("failed to initialize logger: " + err.Error())
}
}

24
disktest/disktest.go Normal file
View File

@@ -0,0 +1,24 @@
package disktest
import (
"fmt"
"github.com/oneclickvirt/disktest/disk"
"runtime"
)
func diskIoTest() {
var language, res string
language = "zh"
isMultiCheck := false
if runtime.GOOS == "windows" {
res = disk.WinsatTest(language, isMultiCheck, "")
} else {
res = disk.FioTest(language, isMultiCheck, "")
if res == "" {
res = disk.DDTest(language, isMultiCheck, "")
}
}
fmt.Println("--------------------------------------------------")
fmt.Printf(res)
fmt.Println("--------------------------------------------------")
}

View File

@@ -0,0 +1,7 @@
package disktest
import "testing"
func TestDiskIoTest(t *testing.T) {
diskIoTest()
}

1
ecs.log Normal file
View File

@@ -0,0 +1 @@
2024-04-28T16:19:06.415+0800 info ecs/main.go:12 Start logging

98
go.mod Normal file
View File

@@ -0,0 +1,98 @@
module github.com/oneclickvirt/ecs
go 1.22.4
require (
github.com/PuerkitoBio/goquery v1.9.2
github.com/fatih/color v1.17.0
github.com/gofrs/uuid/v5 v5.2.0
github.com/imroc/req/v3 v3.43.7
github.com/libp2p/go-nat v0.2.0
github.com/nxtrace/NTrace-core v1.3.1
github.com/oneclickvirt/backtrace v0.0.1
github.com/parnurzeal/gorequest v0.3.0
github.com/pion/logging v0.2.2
github.com/pion/stun v0.6.1
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/yusufpapurcu/wmi v1.2.4
go.uber.org/zap v1.27.0
golang.org/x/sys v0.21.0
)
require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/elazarl/goproxy v0.0.0-20240618083138-03be62527ccb // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huin/goupnp v1.2.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/lionsoul2014/ip2region v2.11.2+incompatible // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moul/http2curl v1.0.0 // indirect
github.com/oneclickvirt/CommonMediaTests v0.0.1-20240624094420 // indirect
github.com/oneclickvirt/UnlockTests v0.0.7-20240624115527 // indirect
github.com/oneclickvirt/basics v0.0.3-20240625075226 // indirect
github.com/oneclickvirt/cputest v0.0.2-20240624103336 // indirect
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 // indirect
github.com/oneclickvirt/disktest v0.0.2-20240624145436 // indirect
github.com/oneclickvirt/gostun v0.0.2-20240625025941 // indirect
github.com/oneclickvirt/memorytest v0.0.1-20240624151629 // indirect
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 // indirect
github.com/oneclickvirt/security v0.0.1-20240625075931 // indirect
github.com/onsi/ginkgo/v2 v2.16.0 // indirect
github.com/oschwald/maxminddb-golang v1.12.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect
github.com/pion/stun/v2 v2.0.0 // indirect
github.com/pion/transport/v2 v2.2.1 // indirect
github.com/pion/transport/v3 v3.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.41.0 // indirect
github.com/refraction-networking/utls v1.6.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rodaine/table v1.2.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/schollz/progressbar/v3 v3.14.4 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.18.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.8.0 // indirect
github.com/tsosunchia/powclient v0.1.5 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

301
go.sum Normal file
View File

@@ -0,0 +1,301 @@
github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI=
github.com/PuerkitoBio/goquery v1.9.1/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY=
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/elazarl/goproxy v0.0.0-20240618083138-03be62527ccb h1:2SoxRauy2IqekRMggrQk3yNI5X6omSnk6ugVbFywwXs=
github.com/elazarl/goproxy v0.0.0-20240618083138-03be62527ccb/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gofrs/uuid/v5 v5.2.0 h1:qw1GMx6/y8vhVsx626ImfKMuS5CvJmhIKKtuyvfajMM=
github.com/gofrs/uuid/v5 v5.2.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 h1:y3N7Bm7Y9/CtpiVkw/ZWj6lSlDF3F74SfKwfTCer72Q=
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY=
github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
github.com/imroc/req/v3 v3.43.6 h1:DDbN6sIBfZliQXbtmhAhlPcCDxmx9awthbVKw29dAyQ=
github.com/imroc/req/v3 v3.43.6/go.mod h1:SQIz5iYop16MJxbo8ib+4LnostGCok8NQf8ToyQc2xA=
github.com/imroc/req/v3 v3.43.7 h1:dOcNb9n0X83N5/5/AOkiU+cLhzx8QFXjv5MhikazzQA=
github.com/imroc/req/v3 v3.43.7/go.mod h1:SQIz5iYop16MJxbo8ib+4LnostGCok8NQf8ToyQc2xA=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0=
github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk=
github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk=
github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU=
github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ=
github.com/lionsoul2014/ip2region v2.11.2+incompatible h1:+VRsGcrHz8ewXI/2UzTptJlACsxD/p4xCxuql4u2nKU=
github.com/lionsoul2014/ip2region v2.11.2+incompatible/go.mod h1:+ZBN7PBoh5gG6/y0ZQ85vJDBe21WnfbRrQQwTfliJJI=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
github.com/nxtrace/NTrace-core v1.3.1 h1:f4z5UaZEuhUP/g6xElpZ2bo+guWITJVrMKrJTqd27oc=
github.com/nxtrace/NTrace-core v1.3.1/go.mod h1:0Px/Zc60qk6cssmP+yv4kstFxvX9sXqDduoVqBO+qf8=
github.com/oneclickvirt/CommonMediaTests v0.0.1-20240624085614 h1:S1kVHgMINuLmVqqixY8PJn4W2YyLGGyfguZdwa7opjo=
github.com/oneclickvirt/CommonMediaTests v0.0.1-20240624085614/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/CommonMediaTests v0.0.1-20240624094420 h1:CBsjuTpAtangTNkfLQDWEDPz3VcBjGHd8WCtifCmTlI=
github.com/oneclickvirt/CommonMediaTests v0.0.1-20240624094420/go.mod h1:DAmFPRjFV5p9fEzUUSml5jJGn2f1NZJQCzTxITHDjc4=
github.com/oneclickvirt/UnlockTests v0.0.7-20240624111935 h1:UHaCnGeDOezErrHEsvDeNyfgOEEe9C5M89PccsCha3M=
github.com/oneclickvirt/UnlockTests v0.0.7-20240624111935/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
github.com/oneclickvirt/UnlockTests v0.0.7-20240624115527 h1:rMC+aLDkvOe9K+AXjUt/IMAOx1LieyBv6DN/0/2ww7Q=
github.com/oneclickvirt/UnlockTests v0.0.7-20240624115527/go.mod h1:HP3CvAS+AJWxxY+BVbxIOlvaQ87YOSge89vAMG52b5o=
github.com/oneclickvirt/backtrace v0.0.0-20240624053051-20ee739ddb4a h1:KRPdcDgdB/h01OcKqoZohKfH4Hn18UpPU32ui/2Fapo=
github.com/oneclickvirt/backtrace v0.0.0-20240624053051-20ee739ddb4a/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
github.com/oneclickvirt/backtrace v0.0.1 h1:o4gNgOSqMzt7YUymrKZa7kumB+4cqyOvY6+m64BM7/8=
github.com/oneclickvirt/backtrace v0.0.1/go.mod h1:zvsC7xY/WZqs5KL2JB967OVnuqjNbxu9bW6wXRLo5h8=
github.com/oneclickvirt/basics v0.0.2-20240625031600 h1:VyPNrNvksJlJZSNAPi8VCQLo3ym3UWpKnGl8+SYZ37g=
github.com/oneclickvirt/basics v0.0.2-20240625031600/go.mod h1:dTB+/oyFQYfTYX55rFJVWatum5F9g62zjfmHCM6Vj1s=
github.com/oneclickvirt/basics v0.0.3-20240625075226 h1:K9VriCHIYnXPZXBSn9PRQX+jBS6AIFH8tBVb/i8VGAw=
github.com/oneclickvirt/basics v0.0.3-20240625075226/go.mod h1:dTB+/oyFQYfTYX55rFJVWatum5F9g62zjfmHCM6Vj1s=
github.com/oneclickvirt/cputest v0.0.2-20240624103336 h1:7rrVqE1ODzuItuAXcU1/w4lUOxD7hXXB+c2weoO4eZk=
github.com/oneclickvirt/cputest v0.0.2-20240624103336/go.mod h1:wh4fGT3KFG9qztew5eBL9EfWr8WeZPBLsq60ZzudU4g=
github.com/oneclickvirt/defaultset v0.0.0-20240624051018-30a50859e1b5 h1:TUM6XzOB7Z7OxyXi3fwlZY9KfuVbvUBusYiNbSfX208=
github.com/oneclickvirt/defaultset v0.0.0-20240624051018-30a50859e1b5/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446 h1:5Pg3mK/u/vQvSz7anu0nxzrNdELi/AcDAU1mMsmPzyc=
github.com/oneclickvirt/defaultset v0.0.2-20240624082446/go.mod h1:e9Jt4tf2sbemCtc84/XgKcHy9EZ2jkc5x2sW1NiJS+E=
github.com/oneclickvirt/disktest v0.0.2-20240624145436 h1:c3bt6kB3FKtrMP/tGUIQWTadoiZwP9zcUkaSdsPF9mQ=
github.com/oneclickvirt/disktest v0.0.2-20240624145436/go.mod h1:x7VAJF0Ks05FyE4BI5xedXNKmwbeXfp8GCRALAIlueI=
github.com/oneclickvirt/gostun v0.0.2-20240625025941 h1:h+ZL8jkjXR6QE0qEX34FjWTv89+lNj2fEkWx5Agpgzc=
github.com/oneclickvirt/gostun v0.0.2-20240625025941/go.mod h1:f7DPEXAxbmwXSW33dbxtb0/KzqvOBWhTs2Or5xBerQA=
github.com/oneclickvirt/memorytest v0.0.1-20240624151629 h1:2rJAB3gFGlFPocIb/WRVWYqs4nr2jGYokfDOgqFicD4=
github.com/oneclickvirt/memorytest v0.0.1-20240624151629/go.mod h1:+YNzy+NeVg61d0kNwSyVDqHyVtKzjuRe1NvMzsDLg0I=
github.com/oneclickvirt/portchecker v0.0.1-20240624155429 h1:+wapaOcFrg1iWJDhBKThDzppyIMY7hWxK7F5RBkZg4o=
github.com/oneclickvirt/portchecker v0.0.1-20240624155429/go.mod h1:HQxSTrqM8/QFqHMTBZ7S8H9eEO5FkUXU1eb7ZX5Mk+k=
github.com/oneclickvirt/security v0.0.1-20240625075931 h1:Vj1Wq/JVcqYpfqUWRtsITbz3zM4HxnLC0iPxxA6akP0=
github.com/oneclickvirt/security v0.0.1-20240625075931/go.mod h1:6bjZjpYJ8M3aRIcLP61b0mjYRwvtWbYkvoGjS28Bdy4=
github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM=
github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/oschwald/maxminddb-golang v1.12.0 h1:9FnTOD0YOhP7DGxGsq4glzpGy5+w7pq50AS6wALUMYs=
github.com/oschwald/maxminddb-golang v1.12.0/go.mod h1:q0Nob5lTCqyQ8WT6FYgS1L7PXKVVbgiymefNwIjPzgY=
github.com/parnurzeal/gorequest v0.3.0 h1:SoFyqCDC9COr1xuS6VA8fC8RU7XyrJZN2ona1kEX7FI=
github.com/parnurzeal/gorequest v0.3.0/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8=
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4=
github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8=
github.com/pion/stun/v2 v2.0.0 h1:A5+wXKLAypxQri59+tmQKVs7+l6mMM+3d+eER9ifRU0=
github.com/pion/stun/v2 v2.0.0/go.mod h1:22qRSh08fSEttYUmJZGlriq9+03jtVmXNODgLccj8GQ=
github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c=
github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g=
github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM=
github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/quic-go v0.41.0 h1:aD8MmHfgqTURWNJy48IYFg2OnxwHT3JL7ahGs73lb4k=
github.com/quic-go/quic-go v0.41.0/go.mod h1:qCkNjqczPEvgsOnxZ0eCD14lv+B2LHlFAB++CNOh9hA=
github.com/refraction-networking/utls v1.6.3 h1:MFOfRN35sSx6K5AZNIoESsBuBxS2LCgRilRIdHb6fDc=
github.com/refraction-networking/utls v1.6.3/go.mod h1:yil9+7qSl+gBwJqztoQseO6Pr3h62pQoY1lXiNR/FPs=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rodaine/table v1.2.0 h1:38HEnwK4mKSHQJIkavVj+bst1TEY7j9zhLMWu4QJrMA=
github.com/rodaine/table v1.2.0/go.mod h1:wejb/q/Yd4T/SVmBSRMr7GCq3KlcZp3gyNYdLSBhkaE=
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
github.com/schollz/progressbar/v3 v3.14.4/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY=
github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY=
github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE=
github.com/tsosunchia/powclient v0.1.5 h1:hpixFWoPbWSEC0zc9osSltyjtr1+SnhCueZVLkEpyyU=
github.com/tsosunchia/powclient v0.1.5/go.mod h1:yNlzyq+w9llYZV+0q7nrX83ULy4ghq2mCjpTLJFJ2pg=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

12
main.go Normal file
View File

@@ -0,0 +1,12 @@
package main
import (
. "github.com/oneclickvirt/ecs/defaultset"
)
func main() {
InitLogger()
defer Logger.Sync()
Logger.Info("Start logging")
// Logger.Info("Your log message", zap.Any("key", value))
}

29
memorytest/memorytest.go Normal file
View File

@@ -0,0 +1,29 @@
package memorytest
import (
"fmt"
"github.com/oneclickvirt/memorytest/memory"
"runtime"
)
func memorytest() {
var res string
language := "zh"
testMethod := ""
if runtime.GOOS == "windows" {
res = memory.WinsatTest(language)
} else {
if testMethod == "sysbench" {
res = memory.SysBenchTest(language)
if res == "" {
res = "sysbench test failed, switch to use dd test.\n"
res += memory.DDTest(language)
}
} else if testMethod == "dd" {
res = memory.DDTest(language)
}
}
fmt.Println("--------------------------------------------------")
fmt.Printf(res)
fmt.Println("--------------------------------------------------")
}

View File

@@ -0,0 +1,9 @@
package memorytest
import (
"testing"
)
func Test(t *testing.T) {
memorytest()
}

542
network/network.go Normal file
View File

@@ -0,0 +1,542 @@
package network
import (
"fmt"
"reflect"
"runtime"
"strings"
"sync"
"github.com/oneclickvirt/basics/model"
"github.com/oneclickvirt/basics/network/baseinfo"
"github.com/oneclickvirt/basics/network/utils"
. "github.com/oneclickvirt/defaultset"
"github.com/oneclickvirt/security/network/printhead"
. "github.com/oneclickvirt/security/network/security"
)
// sortAndTranslateText 对原始文本进行排序和翻译
func sortAndTranslateText(orginList []string, language string, fields []string) string {
var result string
for _, key := range fields {
var displayKey string
if language == "zh" {
displayKey = model.TranslationMap[key]
if displayKey == "" {
displayKey = key
}
} else {
displayKey = key
}
for _, line := range orginList {
if strings.Contains(line, key) {
if displayKey == key {
result = result + line + "\n"
} else {
result = result + strings.ReplaceAll(line, key, displayKey) + "\n"
}
break
}
}
}
return result
}
// fetchAndLogInfo 子函数执行和日志记录
func fetchAndLogInfo(wg *sync.WaitGroup, ip string, scorePtr **model.SecurityScore, infoPtr **model.SecurityInfo, fetchFunc func(string) (*model.SecurityScore, *model.SecurityInfo, error)) {
defer wg.Done()
var err error
if scorePtr != nil && *scorePtr != nil && infoPtr != nil && *infoPtr != nil {
*scorePtr, *infoPtr, err = fetchFunc(ip)
} else if scorePtr == nil && infoPtr != nil && *infoPtr != nil {
_, *infoPtr, err = fetchFunc(ip)
} else if scorePtr != nil && *scorePtr != nil && infoPtr == nil {
*scorePtr, _, err = fetchFunc(ip)
}
if err != nil {
if model.EnableLoger {
Logger.Info(fmt.Sprintf("%s: %s", runtime.FuncForPC(reflect.ValueOf(fetchFunc).Pointer()).Name(), err.Error()))
}
}
}
// Ipv4SecurityCheck 检测 ipv4 安全信息和安全得分
func Ipv4SecurityCheck(ipInfo *model.IpInfo, cheervisionInfo *model.SecurityInfo, language string) (string, error) {
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
if ipInfo == nil {
if model.EnableLoger {
Logger.Info("ipv4 is not available")
}
return "", fmt.Errorf("ipv4 is not available")
}
if cheervisionInfo == nil {
if model.EnableLoger {
Logger.Info("ipv4 cheervisionInfo nil")
}
}
var (
ip, temp, orgin, result string
wg sync.WaitGroup
iPInfoIoInfo = &model.SecurityInfo{}
scamalyticsInfo = &model.SecurityInfo{}
abuseipdbInfo = &model.SecurityInfo{}
ip2locationIoInfo = &model.SecurityInfo{}
ipapicomInfo = &model.SecurityInfo{}
ipwhoisioInfo = &model.SecurityInfo{}
ipregistryCoInfo = &model.SecurityInfo{}
ipdataCoInfo = &model.SecurityInfo{}
dbIpComInfo = &model.SecurityInfo{}
ipapiisInfo = &model.SecurityInfo{}
ipapiComInfo = &model.SecurityInfo{}
abstractapiInfo = &model.SecurityInfo{}
ipqualityscoreComInfo = &model.SecurityInfo{}
scamalyticsScore = &model.SecurityScore{}
virustotalScore = &model.SecurityScore{}
abuseipdbScore = &model.SecurityScore{}
dbIpComScore = &model.SecurityScore{}
ipapiisScore = &model.SecurityScore{}
ipdataCoScore = &model.SecurityScore{}
ipapiComScore = &model.SecurityScore{}
ipqualityscoreComScore = &model.SecurityScore{}
)
ip = ipInfo.Ip
wg.Add(14)
go fetchAndLogInfo(&wg, ip, nil, &iPInfoIoInfo, IPInfoIo)
go fetchAndLogInfo(&wg, ip, &scamalyticsScore, &scamalyticsInfo, Scamalytics)
go fetchAndLogInfo(&wg, ip, &virustotalScore, nil, Virustotal)
go fetchAndLogInfo(&wg, ip, &abuseipdbScore, &abuseipdbInfo, Abuseipdb)
go fetchAndLogInfo(&wg, ip, nil, &ip2locationIoInfo, Ip2locationIo)
go fetchAndLogInfo(&wg, ip, nil, &ipapicomInfo, IpApiCom)
go fetchAndLogInfo(&wg, ip, nil, &ipwhoisioInfo, IpwhoisIo)
go fetchAndLogInfo(&wg, ip, nil, &ipregistryCoInfo, IpregistryCo)
go fetchAndLogInfo(&wg, ip, &ipdataCoScore, &ipdataCoInfo, IpdataCo)
go fetchAndLogInfo(&wg, ip, &dbIpComScore, &dbIpComInfo, DbIpCom)
go fetchAndLogInfo(&wg, ip, &ipapiisScore, &ipapiisInfo, Ipapiis)
go fetchAndLogInfo(&wg, ip, &ipapiComScore, &ipapiComInfo, IpapiCom)
go fetchAndLogInfo(&wg, ip, nil, &abstractapiInfo, Abstractapi)
go fetchAndLogInfo(&wg, ip, &ipqualityscoreComScore, &ipqualityscoreComInfo, IpqualityscoreCom)
wg.Wait()
// 构建非空信息
var allScoreList []model.SecurityScore
scorePointers := []*model.SecurityScore{virustotalScore, scamalyticsScore, abuseipdbScore, dbIpComScore,
ipapiisScore, ipapiComScore, ipdataCoScore, ipqualityscoreComScore}
for _, score := range scorePointers {
if score != nil {
allScoreList = append(allScoreList, *score)
}
}
var allInfoList []model.SecurityInfo
infoPointers := []*model.SecurityInfo{iPInfoIoInfo, scamalyticsInfo, abuseipdbInfo, ip2locationIoInfo, ipapicomInfo,
ipwhoisioInfo, ipregistryCoInfo, ipdataCoInfo, dbIpComInfo, ipapiisInfo, ipapiComInfo, abstractapiInfo,
cheervisionInfo, ipqualityscoreComInfo}
for _, info := range infoPointers {
if info != nil {
allInfoList = append(allInfoList, *info)
}
}
// 构建回传的文本内容
temp += FormatSecurityScore(allScoreList)
temp += "\n"
temp += FormatSecurityInfo(allInfoList)
// 分割输入为行
lines := strings.Split(temp, "\n")
// 初始化一个映射用于存储冒号之前的内容及其对应的行数
contentMap := make(map[string][]int)
// 遍历每一行,提取冒号之前的内容及其行数
for i, line := range lines {
// 如果行为空则跳过
if line == "" {
continue
}
// 切割行,以冒号为分隔符
parts := strings.Split(line, ":")
// 获取冒号之前的内容
content := parts[0]
// 将当前行的行号添加到映射中
contentMap[content] = append(contentMap[content], i)
}
// 遍历映射,拼接相同内容的行
for _, lineNumbers := range contentMap {
if len(lineNumbers) > 1 { // 只对有多个行的内容进行拼接
// 初始化一个字符串切片,用于存储拼接后的行
var mergedLines []string
// 遍历相同内容的行 添加当前行到拼接后的行中
for _, lineNumber := range lineNumbers {
if lineNumber == lineNumbers[0] {
mergedLines = append(mergedLines, strings.TrimSpace(lines[lineNumber]))
} else {
mergedLines = append(mergedLines, strings.TrimSpace(strings.Split(lines[lineNumber], ":")[1]))
}
}
// 将拼接后的行以空格连接起来
mergedLine := strings.Join(mergedLines, " ")
// 替换原始行中相同内容的行为拼接后的行,仅替换一次,其他行标注要删除
isMerged := false
for _, lineNumber := range lineNumbers {
if !isMerged {
lines[lineNumber] = mergedLine
isMerged = true
} else {
lines[lineNumber] += "delete"
}
}
}
}
// 删除对应的行,构建原始文本
for _, line := range lines {
if !strings.Contains(line, "delete") {
orgin = orgin + line + "\n"
}
}
orginList := strings.Split(orgin, "\n")
// 将原始文本按要求进行排序和翻译
var score model.SecurityScore
scoreFields := utils.ExtractFieldNames(&score)
var info model.SecurityInfo
infoFields := utils.ExtractFieldNames(&info)
// 拼接安全得分
if language == "zh" {
result += Blue("安全得分:") + "\n"
} else if language == "en" {
result = Blue("Security Score:") + "\n"
}
if len(scoreFields) > 4 {
result += sortAndTranslateText(orginList, language, scoreFields[:len(scoreFields)-4])
} else {
result += sortAndTranslateText(orginList, language, scoreFields)
}
// 安全信息中前三个是字符串类型的得分
result += sortAndTranslateText(orginList, language, infoFields[:3])
// 需要确保后4个属性都为对应属性时才进行说明的拼接
if len(scoreFields) > 4 {
t := ""
foundKeys := 0
for _, key := range scoreFields[len(scoreFields)-4:] {
var displayKey string
if language == "zh" {
displayKey = model.TranslationMap[key]
if displayKey == "" {
displayKey = key
}
} else {
displayKey = key
}
found := false
for _, line := range orginList {
if strings.Contains(line, key) {
key = strings.ReplaceAll(key, ": ", "")
if displayKey == key {
t = t + line + " "
} else {
t = t + strings.ReplaceAll(line, key, displayKey) + " "
}
found = true
break
}
}
if found {
foundKeys++
}
}
if foundKeys == 4 {
if language == "zh" {
result = result + "黑名单记录统计:(有多少黑名单网站有记录):\n" + t + "\n"
} else if language == "en" {
result = result + "Blacklist_Records_Statistics(how many blacklisted websites have records):\n" + t + "\n"
}
}
}
// 拼接安全信息
if language == "zh" {
result += Blue("安全信息:") + "\n"
} else if language == "en" {
result += Blue("Security Info:") + "\n"
}
result += sortAndTranslateText(orginList, language, infoFields[3:])
return result, nil
}
// Ipv6SecurityCheck 检测 ipv4 安全信息和安全得分
func Ipv6SecurityCheck(ipInfo *model.IpInfo, cheervisionInfo *model.SecurityInfo, language string) (string, error) {
if model.EnableLoger {
InitLogger()
defer Logger.Sync()
}
if ipInfo == nil {
if model.EnableLoger {
Logger.Info("ipv6 is not available")
}
return "", fmt.Errorf("ipv6 is not available")
}
if cheervisionInfo == nil {
if model.EnableLoger {
Logger.Info("ipv6 cheervisionInfo nil")
}
}
var (
ip, temp, orgin, result string
wg sync.WaitGroup
scamalyticsInfo = &model.SecurityInfo{}
abuseipdbInfo = &model.SecurityInfo{}
ipapiisInfo = &model.SecurityInfo{}
ipapiComInfo = &model.SecurityInfo{}
scamalyticsScore = &model.SecurityScore{}
abuseipdbScore = &model.SecurityScore{}
ipapiisScore = &model.SecurityScore{}
ipapiComScore = &model.SecurityScore{}
)
ip = ipInfo.Ip
wg.Add(4)
go fetchAndLogInfo(&wg, ip, &scamalyticsScore, &scamalyticsInfo, Scamalytics)
go fetchAndLogInfo(&wg, ip, &abuseipdbScore, &abuseipdbInfo, Abuseipdb)
go fetchAndLogInfo(&wg, ip, &ipapiisScore, &ipapiisInfo, Ipapiis)
go fetchAndLogInfo(&wg, ip, &ipapiComScore, &ipapiComInfo, IpapiComIpv6)
wg.Wait()
// 构建非空信息
var allScoreList []model.SecurityScore
scorePointers := []*model.SecurityScore{scamalyticsScore, abuseipdbScore, ipapiisScore, ipapiComScore}
for _, score := range scorePointers {
if score != nil {
allScoreList = append(allScoreList, *score)
}
}
var allInfoList []model.SecurityInfo
infoPointers := []*model.SecurityInfo{scamalyticsInfo, abuseipdbInfo, ipapiisInfo, ipapiComInfo, cheervisionInfo}
for _, info := range infoPointers {
if info != nil {
allInfoList = append(allInfoList, *info)
}
}
// 构建回传的文本内容
temp += FormatSecurityScore(allScoreList)
temp += "\n"
temp += FormatSecurityInfo(allInfoList)
// 分割输入为行
lines := strings.Split(temp, "\n")
// 初始化一个映射用于存储冒号之前的内容及其对应的行数
contentMap := make(map[string][]int)
// 遍历每一行,提取冒号之前的内容及其行数
for i, line := range lines {
// 如果行为空则跳过
if line == "" {
continue
}
// 切割行,以冒号为分隔符
parts := strings.Split(line, ":")
// 获取冒号之前的内容
content := parts[0]
// 将当前行的行号添加到映射中
contentMap[content] = append(contentMap[content], i)
}
// 遍历映射,拼接相同内容的行
for _, lineNumbers := range contentMap {
if len(lineNumbers) > 1 { // 只对有多个行的内容进行拼接
// 初始化一个字符串切片,用于存储拼接后的行
var mergedLines []string
// 遍历相同内容的行 添加当前行到拼接后的行中
for _, lineNumber := range lineNumbers {
if lineNumber == lineNumbers[0] {
mergedLines = append(mergedLines, strings.TrimSpace(lines[lineNumber]))
} else {
mergedLines = append(mergedLines, strings.TrimSpace(strings.Split(lines[lineNumber], ":")[1]))
}
}
// 将拼接后的行以空格连接起来
mergedLine := strings.Join(mergedLines, " ")
// 替换原始行中相同内容的行为拼接后的行,仅替换一次,其他行标注要删除
isMerged := false
for _, lineNumber := range lineNumbers {
if !isMerged {
lines[lineNumber] = mergedLine
isMerged = true
} else {
lines[lineNumber] += "delete"
}
}
}
}
// 删除对应的行,构建原始文本
for _, line := range lines {
if !strings.Contains(line, "delete") {
orgin = orgin + line + "\n"
}
}
orginList := strings.Split(orgin, "\n")
var score model.SecurityScore
scoreFields := utils.ExtractFieldNames(&score)
var info model.SecurityInfo
infoFields := utils.ExtractFieldNames(&info)
// 拼接安全得分
if language == "zh" {
result += Blue("安全得分:") + "\n"
} else if language == "en" {
result = Blue("Security Score:") + "\n"
}
result += sortAndTranslateText(orginList, language, scoreFields)
result += sortAndTranslateText(orginList, language, infoFields[:3])
// 拼接完整安全信息
if language == "zh" {
result += Blue("安全信息:") + "\n"
} else if language == "en" {
result += Blue("Security Info:") + "\n"
}
result += sortAndTranslateText(orginList, language, infoFields[3:])
return result, nil
}
// processPrintIPInfo 处理IP信息
func processPrintIPInfo(headASNString string, headLocationString string, ipResult *model.IpInfo) string {
var info string
// 处理ASN信息
if ipResult.ASN != "" || ipResult.Org != "" {
info += headASNString
if ipResult.ASN != "" {
info += "AS" + ipResult.ASN
if ipResult.Org != "" {
info += " "
}
}
info += ipResult.Org + "\n"
}
// 处理位置信息
if ipResult.City != "" || ipResult.Region != "" || ipResult.Country != "" {
info += headLocationString
if ipResult.City != "" {
info += ipResult.City + " / "
}
if ipResult.Region != "" {
info += ipResult.Region + " / "
}
if ipResult.Country != "" {
info += ipResult.Country
}
info += "\n"
}
return info
}
// NetworkCheck 查询网络信息
// checkType 可选 both ipv4 ipv6
// enableSecurityCheck 可选 true false
// language 暂时仅支持 en 或 zh
// 回传 ipInfo securityInfo err
func NetworkCheck(checkType string, enableSecurityCheck bool, language string) (string, string, error) {
var ipInfo, securityInfo string
if checkType == "both" {
ipInfoV4Result, cheervisionInfoV4, ipInfoV6Result, cheervisionInfoV6, _ := baseinfo.RunIpCheck("both")
if ipInfoV4Result != nil {
ipInfo += processPrintIPInfo(" IPV4 ASN : ", " IPV4 Location : ", ipInfoV4Result)
}
if ipInfoV6Result != nil {
ipInfo += processPrintIPInfo(" IPV6 ASN : ", " IPV6 Location : ", ipInfoV6Result)
}
// 检测是否需要查询相关安全信息
if enableSecurityCheck {
var (
wg sync.WaitGroup
ipv4Res, ipv6Res, ipv4DNSRes, ipv6DNSRes string
err1, err2 error
)
wg.Add(4)
go func() {
defer wg.Done()
ipv4DNSRes = BlackList(ipInfoV4Result, "ipv4", language)
}()
go func() {
defer wg.Done()
ipv6DNSRes = BlackList(ipInfoV6Result, "ipv6", language)
}()
go func() {
defer wg.Done()
ipv4Res, err1 = Ipv4SecurityCheck(ipInfoV4Result, cheervisionInfoV4, language)
}()
go func() {
defer wg.Done()
ipv6Res, err2 = Ipv6SecurityCheck(ipInfoV6Result, cheervisionInfoV6, language)
}()
wg.Wait()
securityHead, err3 := printhead.PrintDatabaseInfo(language)
if err1 == nil && err2 == nil && err3 == nil {
securityInfo = securityHead + Green("IPV4:") + "\n" + ipv4Res + ipv4DNSRes + Green("IPV6:") + "\n" + ipv6Res + ipv6DNSRes
return ipInfo, securityInfo, nil
} else if err1 == nil && err2 != nil && err3 == nil {
securityInfo = securityHead + Green("IPV4:") + "\n" + ipv4Res + ipv4DNSRes
return ipInfo, securityInfo, nil
} else if err1 != nil && err2 == nil && err3 == nil {
securityInfo = securityHead + Green("IPV6:") + "\n" + ipv6Res + ipv6DNSRes
return ipInfo, securityInfo, nil
} else {
return ipInfo, "", nil
}
} else {
return ipInfo, "", nil
}
} else if checkType == "ipv4" {
ipInfoV4Result, cheervisionInfoV4, _, _, _ := baseinfo.RunIpCheck("ipv4")
if ipInfoV4Result != nil {
ipInfo += processPrintIPInfo(" IPV4 ASN : ", " IPV4 Location : ", ipInfoV4Result)
}
if enableSecurityCheck {
var (
wg sync.WaitGroup
ipv4Res, ipv4DNSRes string
err1 error
)
wg.Add(2)
go func() {
defer wg.Done()
ipv4DNSRes = BlackList(ipInfoV4Result, "ipv4", language)
}()
go func() {
defer wg.Done()
ipv4Res, err1 = Ipv4SecurityCheck(ipInfoV4Result, cheervisionInfoV4, language)
}()
wg.Wait()
securityHead, err2 := printhead.PrintDatabaseInfo(language)
if err1 == nil && err2 == nil {
securityInfo = securityHead + Green("IPV4:") + "\n" + ipv4Res + ipv4DNSRes
return ipInfo, securityInfo, nil
} else {
return ipInfo, "", nil
}
} else {
return ipInfo, "", nil
}
} else if checkType == "ipv6" {
_, _, ipInfoV6Result, cheervisionInfoV6, _ := baseinfo.RunIpCheck("ipv6")
if ipInfoV6Result != nil {
ipInfo += processPrintIPInfo(" IPV6 ASN : ", " IPV6 Location : ", ipInfoV6Result)
}
if enableSecurityCheck {
var (
wg sync.WaitGroup
ipv6Res, ipv6DNSRes string
err1 error
)
wg.Add(2)
go func() {
defer wg.Done()
ipv6DNSRes = BlackList(ipInfoV6Result, "ipv6", language)
}()
go func() {
defer wg.Done()
ipv6Res, err1 = Ipv6SecurityCheck(ipInfoV6Result, cheervisionInfoV6, language)
}()
wg.Wait()
securityHead, err2 := printhead.PrintDatabaseInfo(language)
if err1 == nil && err2 == nil {
securityInfo = securityHead + Green("IPV6:") + "\n" + ipv6Res + ipv6DNSRes
return ipInfo, securityInfo, nil
} else {
return ipInfo, "", nil
}
} else {
return ipInfo, "", nil
}
}
return "", "", fmt.Errorf("wrong in NetworkCheck")
}

22
network/network_test.go Normal file
View File

@@ -0,0 +1,22 @@
package network
import (
"fmt"
"testing"
)
func TestIpv4SecurityCheck(t *testing.T) {
// 单项测试
//result1, _ := Ipv4SecurityCheck("8.8.8.8", nil, "zh")
//fmt.Println(result1)
//result2, _ := Ipv6SecurityCheck("2001:4860:4860::8844", nil, "zh")
//fmt.Println(result2)
// 全项测试
ipInfo, securityInfo, _ := NetworkCheck("both", true, "zh")
fmt.Println("--------------------------------------------------")
fmt.Printf(ipInfo)
fmt.Println("--------------------------------------------------")
fmt.Printf(securityInfo)
fmt.Println("--------------------------------------------------")
}

187
ntrace/ntrace.go Normal file
View File

@@ -0,0 +1,187 @@
package ntrace
import (
"fmt"
"github.com/fatih/color"
"github.com/nxtrace/NTrace-core/fast_trace"
"github.com/nxtrace/NTrace-core/ipgeo"
"github.com/nxtrace/NTrace-core/printer"
"github.com/nxtrace/NTrace-core/trace"
"github.com/nxtrace/NTrace-core/tracelog"
"github.com/nxtrace/NTrace-core/util"
"github.com/nxtrace/NTrace-core/wshandle"
"log"
"os"
"os/signal"
"time"
)
type FastTracer struct {
TracerouteMethod trace.Method
ParamsFastTrace ParamsFastTrace
}
type ParamsFastTrace struct {
SrcDev string
SrcAddr string
BeginHop int
MaxHops int
RDns bool
AlwaysWaitRDNS bool
Lang string
PktSize int
Timeout time.Duration
File string
DontFragment bool
}
type IpListElement struct {
Ip string
Desc string
Version4 bool // true for IPv4, false for IPv6
}
var oe = false
func tracert(f fastTrace.FastTracer, location string, ispCollection fastTrace.ISPCollection) {
fmt.Fprintf(color.Output, "%s\n", color.New(color.FgYellow, color.Bold).Sprintf("『%s %s 』", location, ispCollection.ISPName))
fmt.Printf("traceroute to %s, %d hops max, %d byte packets\n", ispCollection.IP, f.ParamsFastTrace.MaxHops, f.ParamsFastTrace.PktSize)
ip, err := util.DomainLookUp(ispCollection.IP, "4", "", true)
if err != nil {
log.Fatal(err)
}
var conf = trace.Config{
BeginHop: f.ParamsFastTrace.BeginHop,
DestIP: ip,
DestPort: 80,
MaxHops: f.ParamsFastTrace.MaxHops,
NumMeasurements: 3,
ParallelRequests: 18,
RDns: f.ParamsFastTrace.RDns,
AlwaysWaitRDNS: f.ParamsFastTrace.AlwaysWaitRDNS,
PacketInterval: 100,
TTLInterval: 500,
IPGeoSource: ipgeo.GetSource("LeoMoeAPI"),
Timeout: f.ParamsFastTrace.Timeout,
SrcAddr: f.ParamsFastTrace.SrcAddr,
PktSize: f.ParamsFastTrace.PktSize,
Lang: f.ParamsFastTrace.Lang,
DontFragment: f.ParamsFastTrace.DontFragment,
}
if oe {
fp, err := os.OpenFile("/tmp/trace.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, os.ModePerm)
if err != nil {
return
}
defer func(fp *os.File) {
err := fp.Close()
if err != nil {
log.Fatal(err)
}
}(fp)
log.SetOutput(fp)
log.SetFlags(0)
log.Printf("『%s %s 』\n", location, ispCollection.ISPName)
log.Printf("traceroute to %s, %d hops max, %d byte packets\n", ispCollection.IP, f.ParamsFastTrace.MaxHops, f.ParamsFastTrace.PktSize)
conf.RealtimePrinter = tracelog.RealtimePrinter
} else {
conf.RealtimePrinter = printer.RealtimePrinter
}
_, err = trace.Traceroute(f.TracerouteMethod, conf)
if err != nil {
log.Fatal(err)
}
fmt.Println()
}
func tracert_v6(f fastTrace.FastTracer, location string, ispCollection fastTrace.ISPCollection) {
fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX)
fmt.Printf("traceroute to %s, %d hops max, %d byte packets\n", ispCollection.IPv6, f.ParamsFastTrace.MaxHops, f.ParamsFastTrace.PktSize)
ip, err := util.DomainLookUp(ispCollection.IPv6, "6", "", true)
if err != nil {
log.Fatal(err)
}
var conf = trace.Config{
BeginHop: f.ParamsFastTrace.BeginHop,
DestIP: ip,
DestPort: 80,
MaxHops: f.ParamsFastTrace.MaxHops,
NumMeasurements: 3,
ParallelRequests: 18,
RDns: f.ParamsFastTrace.RDns,
AlwaysWaitRDNS: f.ParamsFastTrace.AlwaysWaitRDNS,
PacketInterval: 100,
TTLInterval: 500,
IPGeoSource: ipgeo.GetSource("LeoMoeAPI"),
Timeout: f.ParamsFastTrace.Timeout,
SrcAddr: f.ParamsFastTrace.SrcAddr,
PktSize: f.ParamsFastTrace.PktSize,
Lang: f.ParamsFastTrace.Lang,
DontFragment: f.ParamsFastTrace.DontFragment,
}
if oe {
fp, err := os.OpenFile("/tmp/trace.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, os.ModePerm)
if err != nil {
return
}
defer func(fp *os.File) {
err := fp.Close()
if err != nil {
log.Fatal(err)
}
}(fp)
log.SetOutput(fp)
log.SetFlags(0)
log.Printf("『%s %s 』\n", location, ispCollection.ISPName)
log.Printf("traceroute to %s, %d hops max, %d byte packets\n", ispCollection.IPv6, f.ParamsFastTrace.MaxHops, f.ParamsFastTrace.PktSize)
conf.RealtimePrinter = tracelog.RealtimePrinter
} else {
conf.RealtimePrinter = printer.RealtimePrinter
}
_, err = trace.Traceroute(f.TracerouteMethod, conf)
if err != nil {
log.Fatal(err)
}
fmt.Println()
}
func traceroute() {
pFastTrace := fastTrace.ParamsFastTrace{
SrcDev: "",
SrcAddr: "",
BeginHop: 1,
MaxHops: 30,
RDns: false,
AlwaysWaitRDNS: false,
Lang: "",
PktSize: 52,
}
ft := fastTrace.FastTracer{ParamsFastTrace: pFastTrace}
// 建立 WebSocket 连接
w := wshandle.New()
w.Interrupt = make(chan os.Signal, 1)
signal.Notify(w.Interrupt, os.Interrupt)
defer func() {
w.Conn.Close()
}()
fmt.Println("TCP v4")
ft.TracerouteMethod = trace.TCPTrace
tracert(ft, fastTrace.TestIPsCollection.Beijing.Location, fastTrace.TestIPsCollection.Beijing.EDU)
//fmt.Println("TCP v6")
//tracert_v6(ft, fastTrace.TestIPsCollection.Beijing.Location, fastTrace.TestIPsCollection.Beijing.EDU)
fmt.Println("ICMP v4")
ft.TracerouteMethod = trace.ICMPTrace
tracert(ft, fastTrace.TestIPsCollection.Beijing.Location, fastTrace.TestIPsCollection.Beijing.EDU)
//fmt.Println("ICMP v6")
//tracert_v6(ft, fastTrace.TestIPsCollection.Beijing.Location, fastTrace.TestIPsCollection.Beijing.EDU)
}

8
ntrace/ntrace_test.go Normal file
View File

@@ -0,0 +1,8 @@
package ntrace
import "testing"
// https://github.com/nxtrace/NTrace-core/blob/main/fast_trace/fast_trace.go
func TestTraceRoute(t *testing.T) {
traceroute()
}

12
port/port.go Normal file
View File

@@ -0,0 +1,12 @@
package port
import (
"fmt"
"github.com/oneclickvirt/portchecker/email"
)
// 常用端口阻断检测 TCP/UDP/ICMP 协议
func portcheck() {
res := email.EmailCheck()
fmt.Println(res)
}

9
port/port_test.go Normal file
View File

@@ -0,0 +1,9 @@
package port
import (
"testing"
)
func Test(t *testing.T) {
portcheck()
}

32
unlocktest/media.go Normal file
View File

@@ -0,0 +1,32 @@
package unlocktest
import (
"fmt"
"github.com/oneclickvirt/UnlockTests/utils"
"github.com/oneclickvirt/UnlockTests/uts"
. "github.com/oneclickvirt/ecs/defaultset"
"time"
)
func MediaTest() {
language := "zh"
uts.GetIpv4Info(false)
uts.GetIpv6Info(false)
readStatus := uts.ReadSelect(language, "0")
if !readStatus {
return
}
if language == "zh" {
fmt.Println("测试时间: ", Yellow(time.Now().Format("2006-01-02 15:04:05")))
} else {
fmt.Println("Test time: ", Yellow(time.Now().Format("2006-01-02 15:04:05")))
}
if uts.IPV4 {
//fmt.Println(Blue("IPV4:"))
uts.RunTests(utils.Ipv4HttpClient, "ipv4", language)
}
if uts.IPV6 {
//fmt.Println(Blue("IPV6:"))
uts.RunTests(utils.Ipv6HttpClient, "ipv6", language)
}
}

7
unlocktest/media_test.go Normal file
View File

@@ -0,0 +1,7 @@
package unlocktest
import "testing"
func Test(t *testing.T) {
MediaTest()
}

21
上传所有源码.bat Normal file
View File

@@ -0,0 +1,21 @@
@echo off
setlocal enabledelayedexpansion
set repo_path=C:\Users\spiritlhl\Documents\GoWorks\ecs
git add -A
git commit -am"update"
:push
cd %repo_path%
git push -f origin master
if errorlevel 1 (
echo Push failed. Retrying in 3 seconds...
timeout /nobreak /t 3 >nul
goto push
)
echo Push successful.
endlocal