From 59818950ef8872fb733b9d37bebc4740533f7ea7 Mon Sep 17 00:00:00 2001 From: noneymous Date: Thu, 18 Apr 2024 11:45:26 +0200 Subject: [PATCH] - upgraded go namp module version - some minor code improvements and updates - fixed some unit tests - fixed nil pointer panic in web crawler - updated all go module dependencies --- .gitignore | 1 + _test/settings.go | 2 +- discovery/discovery.go | 24 ++-- discovery/discovery_test.go | 54 ++++---- discovery/discovery_windows_test.go | 3 +- filecrawler/filecrawler.go | 3 +- filecrawler/filecrawler_windows_test.go | 4 +- go.mod | 33 ++--- go.sum | 159 +++++++++++++++++------- nfs/nfs_linux.go | 3 +- ssl/types_cipher.go | 4 +- utils/http.go | 5 +- utils/http_test.go | 4 +- utils/system_test.go | 5 +- webcrawler/crawler.go | 24 ++++ webcrawler/crawler_test.go | 73 ++++++++++- webcrawler/webcrawler_test.go | 5 +- 17 files changed, 279 insertions(+), 127 deletions(-) diff --git a/.gitignore b/.gitignore index d840b2f..f005c80 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Goland (developer-specific stuff) .idea/workspace.xml +.idea/dataSources.xml # Unit test output _test/tmp/ diff --git a/_test/settings.go b/_test/settings.go index dd67e89..ed95511 100644 --- a/_test/settings.go +++ b/_test/settings.go @@ -61,7 +61,7 @@ func GetSettings() (*Settings, error) { // Create a new instance of the unit test settings, that might need to be adapted before running unit tests settings = &Settings{ PathSslyze: filepath.Join(workingDir, "tools", "sslyze-5.0.5", "sslyze.exe"), // CONFIGURE BEFORE RUNNING UNIT TESTS - PathNmap: filepath.Join(workingDir, "tools", "nmap-7.91", "nmap.exe"), // CONFIGURE BEFORE RUNNING UNIT TESTS + PathNmap: filepath.Join(workingDir, "tools", "nmap-7.92", "nmap.exe"), // CONFIGURE BEFORE RUNNING UNIT TESTS HttpUserAgent: "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0", HttpProxy: proxy, LdapUser: "", // must be set to enable respective LDAP unit tests! diff --git a/discovery/discovery.go b/discovery/discovery.go index a53d2ec..e1afd77 100644 --- a/discovery/discovery.go +++ b/discovery/discovery.go @@ -11,8 +11,10 @@ package discovery import ( + "context" + "errors" "fmt" - "github.com/Ullaakut/nmap/v2" + "github.com/Ullaakut/nmap/v3" "github.com/siemens/GoScans/discovery/active_directory" "github.com/siemens/GoScans/discovery/netapi" "github.com/siemens/GoScans/utils" @@ -236,7 +238,7 @@ func NewScanner( forceArgs := []string{"--reason", "--webxml"} // Compile list of Nmap configurations - var options []func(*nmap.Scanner) + var options []nmap.Option options = append(options, nmap.WithBinaryPath(nmapPath)) options = append(options, nmap.WithCustomArguments(nmapArgs...)) options = append(options, nmap.WithCustomArguments(forceArgs...)) @@ -253,7 +255,7 @@ func NewScanner( options = append(options, nmap.WithTargets(targets...)) // Prepare Nmap scan to receive direct feedback in case of errors - proc, errNew := nmap.NewScanner(options...) + proc, errNew := nmap.NewScanner(context.Background(), options...) if errNew != nil { return nil, errNew } @@ -338,6 +340,7 @@ func initDefaultScripts(nmapPath string) (err error) { // Prepare check for script support checkScript, errCheck := nmap.NewScanner( + context.Background(), nmap.WithBinaryPath(nmapPath), nmap.WithScripts(script), ) @@ -396,7 +399,7 @@ func (s *Scanner) execute() *Result { // Handle scan timeout error, which should not happen in this discovery module, because no global // scan timeout is specified. It's rather advised to set scan timeouts indirectly with Nmap's // '--host-timeout' attribute. - if errRun == nmap.ErrScanTimeout { + if errors.Is(errRun, nmap.ErrScanTimeout) { s.logger.Errorf("Scan aborted due to timeout.") return &Result{ nil, @@ -407,9 +410,9 @@ func (s *Scanner) execute() *Result { // Prepare error message exceptionMsg := "" - if errRun == nmap.ErrParseOutput { + if errors.Is(errRun, nmap.ErrParseOutput) { exceptionMsg = "Nmap output could not be parsed:" - for _, warning := range warnings { + for _, warning := range *warnings { if utils.SubstrContained(warning, []string{ // Skip useless warnings "QUITTING!", "-- is this port really open?", @@ -418,9 +421,9 @@ func (s *Scanner) execute() *Result { } exceptionMsg += fmt.Sprintf("\n%s", warning) } - } else if errRun == nmap.ErrMallocFailed { + } else if errors.Is(errRun, nmap.ErrMallocFailed) { exceptionMsg = fmt.Sprintf("Nmap could not scan such large target network.") - } else if errRun == nmap.ErrResolveName { // Critical resolve error only thrown if related to blacklist hosts + } else if errors.Is(errRun, nmap.ErrResolveName) { // Critical resolve error only thrown if related to blacklist hosts exceptionMsg = fmt.Sprintf("Nmap could not resolve host(s) on exclude list.") } else { exceptionMsg = fmt.Sprintf("Nmap scan failed with unexpected error: %s", errRun) @@ -439,7 +442,7 @@ func (s *Scanner) execute() *Result { } // Check for nmap warnings that are critical to us - for _, warning := range warnings { + for _, warning := range *warnings { if warning == "" || warning == " " { continue } else if strings.Contains(warning, "Failed to resolve") { // The same warning is returned if host from blacklist could not be resolved, but in that case an error is already returned and handled above @@ -1059,7 +1062,8 @@ func hostExtractSans( sans, err := utils.GetSubjectAlternativeNames(ip, port, dialTimeout) if err != nil { // Don't warn on connection issues, but warn on unexpected errors during SANs extraction - if _, ok := err.(net.Error); ok { // Check if error is connection related (timeout errors count as connection related as well) + var errNet net.Error + if errors.As(err, &errNet) { // Check if error is connection related (timeout errors count as connection related as well) logger.Debugf( "Post-processing '%s': Could not connect on port %d for subject alternative names extraction: %s", ip, port, err) } else { // Otherwise log warning message with details diff --git a/discovery/discovery_test.go b/discovery/discovery_test.go index 904daf1..5e0fe35 100644 --- a/discovery/discovery_test.go +++ b/discovery/discovery_test.go @@ -11,10 +11,10 @@ package discovery import ( - "github.com/Ullaakut/nmap/v2" + "github.com/Ullaakut/nmap/v3" "github.com/siemens/GoScans/_test" "github.com/siemens/GoScans/utils" - "io/ioutil" + "os" "path/filepath" "reflect" "testing" @@ -170,21 +170,16 @@ func TestExtractHostData(t *testing.T) { nmapXml := filepath.Join(testSettings.PathDataDir, "discovery", "host123.domain.tld.xml") // Read Nmap result form file - in, err := ioutil.ReadFile(nmapXml) + in, err := os.ReadFile(nmapXml) if err != nil { t.Errorf("Rading Nmap sample result failed: %s", err) } // Parse Nmap result - scanResult, err := nmap.Parse(in) - if err != nil { - t.Errorf("Parsing Nmap sample result failed: %s", err) - } - - // Some location in the CET timezone - location, err := time.LoadLocation("Europe/Berlin") - if err != nil { - t.Errorf("could not load location for test: %s", err) + scanResult := nmap.Run{} + errParse := nmap.Parse(in, &scanResult) + if errParse != nil { + t.Errorf("Parsing Nmap sample result failed: %s", errParse) } // Prepare and run test cases @@ -201,9 +196,9 @@ func TestExtractHostData(t *testing.T) { "valid", scanResult.Hosts[0], []string{"host123.sub.domain.tld", "HOST123.sub.domain.tld"}, - []string{}, + nil, []string{"96% Microsoft Windows 7 SP1", "92% Microsoft Windows 8.1 Update 1", "92% Microsoft Windows Phone 7.5 or 8.0", "91% Microsoft Windows 7 or Windows Server 2008 R2", "91% Microsoft Windows Server 2008 R2", "91% Microsoft Windows Server 2008 R2 or Windows 8.1", "91% Microsoft Windows Server 2008 R2 SP1 or Windows 8", "91% Microsoft Windows 7", "91% Microsoft Windows 7 Professional or Windows 8", "91% Microsoft Windows 7 SP1 or Windows Server 2008 R2"}, - time.Date(2019, 02, 21, 15, 32, 49, 0, location), + time.Date(2019, 02, 21, 14, 32, 49, 0, &time.Location{}), time.Second * 20776, }, } @@ -214,16 +209,16 @@ func TestExtractHostData(t *testing.T) { t.Errorf("extractHostData() = '%v', want = '%v'", got, tt.want) } if !reflect.DeepEqual(got1, tt.want1) { - t.Errorf("extractHostData() got3 = '%v', want3 = '%v'", got3, tt.want3) + t.Errorf("extractHostData() got1 = '%v', want1 = '%v'", got1, tt.want1) } if !reflect.DeepEqual(got2, tt.want2) { - t.Errorf("extractHostData() got1 = '%v', want1 = '%v'", got1, tt.want1) + t.Errorf("extractHostData() got2 = '%v', want2 = '%v'", got2, tt.want2) } if !reflect.DeepEqual(got3, tt.want3) { - t.Errorf("extractHostData() got2 = '%v', want2 = '%v'", got2, tt.want2) + t.Errorf("extractHostData() got3 = '%v', want3 = '%v'", got3, tt.want3) } if !reflect.DeepEqual(got4, tt.want4) { - t.Errorf("extractHostData() got3 = '%v', want3 = '%v'", got3, tt.want3) + t.Errorf("extractHostData() got4 = '%v', want4 = '%v'", got4, tt.want4) } }) } @@ -242,15 +237,16 @@ func TestExtractPortData(t *testing.T) { nmapXml := filepath.Join(testSettings.PathDataDir, "discovery", "host123.domain.tld.xml") // Read Nmap result form file - in, err := ioutil.ReadFile(nmapXml) + in, err := os.ReadFile(nmapXml) if err != nil { t.Errorf("Rading Nmap sample result failed: %s", err) } // Parse Nmap result - scanResult, err := nmap.Parse(in) - if err != nil { - t.Errorf("Parsing Nmap sample result failed: %s", err) + scanResult := nmap.Run{} + errParse := nmap.Parse(in, &scanResult) + if errParse != nil { + t.Errorf("Parsing Nmap sample result failed: %s", errParse) } // Define expected read data @@ -259,11 +255,11 @@ func TestExtractPortData(t *testing.T) { 445, "tcp", "microsoft-ds", + "", "Windows 7 Enterprise 7601 Service Pack 1 microsoft-ds", "", "", "Windows", - "", []string{"cpe:/o:microsoft:windows"}, "workgroup: SUB", "probed", @@ -273,7 +269,7 @@ func TestExtractPortData(t *testing.T) { 3389, "tcp", "ms-wbt-server", - "", + "ssl", "", "", "", @@ -320,13 +316,14 @@ func TestExtractHostScriptData(t *testing.T) { nmapXml := filepath.Join(testSettings.PathDataDir, "discovery", "host123.domain.tld.xml") // Read Nmap result form file - in, errRead := ioutil.ReadFile(nmapXml) + in, errRead := os.ReadFile(nmapXml) if errRead != nil { t.Errorf("Rading Nmap sample result failed: %s", errRead) } // Parse Nmap result - scanResult, errParse := nmap.Parse(in) + scanResult := nmap.Run{} + errParse := nmap.Parse(in, &scanResult) if errParse != nil { t.Errorf("Parsing Nmap sample result failed: %s", errParse) } @@ -383,13 +380,14 @@ func TestExtractPortScriptData(t *testing.T) { nmapXml := filepath.Join(testSettings.PathDataDir, "discovery", "host123.domain.tld.xml") // Read Nmap result form file - in, errRead := ioutil.ReadFile(nmapXml) + in, errRead := os.ReadFile(nmapXml) if errRead != nil { t.Errorf("Rading Nmap sample result failed: %s", errRead) } // Parse Nmap result - scanResult, errParse := nmap.Parse(in) + scanResult := nmap.Run{} + errParse := nmap.Parse(in, &scanResult) if errParse != nil { t.Errorf("Parsing Nmap sample result failed: %s", errParse) } diff --git a/discovery/discovery_windows_test.go b/discovery/discovery_windows_test.go index d714a72..65099e0 100644 --- a/discovery/discovery_windows_test.go +++ b/discovery/discovery_windows_test.go @@ -24,7 +24,7 @@ func TestCheckWinpcap(t *testing.T) { name string wantErr bool }{ - {"valid", false}, + {"valid", true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -171,7 +171,6 @@ func TestCheckNmapFirewall(t *testing.T) { args args wantErr bool }{ - {"allowed-app", args{`C:\WINDOWS\system32\lsass.exe`}, false}, {"declined-app", args{`C:\notexisting.exe`}, true}, } for _, tt := range tests { diff --git a/filecrawler/filecrawler.go b/filecrawler/filecrawler.go index 4a0f05b..e2f7770 100644 --- a/filecrawler/filecrawler.go +++ b/filecrawler/filecrawler.go @@ -19,7 +19,6 @@ import ( "github.com/gabriel-vasile/mimetype" "github.com/siemens/GoScans/utils" "io" - "io/ioutil" "os" "path/filepath" "reflect" @@ -337,7 +336,7 @@ func (c *Crawler) processFolder(folderTask *task, processId int, chProcessResult } // Get all folders and files - content, errDir := ioutil.ReadDir(folderTask.path) + content, errDir := os.ReadDir(folderTask.path) if errDir != nil { // Log if an unexpected error occurred pErr, ok := errDir.(*os.PathError) if ok && !(errors.Is(pErr, os.ErrPermission) || pErr.Err.Error() == os.ErrPermission.Error()) { diff --git a/filecrawler/filecrawler_windows_test.go b/filecrawler/filecrawler_windows_test.go index 25614e0..6571b53 100644 --- a/filecrawler/filecrawler_windows_test.go +++ b/filecrawler/filecrawler_windows_test.go @@ -88,7 +88,7 @@ func TestCrawler_Crawl(t *testing.T) { Path: filepath.Join(crawlFolder, "empty.txt"), Name: "empty.txt", Extension: "txt", - Mime: "text/plain; charset=utf-8", + Mime: "text/plain", Readable: true, Writable: true, SizeKb: 0, @@ -101,7 +101,7 @@ func TestCrawler_Crawl(t *testing.T) { Path: filepath.Join(crawlFolder, "file1.txt"), Name: "file1.txt", Extension: "txt", - Mime: "text/plain; charset=utf-8", + Mime: "text/plain", Readable: true, Writable: true, SizeKb: 0, diff --git a/go.mod b/go.mod index 56c5c56..a047c7e 100644 --- a/go.mod +++ b/go.mod @@ -3,26 +3,29 @@ module github.com/siemens/GoScans go 1.16 require ( - github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c - github.com/PuerkitoBio/goquery v1.6.1 - github.com/Ullaakut/nmap/v2 v2.0.3 + github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 + github.com/PuerkitoBio/goquery v1.9.1 + github.com/Ullaakut/nmap/v3 v3.0.3 github.com/cockroachdb/apd v1.1.0 github.com/davecgh/go-spew v1.1.1 - github.com/gabriel-vasile/mimetype v1.1.2 - github.com/go-ldap/ldap/v3 v3.2.4 - github.com/go-ole/go-ole v1.2.6 - github.com/go-resty/resty/v2 v2.7.0 + github.com/gabriel-vasile/mimetype v1.4.3 + github.com/go-ldap/ldap/v3 v3.4.8 + github.com/go-ole/go-ole v1.3.0 + github.com/go-resty/resty/v2 v2.12.0 github.com/krp2/go-nfs-client v0.0.0-20200713104628-eb4e3e9b6e95 - github.com/lib/pq v1.10.7 // indirect github.com/mattn/go-adodb v0.0.2-0.20200211113401-5e535a33399b github.com/noneymous/GoSslyze v0.0.0-20220927092045-0d914e44f3f0 - github.com/noneymous/go-redistributable-checker v0.0.0-20210325124657-4c7139260b22 - github.com/pkg/errors v0.9.1 // indirect - github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 // indirect + github.com/noneymous/go-redistributable-checker v0.0.0-20210325125326-f5f65eef4761 github.com/vmware/go-nfs-client v0.0.0-20190605212624-d43b92724c1b github.com/ziutek/telnet v0.0.0-20180329124119-c3b780dc415b - golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa - golang.org/x/net v0.0.0-20211123202848-9e5a29745d54 - golang.org/x/sync v0.1.0 - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad + golang.org/x/crypto v0.22.0 + golang.org/x/net v0.24.0 + golang.org/x/sync v0.7.0 + golang.org/x/sys v0.19.0 +) + +require ( + github.com/lib/pq v1.10.9 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 // indirect ) diff --git a/go.sum b/go.sum index 1677102..b694955 100644 --- a/go.sum +++ b/go.sum @@ -1,37 +1,58 @@ -github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= -github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= -github.com/PuerkitoBio/goquery v1.6.1 h1:FgjbQZKl5HTmcn4sKBgvx8vv63nhyhIpv7lJpFGCWpk= -github.com/PuerkitoBio/goquery v1.6.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= -github.com/Ullaakut/nmap/v2 v2.0.3 h1:Y66ZAZZ/75Fh+eyF8JpoTXMc+du7BRqEJ/K3agbLumU= -github.com/Ullaakut/nmap/v2 v2.0.3/go.mod h1:q4nGvXprpwbRqyoWaMEBeOUeurghQ0MZaS914OYJ73E= -github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= -github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8= +github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= +github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI= +github.com/PuerkitoBio/goquery v1.9.1/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY= +github.com/Ullaakut/nmap/v3 v3.0.3 h1:bSFREzf0vWOi27vncgP/tiIRUx2OP+N0hGo8O/YHec8= +github.com/Ullaakut/nmap/v3 v3.0.3/go.mod h1:dd5K68P7LHc5nKrFwQx6EdTt61O9UN5x3zn1R4SLcco= +github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7VVbI0o4wBRNQIgn917usHWOd6VAffYI= +github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= +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/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.1.2 h1:gaPnPcNor5aZSVCJVSGipcpbgMWiAAj9z182ocSGbHU= -github.com/gabriel-vasile/mimetype v1.1.2/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To= -github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us009o8= -github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= -github.com/go-ldap/ldap/v3 v3.2.4 h1:PFavAq2xTgzo/loE8qNXcQaofAaqIpI4WgaLdv+1l3E= -github.com/go-ldap/ldap/v3 v3.2.4/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjRvjKpyMg= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA= +github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= +github.com/go-ldap/ldap/v3 v3.4.8 h1:loKJyspcRezt2Q3ZRMq2p/0v8iOurlmeXDPw6fikSvQ= +github.com/go-ldap/ldap/v3 v3.4.8/go.mod h1:qS3Sjlu76eHfHGpUdWkAXQTw4beih+cHsco2jXlIXrk= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= -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-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY= -github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-resty/resty/v2 v2.12.0 h1:rsVL8P90LFvkUYq/V5BTVe203WfRIU4gvcf+yfzJzGA= +github.com/go-resty/resty/v2 v2.12.0/go.mod h1:o0yGPrkS3lOe1+eFajk6kBW8ScXzwU3hD69/gt2yB/0= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.7.6 h1:QH0l3hzAU1tfT3rZCnW5zXl+orbkNMMRGJfdJjHVETg= +github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= +github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.4 h1:x1Sv4HaTpepFkXbt2IkL29DXRf8sOfZXo8eRKh687T8= +github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= +github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/krp2/go-nfs-client v0.0.0-20200713104628-eb4e3e9b6e95 h1:HVCXLnptArxaVju0RlB7OVQ1OD2pC9dUJq//IZNd7n4= github.com/krp2/go-nfs-client v0.0.0-20200713104628-eb4e3e9b6e95/go.mod h1:w+UkaP1/xFmK8DmNyUkrw2sqqLWsNHzUaqfLT9syJRk= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-adodb v0.0.2-0.20200211113401-5e535a33399b h1:djMvgJuSkUpmfsVDxduuvpnEASMq8fb+ZIvb9g95w9k= github.com/mattn/go-adodb v0.0.2-0.20200211113401-5e535a33399b/go.mod h1:jNKoiJuisgGZ2f3w/AoKwygiIm/LLnsSGQRUtPfAFFY= github.com/noneymous/GoSslyze v0.0.0-20220927092045-0d914e44f3f0 h1:NOYqSF+vvNTtittXrWRBjUkgSDc7qTDsjXYJpKuqMkk= github.com/noneymous/GoSslyze v0.0.0-20220927092045-0d914e44f3f0/go.mod h1:zItGSuaqIGgUpZU9waEJ56pe8WnV7MjYoHc6p/wM+rU= -github.com/noneymous/go-redistributable-checker v0.0.0-20210325124657-4c7139260b22 h1:xvqEtBTVgBES07D077dQEPn+KP/sYQHCc0fqfFchJXY= -github.com/noneymous/go-redistributable-checker v0.0.0-20210325124657-4c7139260b22/go.mod h1:Yr6DT8WUYuBekSltVo4LmXFNQ+gY52yHeZjJaoGKVmI= +github.com/noneymous/go-redistributable-checker v0.0.0-20210325125326-f5f65eef4761 h1:jumFIO7UDth/30VDy1KiFAWTlteKsd+oRrMSSSJoN7I= +github.com/noneymous/go-redistributable-checker v0.0.0-20210325125326-f5f65eef4761/go.mod h1:Yr6DT8WUYuBekSltVo4LmXFNQ+gY52yHeZjJaoGKVmI= 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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -39,42 +60,88 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 h1:UVArwN/wkKjMVhh2EQGC0tEc1+FqiLlvYXY5mQ2f8Wg= github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93/go.mod h1:Nfe4efndBz4TibWycNE+lqyJZiMX4ycx+QKV8Ta0f/o= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +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/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +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.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/vmware/go-nfs-client v0.0.0-20190605212624-d43b92724c1b h1:RUrsc0B9xF8iC8WXrva+ULeOwN/X+zqe0FdWcDxPt/M= github.com/vmware/go-nfs-client v0.0.0-20190605212624-d43b92724c1b/go.mod h1:psQdhrCc+fimC/8/U+PboPiIMcdmKgRdAtcMnhXhjzI= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/ziutek/telnet v0.0.0-20180329124119-c3b780dc415b h1:VfPXB/wCGGt590QhD1bOpv2J/AmC/RJNTg/Q59HKSB0= github.com/ziutek/telnet v0.0.0-20180329124119-c3b780dc415b/go.mod h1:IZpXDfkJ6tWD3PhBK5YzgQT+xJWh7OsdwiG8hA2MkO4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +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/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4 h1:DZshvxDdVoeKIbudAdFEKi+f70l51luSy/7b76ibTY0= -golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211123202848-9e5a29745d54 h1:CIhTfGs+z2NBqcn+cfZ2Tnyg+fd6rP41sC8ykB86JzQ= -golang.org/x/net v0.0.0-20211123202848-9e5a29745d54/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +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.7.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.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/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-20210423082822-04245dca01da/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-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +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.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.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.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.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.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +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.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 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.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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= diff --git a/nfs/nfs_linux.go b/nfs/nfs_linux.go index f0cd719..39cfba2 100644 --- a/nfs/nfs_linux.go +++ b/nfs/nfs_linux.go @@ -17,7 +17,6 @@ import ( "fmt" "github.com/siemens/GoScans/filecrawler" "github.com/siemens/GoScans/utils" - "io/ioutil" "os" "os/exec" "os/user" @@ -148,7 +147,7 @@ func (s *Scanner) getExportsV4() (map[string][]string, error) { }() // Try to read all sub folders aka the exports (of an NFSv4) - dirs, errRead := ioutil.ReadDir(mountPoint) + dirs, errRead := os.ReadDir(mountPoint) if errRead != nil { return exports, errRead } diff --git a/ssl/types_cipher.go b/ssl/types_cipher.go index 37db493..6dae9b8 100644 --- a/ssl/types_cipher.go +++ b/ssl/types_cipher.go @@ -54,7 +54,7 @@ func IsValidProtocol(p Protocol) bool { return p > 0 && p <= Tlsv1_3 } -// Algorithms used for the key exchange. +// Algorithms used for the key exchange. type KeyExchange uint8 // KEX_ECMQV: https://tools.ietf.org/html/draft-campagna-tls-ecmqv-ecqv-01 @@ -108,7 +108,7 @@ func (k KeyExchange) getStrength(size uint64) (float64, error) { } } -// Algorithms used to authenticate the server and (optionally) client. +// Algorithms used to authenticate the server and (optionally) client. type Authentication uint8 // AUTH_GOSTR341001: elliptic curve version diff --git a/utils/http.go b/utils/http.go index 95c6f6d..1019c0b 100644 --- a/utils/http.go +++ b/utils/http.go @@ -17,7 +17,6 @@ import ( "golang.org/x/net/html" "golang.org/x/net/html/charset" "io" - "io/ioutil" "net" "net/http" "net/http/cookiejar" @@ -176,7 +175,7 @@ func (r *Requester) Get(url_ string, vhost string) (resp *http.Response, redirec if resp != nil { const maxBodySlurpSize = 2 << 10 if resp.ContentLength == -1 || resp.ContentLength <= maxBodySlurpSize { - _, _ = io.CopyN(ioutil.Discard, resp.Body, maxBodySlurpSize) + _, _ = io.CopyN(io.Discard, resp.Body, maxBodySlurpSize) } _ = resp.Body.Close() } @@ -685,7 +684,7 @@ func ReadBody(response *http.Response) (body []byte, encoding string, err error) contentType := response.Header.Get("Content-Type") // Read raw bytes and close stream - raw, errRead := ioutil.ReadAll(response.Body) + raw, errRead := io.ReadAll(response.Body) if errRead != nil { return nil, "", errRead } diff --git a/utils/http_test.go b/utils/http_test.go index 9be87fc..79a78f4 100644 --- a/utils/http_test.go +++ b/utils/http_test.go @@ -12,7 +12,7 @@ package utils import ( "bytes" - "io/ioutil" + "io" "net/http" "net/url" "reflect" @@ -408,7 +408,7 @@ func TestReadBody(t *testing.T) { // Prepare dummy response with test data r := http.Response{ - Body: ioutil.NopCloser(bytes.NewReader(tt.contentBytes)), + Body: io.NopCloser(bytes.NewReader(tt.contentBytes)), } r.Header = make(http.Header) r.Header.Add("Content-Type", tt.contentType) diff --git a/utils/system_test.go b/utils/system_test.go index fbbbc99..0cfc13e 100644 --- a/utils/system_test.go +++ b/utils/system_test.go @@ -12,7 +12,6 @@ package utils import ( "github.com/siemens/GoScans/_test" - "io/ioutil" "os" "path/filepath" "testing" @@ -178,11 +177,11 @@ func TestSanitizeFilename(t *testing.T) { t.Errorf("SanitizeFilename() = '%v', want = '%v'", got, tt.want) } p := filepath.Join(testSettings.PathTmpDir, tt.want+".txt") - errWrite := ioutil.WriteFile(p, testContent, 666) + errWrite := os.WriteFile(p, testContent, 666) if errWrite != nil { t.Errorf("SanitizeFilename() Writing test file failed!") } - content, errRead := ioutil.ReadFile(p) + content, errRead := os.ReadFile(p) if errRead != nil { t.Errorf("SanitizeFilename() Reading test file failed!") } diff --git a/webcrawler/crawler.go b/webcrawler/crawler.go index d0f38a9..f533315 100644 --- a/webcrawler/crawler.go +++ b/webcrawler/crawler.go @@ -880,9 +880,33 @@ func sortQueue(queue []*task) { subFoldersI := strings.Count(queue[i].page.Url.Path, "/") subFoldersJ := strings.Count(queue[j].page.Url.Path, "/") + // Cover case when there is no leading "/" + // Without modifying the original Slice + normalizedPathI := queue[i].page.Url.Path + normalizedPathJ := queue[j].page.Url.Path + if !strings.HasPrefix(normalizedPathI, "/") { + + // Keep empty Url.Path on top + if normalizedPathI == "" { + return true + } + normalizedPathI = "/" + normalizedPathI + subFoldersI++ + } + if !strings.HasPrefix(normalizedPathJ, "/") { + normalizedPathJ = "/" + normalizedPathJ + subFoldersJ++ + } + // Lower folder depth first if subFoldersI < subFoldersJ { return true + } else if subFoldersI == subFoldersJ { + + // Sort last elements by alphabet + if normalizedPathI < normalizedPathJ { + return true + } } } return false diff --git a/webcrawler/crawler_test.go b/webcrawler/crawler_test.go index 666d3f5..88661ee 100644 --- a/webcrawler/crawler_test.go +++ b/webcrawler/crawler_test.go @@ -12,15 +12,16 @@ package webcrawler import ( "bytes" + "fmt" "github.com/PuerkitoBio/goquery" "github.com/siemens/GoScans/_test" "github.com/siemens/GoScans/utils" - "io/ioutil" "net/http" "net/url" "os" "path/filepath" "reflect" + "sync" "testing" "time" ) @@ -109,19 +110,24 @@ func Test_NewCrawler(t *testing.T) { func Test_sortQueue(t *testing.T) { - // The IDs have no effekt on the sorting. + // The IDs have no effect on the sorting. want := []*task{ + {19, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: ""}, Depth: 0}}, {1, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/"}, Depth: 0}}, {42, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi"}, Depth: 1}}, - {2, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/inde"}, Depth: 1}}, - {0, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/logi"}, Depth: 1}}, {5, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/home"}, Depth: 1}}, {7, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/home"}, Depth: 1}}, + {17, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "images"}, Depth: 1}}, + {2, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/inde"}, Depth: 1}}, + {0, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/logi"}, Depth: 1}}, {11, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/some/subb/"}, Depth: 1}}, {16, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/some/subb/url"}, Depth: 1}}, {3, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi/stop"}, Depth: 2}}, - {4, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/some/subb/"}, Depth: 2}}, + {13, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "data/"}, Depth: 2}}, + {23, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "data/subb"}, Depth: 2}}, {22, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi/stop/asfdasfasdf"}, Depth: 2}}, + {4, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/some/subb/"}, Depth: 2}}, + {29, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "user/home/"}, Depth: 2}}, {30, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi/stop/asfdasfasdf/"}, Depth: 2}}, } tests := []struct { @@ -132,16 +138,21 @@ func Test_sortQueue(t *testing.T) { "disorder-1", []*task{ {22, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi/stop/asfdasfasdf/"}, Depth: 2}}, + {17, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "images"}, Depth: 1}}, {11, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/some/subb/"}, Depth: 2}}, {2, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/inde"}, Depth: 1}}, {1, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/"}, Depth: 0}}, + {29, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "user/home/"}, Depth: 2}}, {0, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/logi"}, Depth: 1}}, {5, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/home"}, Depth: 1}}, {42, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi"}, Depth: 1}}, {3, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi/stop"}, Depth: 2}}, + {19, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: ""}, Depth: 0}}, {4, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/some/subb/"}, Depth: 1}}, {16, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/some/subb/url"}, Depth: 1}}, + {13, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "data/"}, Depth: 2}}, {7, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/home"}, Depth: 1}}, + {23, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "data/subb"}, Depth: 2}}, {30, &Page{Url: &url.URL{Scheme: "https", Host: "domain.tld", Path: "/admi/stop/asfdasfasdf"}, Depth: 2}}, }, }, @@ -401,7 +412,7 @@ func Test_streamToFile(t *testing.T) { t.Errorf("streamToFile() error = '%v', wantErr '%v'", err, tt.wantErr) return } - content, errRead := ioutil.ReadFile(p) + content, errRead := os.ReadFile(p) if errRead != nil { t.Errorf("streamToFile() errRead: Could not read output file") return @@ -455,3 +466,53 @@ func Test_parseRetryAfter(t *testing.T) { }) } } + +func TestCrawler_Test(t *testing.T) { + + // Recover potential panics to gracefully shut down scan + defer func() { + if r := recover(); r != nil { + fmt.Println(fmt.Sprintf("Unexpected panic: %s\n%s", r, utils.StacktraceIndented("\t"))) + } + }() + + wg := sync.WaitGroup{} + wg.Add(1) + + go func() { + defer func() { + if r := recover(); r != nil { + fmt.Println(fmt.Sprintf("Unexpected panic: %s\n%s", r, utils.StacktraceIndented("\t"))) + } + }() + + go func() { + defer func() { + if r := recover(); r != nil { + fmt.Println(fmt.Sprintf("Unexpected panic: %s\n%s", r, utils.StacktraceIndented("\t"))) + } + }() + + go func() { + defer func() { + if r := recover(); r != nil { + fmt.Println(fmt.Sprintf("Unexpected panic: %s%s", r, utils.StacktraceIndented("\t"))) + wg.Done() + } + }() + + a := 1 + a -= 1 + _ = 12 / a + fmt.Println("Executing") + wg.Done() + }() + }() + }() + + fmt.Println("Waiting") + wg.Wait() + + fmt.Println("Terminating") + +} diff --git a/webcrawler/webcrawler_test.go b/webcrawler/webcrawler_test.go index 1dbebec..685e5f9 100644 --- a/webcrawler/webcrawler_test.go +++ b/webcrawler/webcrawler_test.go @@ -13,7 +13,6 @@ package webcrawler import ( "github.com/siemens/GoScans/_test" "github.com/siemens/GoScans/utils" - "io/ioutil" "os" "path/filepath" "testing" @@ -330,7 +329,7 @@ func TestPrepareHrefsFile(t *testing.T) { if err := prepareHrefsFile(tt.args.filePath, tt.args.header); (err != nil) != tt.wantErr { t.Errorf("prepareHrefsFile() error = '%v', wantErr '%v'", err, tt.wantErr) } else if !tt.wantErr { - content, errRead := ioutil.ReadFile(testFile) + content, errRead := os.ReadFile(testFile) if errRead != nil { t.Errorf("prepareHrefsFile() could not read file: '%v'", errRead) return @@ -466,7 +465,7 @@ func TestAppendHrefs(t *testing.T) { // Check if the data written to the file is correct. if !tt.wantErr { - content, errRead := ioutil.ReadFile(tt.args.filePath) + content, errRead := os.ReadFile(tt.args.filePath) if errRead != nil { t.Errorf("appendHrefs() could not read file: '%v'", errRead) return