From dfbd5c0a568fe8ce2337773f72348e7e2b029484 Mon Sep 17 00:00:00 2001 From: losuler Date: Tue, 2 Mar 2021 13:13:23 +1100 Subject: [PATCH 1/3] Update dependencies --- go.mod | 11 +++++------ go.sum | 26 +++++++++++--------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index f177921..b6057f6 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,10 @@ module github.com/dylanmei/winrmtest +go 1.14 + require ( - github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e // indirect + github.com/antchfx/xpath v1.1.11 // indirect github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 - github.com/kr/pretty v0.1.0 // indirect - github.com/satori/go.uuid v1.2.0 - golang.org/x/net v0.0.0-20190213061140-3a22650c66bd // indirect - golang.org/x/text v0.3.0 // indirect - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b + golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect ) diff --git a/go.sum b/go.sum index 74c6fee..bb24feb 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,13 @@ -github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e h1:ptBAamGVd6CfRsUtyHD+goy2JGhv1QC32v3gqM8mYAM= -github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/antchfx/xpath v1.1.11 h1:WOFtK8TVAjLm3lbgqeP0arlHpvCEeTANeWZ/csPpJkQ= +github.com/antchfx/xpath v1.1.11/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 h1:JaCC8jz0zdMLk2m+qCCVLLLM/PL93p84w4pK3aJWj60= github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd h1:HuTn7WObtcDo9uEEU7rEqL0jYthdXAmZ6PP+meazmaU= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b h1:gQZ0qzfKHQIybLANtM3mBXNUtOfsCFXeTsnBqCsx1KM= +github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From e32b4121efc2e159160bf026a5f4b89dee984d92 Mon Sep 17 00:00:00 2001 From: losuler Date: Tue, 2 Mar 2021 13:41:41 +1100 Subject: [PATCH 2/3] Replace unmaintained and vulnerable satori/go.uuid with gofrs/uuid --- go.mod | 2 +- go.sum | 5 +++-- wsman.go | 4 ++-- wsman_test.go | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index b6057f6..6dc0d12 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,6 @@ go 1.14 require ( github.com/antchfx/xpath v1.1.11 // indirect github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 - github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b + github.com/gofrs/uuid v4.0.0+incompatible golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect ) diff --git a/go.sum b/go.sum index bb24feb..4e78796 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,9 @@ github.com/antchfx/xpath v1.1.11 h1:WOFtK8TVAjLm3lbgqeP0arlHpvCEeTANeWZ/csPpJkQ= github.com/antchfx/xpath v1.1.11/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 h1:JaCC8jz0zdMLk2m+qCCVLLLM/PL93p84w4pK3aJWj60= github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= -github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b h1:gQZ0qzfKHQIybLANtM3mBXNUtOfsCFXeTsnBqCsx1KM= -github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/gofrs/uuid v1.2.0 h1:coDhrjgyJaglxSjxuJdqQSSdUpG3w6p1OwN2od6frBU= +github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/wsman.go b/wsman.go index 35234da..8ed26b3 100644 --- a/wsman.go +++ b/wsman.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/antchfx/xquery/xml" - "github.com/satori/go.uuid" + "github.com/gofrs/uuid" ) type wsman struct { @@ -24,7 +24,7 @@ type command struct { } func (w *wsman) HandleCommand(m MatcherFunc, f CommandFunc) string { - id := uuid.NewV4().String() + id := uuid.Must(uuid.NewV4()).String() w.commands = append(w.commands, &command{ id: id, matcher: m, diff --git a/wsman_test.go b/wsman_test.go index be2df43..fd14897 100644 --- a/wsman_test.go +++ b/wsman_test.go @@ -9,7 +9,7 @@ import ( "testing" xmlquery "github.com/antchfx/xquery/xml" - uuid "github.com/satori/go.uuid" + "github.com/gofrs/uuid" ) func Test_creating_a_shell(t *testing.T) { @@ -96,7 +96,7 @@ func Test_executing_a_regex_command(t *testing.T) { "echo %s >> C:\file.cmd" - `, uuid.NewV4().String()))) + `, uuid.Must(uuid.NewV4()).String()))) w.ServeHTTP(res, req) if res.Code != http.StatusOK { From f647e5c70514e25cd9fec5c3ccb66a731ddd87ec Mon Sep 17 00:00:00 2001 From: losuler Date: Tue, 2 Mar 2021 13:48:22 +1100 Subject: [PATCH 3/3] Replace deprecated and bugged antchfx/xquery with antchfx/xmlquery --- go.mod | 4 +--- go.sum | 27 ++++++++++++++++----------- wsman.go | 2 +- wsman_test.go | 4 ++-- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 6dc0d12..f44758d 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,6 @@ module github.com/dylanmei/winrmtest go 1.14 require ( - github.com/antchfx/xpath v1.1.11 // indirect - github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 + github.com/antchfx/xmlquery v1.3.5 github.com/gofrs/uuid v4.0.0+incompatible - golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect ) diff --git a/go.sum b/go.sum index 4e78796..cf05468 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,19 @@ -github.com/antchfx/xpath v1.1.11 h1:WOFtK8TVAjLm3lbgqeP0arlHpvCEeTANeWZ/csPpJkQ= -github.com/antchfx/xpath v1.1.11/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= -github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0 h1:JaCC8jz0zdMLk2m+qCCVLLLM/PL93p84w4pK3aJWj60= -github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= +github.com/antchfx/xmlquery v1.3.5 h1:I7TuBRqsnfFuL11ruavGm911Awx9IqSdiU6W/ztSmVw= +github.com/antchfx/xmlquery v1.3.5/go.mod h1:64w0Xesg2sTaawIdNqMB+7qaW/bSqkQm+ssPaCMWNnc= +github.com/antchfx/xpath v1.1.10 h1:cJ0pOvEdN/WvYXxvRrzQH9x5QWKpzHacYO8qzCcDYAg= +github.com/antchfx/xpath v1.1.10/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= github.com/gofrs/uuid v1.2.0 h1:coDhrjgyJaglxSjxuJdqQSSdUpG3w6p1OwN2od6frBU= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +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-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/wsman.go b/wsman.go index 8ed26b3..8cfdac8 100644 --- a/wsman.go +++ b/wsman.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/antchfx/xquery/xml" + "github.com/antchfx/xmlquery" "github.com/gofrs/uuid" ) diff --git a/wsman_test.go b/wsman_test.go index fd14897..7802ba3 100644 --- a/wsman_test.go +++ b/wsman_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - xmlquery "github.com/antchfx/xquery/xml" + "github.com/antchfx/xmlquery" "github.com/gofrs/uuid" ) @@ -17,7 +17,7 @@ func Test_creating_a_shell(t *testing.T) { res := httptest.NewRecorder() req, _ := http.NewRequest("POST", "", strings.NewReader(` - + http://schemas.xmlsoap.org/ws/2004/09/transfer/Create