From 42bf45c2c8ddcceb207329365049a181798df3c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:27:52 +0000 Subject: [PATCH 1/6] chore(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 04fc1985..c9f3b6a3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/google/gopacket v1.1.19 github.com/oschwald/maxminddb-golang v1.12.0 github.com/spf13/viper v1.18.2 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 github.com/tsosunchia/powclient v0.1.4 golang.org/x/net v0.21.0 diff --git a/go.sum b/go.sum index ec113c25..7ebc2d64 100644 --- a/go.sum +++ b/go.sum @@ -67,8 +67,9 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 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.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= 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/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI= From 47612c022d4291d3679e727412abc18b1984db2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 14:08:40 +0000 Subject: [PATCH 2/6] chore(deps): bump softprops/action-gh-release from 1 to 2 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c68a2b4..86581b15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -153,7 +153,7 @@ jobs: dist/${{ env.ASSET_NAME }} - name: Release if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: # 将下述可执行文件 release 上去 draft: true # Release草稿 files: | From 0a750bc6d0a1fce3b0bd2d2807818d904d2d4be3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 14:49:20 +0000 Subject: [PATCH 3/6] chore(deps): bump golang.org/x/net from 0.21.0 to 0.22.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.21.0 to 0.22.0. - [Commits](https://github.com/golang/net/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 04fc1985..c0e2cd99 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 github.com/tsosunchia/powclient v0.1.4 - golang.org/x/net v0.21.0 + golang.org/x/net v0.22.0 golang.org/x/sync v0.6.0 ) @@ -45,6 +45,6 @@ require ( github.com/tidwall/gjson v1.17.1 github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index ec113c25..3dca74c4 100644 --- a/go.sum +++ b/go.sum @@ -92,8 +92,8 @@ golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 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.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= @@ -101,8 +101,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= From cbc511f0975421fa3fb395998db6b63adf79d0ba Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sun, 31 Mar 2024 12:40:19 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=EF=BC=8C=E5=AF=B9=E4=BA=8E?= =?UTF-8?q?FASTTRACE/TESTFILE=E5=8A=9F=E8=83=BD=E5=BA=94=E7=94=A8NO=5FCOLO?= =?UTF-8?q?R=E5=B1=9E=E6=80=A7=EF=BC=8C=E5=AF=B9=E4=BA=8ETESTFILE=E5=BA=94?= =?UTF-8?q?=E7=94=A8IP=E9=9A=90=E5=8C=BF=E5=8A=9F=E8=83=BD=E3=80=82=20=09?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20fast=5Ftrace/fast=5Ft?= =?UTF-8?q?race.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fast_trace/fast_trace.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fast_trace/fast_trace.go b/fast_trace/fast_trace.go index 31d18c63..f1558a1d 100644 --- a/fast_trace/fast_trace.go +++ b/fast_trace/fast_trace.go @@ -3,6 +3,7 @@ package fastTrace import ( "bufio" "fmt" + "github.com/fatih/color" "github.com/nxtrace/NTrace-core/ipgeo" "github.com/nxtrace/NTrace-core/printer" "github.com/nxtrace/NTrace-core/trace" @@ -44,7 +45,10 @@ type IpListElement struct { var oe = false func (f *FastTracer) tracert(location string, ispCollection ISPCollection) { - fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX) + //fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX) + fmt.Fprintf(color.Output, "%s\n", + color.New(color.FgYellow, color.Bold).Sprint("『 "+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) @@ -274,8 +278,14 @@ func testFile(paramsFastTrace ParamsFastTrace, tm bool) { } for _, ip := range ipList { - fmt.Printf("%s『%s』%s\n", printer.YELLOW_PREFIX, ip.Desc, printer.RESET_PREFIX) - fmt.Printf("traceroute to %s, %d hops max, %d byte packets\n", ip.Ip, paramsFastTrace.MaxHops, paramsFastTrace.PktSize) + fmt.Fprintf(color.Output, "%s\n", + color.New(color.FgYellow, color.Bold).Sprint("『 "+ip.Desc+"』"), + ) + if util.EnableHidDstIP == "" { + fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", ip.Ip, paramsFastTrace.MaxHops, paramsFastTrace.PktSize) + } else { + fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", util.HideIPPart(ip.Ip), paramsFastTrace.MaxHops, paramsFastTrace.PktSize) + } var srcAddr string if ip.Version4 { if paramsFastTrace.SrcDev != "" { From c6eb9bbd2ea27fcd516dfc946165f50afb2967af Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 9 Mar 2024 01:02:53 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dft=E6=97=B6=E4=B8=AA?= =?UTF-8?q?=E5=88=AB=E5=9C=B0=E6=96=B9=E6=9C=AA=E5=BA=94=E7=94=A8=E8=89=B2?= =?UTF-8?q?=E5=BD=A9=E5=8F=82=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 交互式变基操作正在进行中;至 cbc511f 最后完成的命令(1 条命令被执行): pick 356e3db 修复ft时个别地方未应用色彩参数的问题 接下来要执行的命令(剩余 1 条命令): pick 9ee7c3f 修正在ECMP网络下的表现 之前ECMP网络可能会导致一次trace的结果来自不同flow(按icmp id区分的策略下),目前id不再携带TTL信息,因此一次trace的id将保持一致。 要提交的变更: 修改: trace/icmp_ipv4.go 修改: trace/icmp_ipv6.go 您在执行将分支 'main' 变基到 'cbc511f' 的操作。 要提交的变更: 修改: fast_trace/fast_trace.go --- fast_trace/fast_trace.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fast_trace/fast_trace.go b/fast_trace/fast_trace.go index f1558a1d..839bf4a6 100644 --- a/fast_trace/fast_trace.go +++ b/fast_trace/fast_trace.go @@ -45,10 +45,7 @@ type IpListElement struct { var oe = false func (f *FastTracer) tracert(location string, ispCollection ISPCollection) { - //fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX) - fmt.Fprintf(color.Output, "%s\n", - color.New(color.FgYellow, color.Bold).Sprint("『 "+location+ispCollection.ISPName+" 』"), - ) + 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) From 190111f6da2c6f088aff7e576b2ad771eda157c6 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 6 Apr 2024 20:00:24 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9C=A8ECMP=E7=BD=91?= =?UTF-8?q?=E7=BB=9C=E4=B8=8B=E7=9A=84=E8=A1=A8=E7=8E=B0=20=E4=B9=8B?= =?UTF-8?q?=E5=89=8DECMP=E7=BD=91=E7=BB=9C=E5=8F=AF=E8=83=BD=E4=BC=9A?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E4=B8=80=E6=AC=A1trace=E7=9A=84=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=9D=A5=E8=87=AA=E4=B8=8D=E5=90=8Cflow=EF=BC=88?= =?UTF-8?q?=E6=8C=89icmp=20id=E5=8C=BA=E5=88=86=E7=9A=84=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E4=B8=8B=EF=BC=89=EF=BC=8C=E7=9B=AE=E5=89=8Did=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E6=90=BA=E5=B8=A6TTL=E4=BF=A1=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E6=AD=A4=E4=B8=80=E6=AC=A1trace=E7=9A=84id=E5=B0=86?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=E3=80=82=20=20=E8=A6=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84=E5=8F=98=E6=9B=B4=EF=BC=9A=20=09?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20trace/icmp=5Fipv4.go?= =?UTF-8?q?=20=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20trace/icmp=5Fip?= =?UTF-8?q?v6.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trace/icmp_ipv4.go | 12 +++++++++--- trace/icmp_ipv6.go | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/trace/icmp_ipv4.go b/trace/icmp_ipv4.go index 54340725..5b9065ec 100644 --- a/trace/icmp_ipv4.go +++ b/trace/icmp_ipv4.go @@ -150,8 +150,9 @@ func (t *ICMPTracer) listenICMP() { } continue } + ttl := int(msg.Msg[36]) packet_id := strconv.FormatInt(int64(binary.BigEndian.Uint16(msg.Msg[32:34])), 2) - if process_id, ttl, err := reverseID(packet_id); err == nil { + if process_id, _, err := reverseID(packet_id); err == nil { if process_id == int64(os.Getpid()&0x7f) { dstip := net.IP(msg.Msg[24:28]) if dstip.Equal(t.DestIP) || dstip.Equal(net.IPv4zero) { @@ -266,15 +267,20 @@ func (t *ICMPTracer) send(ttl int) error { return nil } - id := gernerateID(ttl) + //id := gernerateID(ttl) + id := gernerateID(0) // log.Println("发送的", id) + data := []byte{byte(ttl)} + data = append(data, bytes.Repeat([]byte{1}, t.Config.PktSize-5)...) + data = append(data, 0x00, 0x00, 0x4f, 0xff) + icmpHeader := icmp.Message{ Type: ipv4.ICMPTypeEcho, Code: 0, Body: &icmp.Echo{ ID: id, //Data: []byte("HELLO-R-U-THERE"), - Data: append(bytes.Repeat([]byte{1}, t.Config.PktSize-4), 0x00, 0x00, 0x4f, 0xff), + Data: data, Seq: ttl, }, } diff --git a/trace/icmp_ipv6.go b/trace/icmp_ipv6.go index 7202788e..ecb4a705 100644 --- a/trace/icmp_ipv6.go +++ b/trace/icmp_ipv6.go @@ -171,8 +171,9 @@ func (t *ICMPTracerv6) listenICMP() { } } + ttl := int(msg.Msg[56]) packet_id := strconv.FormatInt(int64(binary.BigEndian.Uint16(msg.Msg[52:54])), 2) - if process_id, ttl, err := reverseID(packet_id); err == nil { + if process_id, _, err := reverseID(packet_id); err == nil { if process_id == int64(os.Getpid()&0x7f) { dstip := net.IP(msg.Msg[32:48]) // 无效包本地环回包 @@ -260,14 +261,19 @@ func (t *ICMPTracerv6) send(ttl int) error { if t.final != -1 && ttl > t.final { return nil } - id := gernerateID(ttl) + //id := gernerateID(ttl) + id := gernerateID(0) + + data := []byte{byte(ttl)} + data = append(data, bytes.Repeat([]byte{1}, t.Config.PktSize-5)...) + data = append(data, 0x00, 0x00, 0x4f, 0xff) icmpHeader := icmp.Message{ Type: ipv6.ICMPTypeEchoRequest, Code: 0, Body: &icmp.Echo{ ID: id, //Data: []byte("HELLO-R-U-THERE"), - Data: append(bytes.Repeat([]byte{1}, t.Config.PktSize-4), 0x00, 0x00, 0x4f, 0xff), + Data: data, Seq: ttl, }, }