Added seeding of default math/rand for key selection (#550)

dev
Ice3man 2022-05-28 18:50:08 +05:30 committed by GitHub
parent aa6c83f36e
commit b26811ec4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -4,11 +4,13 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"math/rand"
"os" "os"
"os/user" "os/user"
"path/filepath" "path/filepath"
"reflect" "reflect"
"strings" "strings"
"time"
"github.com/projectdiscovery/fileutil" "github.com/projectdiscovery/fileutil"
"github.com/projectdiscovery/goflags" "github.com/projectdiscovery/goflags"
@ -66,6 +68,9 @@ type Options struct {
// ParseOptions parses the command line flags provided by a user // ParseOptions parses the command line flags provided by a user
func ParseOptions() *Options { func ParseOptions() *Options {
// Seed default random number generator
rand.Seed(time.Now().UnixNano())
// Migrate config to provider config // Migrate config to provider config
if fileutil.FileExists(defaultConfigLocation) && !fileutil.FileExists(defaultProviderConfigLocation) { if fileutil.FileExists(defaultConfigLocation) && !fileutil.FileExists(defaultProviderConfigLocation) {
gologger.Info().Msgf("Detected old %s config file, trying to migrate providers to %s\n", defaultConfigLocation, defaultProviderConfigLocation) gologger.Info().Msgf("Detected old %s config file, trying to migrate providers to %s\n", defaultConfigLocation, defaultProviderConfigLocation)