Revert "Support for environment variables with .env file"

This reverts commit 25235523da.
dev
Souvik Hazra 2021-08-02 11:37:37 +05:30
parent 25235523da
commit 250b87aa01
7 changed files with 0 additions and 33 deletions

View File

@ -162,10 +162,6 @@ on extensive configurability, massive extensibility and ease of use.`)
flagSet.IntVar(&options.MetricsPort, "metrics-port", 9092, "port to expose nuclei metrics on"),
)
createGroup(flagSet, "env", "DotEnv",
flagSet.StringVar(&options.DotEnvPath, "env", ".env", "path of .env file to use"),
)
_ = flagSet.Parse()
if cfgFile != "" {

View File

@ -17,7 +17,6 @@ require (
github.com/gosuri/uiprogress v0.0.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.6.8 // indirect
github.com/joho/godotenv v1.3.0 // indirect
github.com/json-iterator/go v1.1.10
github.com/julienschmidt/httprouter v1.3.0
github.com/karlseguin/ccache v2.0.3+incompatible

View File

@ -183,8 +183,6 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/jasonlvhit/gocron v0.0.1 h1:qTt5qF3b3srDjeOIR4Le1LfeyvoYzJlYpqvG7tJX5YU=
github.com/jasonlvhit/gocron v0.0.1/go.mod h1:k9a3TV8VcU73XZxfVHCHWMWF9SOqgoku0/QlY2yvlA4=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=

View File

@ -7,7 +7,6 @@ import (
"os"
"strings"
"github.com/joho/godotenv"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/formatter"
"github.com/projectdiscovery/gologger/levels"
@ -60,13 +59,6 @@ func ParseOptions(options *types.Options) {
if err != nil {
gologger.Fatal().Msgf("Could not initialize protocols: %s\n", err)
}
if len(options.DotEnvPath) > 0 {
err := godotenv.Load(options.DotEnvPath)
if err != nil {
gologger.Warning().Msgf("Failed loading .env file: %s\n", err)
}
}
}
// hasStdin returns true if we have stdin input

View File

@ -7,7 +7,6 @@ import (
"net"
"net/http"
"net/url"
"os"
"regexp"
"strings"
"time"
@ -130,19 +129,6 @@ func (r *requestGenerator) handleRawWithPayloads(ctx context.Context, rawRequest
// request values.
finalValues := generators.MergeMaps(generatorValues, values)
// read env variables
envVars := strings.Split(strings.Trim(r.request.EnvVars, " "), ",")
if len(envVars) > 0 {
envVarValues := make(map[string]interface{})
for _, envVar := range envVars {
envVarValue := os.Getenv(envVar)
if len(envVarValue) > 0 {
envVarValues[envVar] = envVarValue
}
}
finalValues = generators.MergeMaps(finalValues, envVarValues)
}
// Evaulate the expressions for raw request if any.
var err error
rawRequest, err = expressions.Evaluate(rawRequest, finalValues)

View File

@ -73,8 +73,6 @@ type Request struct {
// their history for being matched at the end.
// Currently only works with sequential http requests.
ReqCondition bool `yaml:"req-condition"`
// Dynamic ENV Variables
EnvVars string `yaml:"env-vars"`
}
// GetID returns the unique ID of the request if any.

View File

@ -143,6 +143,4 @@ type Options struct {
UpdateNuclei bool
// NoUpdateTemplates disables checking for nuclei templates updates
NoUpdateTemplates bool
// .env file path
DotEnvPath string
}