github.com/projectdiscovery/nuclei/v2@v2.9.15/pkg/protocols/common/variables/doc.go (about)

     1  package variables
     2  
     3  // There are total 5 sources of variables
     4  // 1. VariablesMap - Variables defined in the template  (available at Request.options.Variables in protocols)
     5  // 2. PayloadsMap  - Payloads defined in the template   (available at Request.generator in protocols)
     6  // 3. OptionsMap   - Variables passed using CLI Options (+ Env) (available at generators.BuildPayloadFromOptions)
     7  // 4. DynamicMap   - Variables Obtained by extracting data from templates  (available at Request.ExecuteWithResults + merged with previous internalEvent)
     8  // 5. ProtocolMap  - Variables generated by Evaluation Request / Responses of xyz protocol (available in Request.Make)
     9  // 6. ConstantsMap  - Constants defined in the template (available at Request.options.Constants in protocols)
    10  
    11  // As we can tell , all variables sources are not linear i.e why they need to re-evaluated
    12  // consider example
    13  // variables:
    14  //  - name: "username@{{Host}}"
    15  
    16  // Linear Sources (once obtained no need to re-evaluate)
    17  // simply put they don't contain references to other variables
    18  // 1. OptionsMap
    19  // 2. DynamicMap
    20  // 3. ProtocolMap
    21  
    22  // Non-Linear Sources (need to re-evaluate)
    23  // 1. VariablesMap
    24  // 2. PayloadsMap
    25  // Every time Linear Sources are updated , Non-Linear Sources need to be re-evaluated
    26  
    27  // Constants (no need to re-evaluate, should contain only scalars)