Replacing goos with osutils (#3571)

* Replacing goos with osutils

* pleasing his majesty the linter
This commit is contained in:
Mzack9999 2023-04-19 19:30:15 +02:00 committed by GitHub
parent bf08913cd0
commit 978d0bcc23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -25,6 +25,7 @@ import (
"github.com/projectdiscovery/nuclei/v2/pkg/utils/monitor"
errorutil "github.com/projectdiscovery/utils/errors"
fileutil "github.com/projectdiscovery/utils/file"
osutils "github.com/projectdiscovery/utils/os"
)
var (
@ -357,9 +358,9 @@ on extensive configurability, massive extensibility and ease of use.`)
return flagSet
}
// isColorNotAvailable returns true if ascii collored output is not available.
// isColorNotAvailable returns true if ascii colored output is not available.
func isColorNotAvailable() bool {
return runtime.GOOS == "windows"
return osutils.IsWindows()
}
// cleanupOldResumeFiles cleans up resume files older than 10 days.

View File

@ -3,10 +3,10 @@ package generators
import (
"os"
"path/filepath"
"runtime"
"testing"
"github.com/projectdiscovery/nuclei/v2/pkg/catalog/disk"
osutils "github.com/projectdiscovery/utils/os"
"github.com/stretchr/testify/require"
)
@ -37,7 +37,7 @@ func TestLoadPayloads(t *testing.T) {
require.Equal(t, map[string][]string{"new": {"test", "another"}}, values, "could not get values")
})
t.Run("no-sandbox-unix", func(t *testing.T) {
if runtime.GOOS == "windows" {
if osutils.IsWindows() {
return
}
_, err := generator.loadPayloads(map[string]interface{}{

View File

@ -4,7 +4,6 @@ import (
"fmt"
"net/http"
"os"
"runtime"
"strings"
"github.com/go-rod/rod"
@ -14,6 +13,7 @@ import (
"github.com/projectdiscovery/nuclei/v2/pkg/types"
fileutil "github.com/projectdiscovery/utils/file"
osutils "github.com/projectdiscovery/utils/os"
reflectutil "github.com/projectdiscovery/utils/reflect"
stringsutil "github.com/projectdiscovery/utils/strings"
)
@ -123,7 +123,7 @@ func New(options *types.Options) (*Browser, error) {
func MustDisableSandbox() bool {
// linux with root user needs "--no-sandbox" option
// https://github.com/chromium/chromium/blob/c4d3c31083a2e1481253ff2d24298a1dfe19c754/chrome/test/chromedriver/client/chromedriver.py#L209
return runtime.GOOS == "linux" && os.Geteuid() == 0
return osutils.IsWindows() && os.Geteuid() == 0
}
// SetUserAgent sets custom user agent to the browser