Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/catalog/config/nucleiconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func (c *Config) IsDebugArgEnabled(arg string) bool {

// parseDebugArgs from string
func (c *Config) parseDebugArgs(data string) {
// use space as seperator instead of commas
// use space as separator instead of commas
tmp := strings.Fields(data)
for _, v := range tmp {
key := v
Expand Down
2 changes: 1 addition & 1 deletion pkg/catalog/loader/remote_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func getRemoteContent(URL string, remoteTemplateDomainList []string, contentType
_ = response.Body.Close()
}()
if response.StatusCode < 200 || response.StatusCode > 299 {
return RemoteContent{Error: fmt.Errorf("get \"%s\": unexpect status %d", URL, response.StatusCode)}
return RemoteContent{Error: fmt.Errorf("get \"%s\": unexpected status %d", URL, response.StatusCode)}
}

scanner := bufio.NewScanner(response.Body)
Expand Down
12 changes: 6 additions & 6 deletions pkg/fuzz/analyzers/time/time_delay.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,37 +61,37 @@ func checkTimingDependency(

var requestsSent []requestsSentMetadata
for requestsLeft > 0 {
isCorrelationPossible, delayRecieved, err := sendRequestAndTestConfidence(regression, highSleepTimeSeconds, requestSender, baselineDelay)
isCorrelationPossible, delayReceived, err := sendRequestAndTestConfidence(regression, highSleepTimeSeconds, requestSender, baselineDelay)
if err != nil {
return false, "", err
}
if !isCorrelationPossible {
return false, "", nil
}
// Check the delay is greater than baseline by seconds requested
if delayRecieved < baselineDelay+float64(highSleepTimeSeconds)*0.8 {
if delayReceived < baselineDelay+float64(highSleepTimeSeconds)*0.8 {
return false, "", nil
}
requestsSent = append(requestsSent, requestsSentMetadata{
delay: highSleepTimeSeconds,
delayReceived: delayRecieved,
delayReceived: delayReceived,
})

isCorrelationPossibleSecond, delayRecievedSecond, err := sendRequestAndTestConfidence(regression, int(DefaultLowSleepTimeSeconds), requestSender, baselineDelay)
isCorrelationPossibleSecond, delayReceivedSecond, err := sendRequestAndTestConfidence(regression, int(DefaultLowSleepTimeSeconds), requestSender, baselineDelay)
if err != nil {
return false, "", err
}
if !isCorrelationPossibleSecond {
return false, "", nil
}
if delayRecievedSecond < baselineDelay+float64(DefaultLowSleepTimeSeconds)*0.8 {
if delayReceivedSecond < baselineDelay+float64(DefaultLowSleepTimeSeconds)*0.8 {
return false, "", nil
}
requestsLeft = requestsLeft - 2

requestsSent = append(requestsSent, requestsSentMetadata{
delay: int(DefaultLowSleepTimeSeconds),
delayReceived: delayRecievedSecond,
delayReceived: delayReceivedSecond,
})
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/fuzz/dataformat/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// and not arrays
//
// TODO: Support arrays + other JSON oddities by
// adding more attirbutes to the map[string]interface{}
// adding more attributes to the map[string]interface{}
type JSON struct{}

var (
Expand Down
20 changes: 10 additions & 10 deletions pkg/fuzz/frequency/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (
// for parameters that are less likely to give results for a rule.
type Tracker struct {
frequencies gcache.Cache
paramOccurenceThreshold int
paramOccurrenceThreshold int

isDebug bool
}

const (
DefaultMaxTrackCount = 10000
DefaultParamOccurenceThreshold = 10
DefaultParamOccurrenceThreshold = 10
)

type cacheItem struct {
Expand All @@ -38,7 +38,7 @@ type cacheItem struct {

// New creates a new frequency tracker with a given maximum
// number of params to track in LRU fashion with a max error threshold
func New(maxTrackCount, paramOccurenceThreshold int) *Tracker {
func New(maxTrackCount, paramOccurrenceThreshold int) *Tracker {
gc := gcache.New(maxTrackCount).ARC().Build()

var isDebug bool
Expand All @@ -48,18 +48,18 @@ func New(maxTrackCount, paramOccurenceThreshold int) *Tracker {
return &Tracker{
isDebug: isDebug,
frequencies: gc,
paramOccurenceThreshold: paramOccurenceThreshold,
paramOccurrenceThreshold: paramOccurrenceThreshold,
}
}

func (t *Tracker) Close() {
t.frequencies.Purge()
}

// MarkParameter marks a parameter as frequently occuring once.
// MarkParameter marks a parameter as frequently occurring once.
//
// The logic requires a parameter to be marked as frequently occuring
// multiple times before it's considered as frequently occuring.
// The logic requires a parameter to be marked as frequently occurring
// multiple times before it's considered as frequently occurring.
func (t *Tracker) MarkParameter(parameter, target, template string) {
normalizedTarget := normalizeTarget(target)
key := getFrequencyKey(parameter, normalizedTarget, template)
Expand All @@ -81,7 +81,7 @@ func (t *Tracker) MarkParameter(parameter, target, template string) {
_ = t.frequencies.Set(key, existingCacheItemValue)
}

// IsParameterFrequent checks if a parameter is frequently occuring
// IsParameterFrequent checks if a parameter is frequently occurring
// in the input with no much results.
func (t *Tracker) IsParameterFrequent(parameter, target, template string) bool {
normalizedTarget := normalizeTarget(target)
Expand All @@ -97,7 +97,7 @@ func (t *Tracker) IsParameterFrequent(parameter, target, template string) bool {
}
existingCacheItemValue := existingCacheItem.(*cacheItem)

if existingCacheItemValue.errors.Load() >= int32(t.paramOccurenceThreshold) {
if existingCacheItemValue.errors.Load() >= int32(t.paramOccurrenceThreshold) {
existingCacheItemValue.Do(func() {
gologger.Verbose().Msgf("[%s] Skipped %s from parameter for %s as found uninteresting %d times", template, parameter, target, existingCacheItemValue.errors.Load())
})
Expand All @@ -106,7 +106,7 @@ func (t *Tracker) IsParameterFrequent(parameter, target, template string) bool {
return false
}

// UnmarkParameter unmarks a parameter as frequently occuring. This carries
// UnmarkParameter unmarks a parameter as frequently occurring. This carries
// more weight and resets the frequency counter for the parameter causing
// it to be checked again. This is done when results are found.
func (t *Tracker) UnmarkParameter(parameter, target, template string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fuzz/parts.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (rule *Rule) executePartComponentOnKV(input *ExecuteRuleInput, payload Valu
return qerr
}

// after building change back to original value to avoid repeating it in furthur requests
// after building change back to original value to avoid repeating it in further requests
if origKey != "" {
err = ruleComponent.SetValue(origKey, types.ToString(origValue)) // change back to previous value for temp
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions pkg/input/formats/testdata/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ paths:
required: true
responses:
'200':
description: Sucessfully created user
description: Successfully created user
content:
application/json:
schema:
Expand Down Expand Up @@ -170,7 +170,7 @@ paths:
required: true
responses:
'200':
description: Sucessfully logged in user
description: Successfully logged in user
content:
application/json:
schema:
Expand Down Expand Up @@ -262,7 +262,7 @@ paths:
example: 'name1'
responses:
'200':
description: Sucessfully deleted user
description: Successfully deleted user
content:
application/json:
schema:
Expand Down Expand Up @@ -331,7 +331,7 @@ paths:
required: true
responses:
'204':
description: Sucessfully updated user email
description: Successfully updated user email
content: {}
'400':
description: Invalid request
Expand Down Expand Up @@ -389,7 +389,7 @@ paths:
required: true
responses:
'204':
description: Sucessfully updated users password
description: Successfully updated users password
content: {}
'400':
description: Invalid request
Expand Down Expand Up @@ -475,7 +475,7 @@ paths:
required: true
responses:
'200':
description: Sucessfully added a book
description: Successfully added a book
content:
application/json:
schema:
Expand Down
2 changes: 1 addition & 1 deletion pkg/installer/versioncheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func UpdateIgnoreFile() error {
}

func doVersionCheck(isSDK bool) error {
// we use global retryablehttp client so its not immeditely gc'd if any references are held
// we use global retryablehttp client so its not immediately gc'd if any references are held
// and according our config we have idle connections which are shown as leaked by goleak in tests
// i.e we close all idle connections after our use and it doesn't affect any other part of the code
defer retryableHttpClient.HTTPClient.CloseIdleConnections()
Expand Down
8 changes: 4 additions & 4 deletions pkg/js/CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Very First before making any type of contribution to javascript runtime in n

## Documentation/Typo Contribution

Most of Javascript API Reference documentation is auto-generated with help of code-generation and [jsdocgen](./devtools/jsdocgen/README.md) and hence any type of documentation contribution are always welcome and can be done by editing [javscript jsdoc](./generated/js/) files
Most of Javascript API Reference documentation is auto-generated with help of code-generation and [jsdocgen](./devtools/jsdocgen/README.md) and hence any type of documentation contribution are always welcome and can be done by editing [javascript jsdoc](./generated/js/) files


## Improving Existing Libraries(aka node_modules)
Expand All @@ -33,7 +33,7 @@ Libraries/node_modules represent adding new protocol or something similar and sh

## Adding Helper Objects/Types/Functions

Helper objects/types/functions can simply be understood as javascript utils to simplify writing javscript and reduce code duplication in javascript templates. Helper functions/objects are divided into two categories
Helper objects/types/functions can simply be understood as javascript utils to simplify writing javascript and reduce code duplication in javascript templates. Helper functions/objects are divided into two categories

### javascript based helpers

Expand All @@ -47,7 +47,7 @@ go based helpers are written in go and can import any go library if required. Mi

### Updating / Publishing Docs

Javscript Protocol Documentation is auto-generated using [jsdoc] and is hosted at [js-proto-docs](https://projectdiscovery.github.io/js-proto-docs/). To update documentation, please follow steps mentioned at [projectdiscovery/js-proto-docs](https://github.com/projectdiscovery/js-proto-docs)
Javascript Protocol Documentation is auto-generated using [jsdoc] and is hosted at [js-proto-docs](https://projectdiscovery.github.io/js-proto-docs/). To update documentation, please follow steps mentioned at [projectdiscovery/js-proto-docs](https://github.com/projectdiscovery/js-proto-docs)


### Go Code Guidelines
Expand All @@ -60,7 +60,7 @@ Javscript Protocol Documentation is auto-generated using [jsdoc] and is hosted a
return false, protocolstate.ErrHostDenied.Msgf(host)
}
```
3. Keep exported package clean. Do not keep unncessary global exports which the consumer of the API doesn't need to know about. Keep only user-exposed API public.
3. Keep exported package clean. Do not keep unnecessary global exports which the consumer of the API doesn't need to know about. Keep only user-exposed API public.
4. Use timeouts and context cancellation when calling Network related stuff. Also make sure to close your connections or provide a mechanism to the user of the API to do so.
5. Always try to return single types from inside javascript with an error like `(IsRDP, error)` instead of returning multiple values `(name, version string, err error)`. The second one will get converted to an array is much harder for consumers to deal with. Instead, try to return `Structures` which will be accessible natively.

Expand Down
2 changes: 1 addition & 1 deletion pkg/js/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

var (
// ErrJSExecDeadline is the error returned when alloted time for script execution exceeds
// ErrJSExecDeadline is the error returned when allotted time for script execution exceeds
ErrJSExecDeadline = errkit.New("js engine execution deadline exceeded").SetKind(errkit.ErrKindDeadline).Build()
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/js/compiler/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func createNewRuntime() *goja.Runtime {
// by default import below modules every time
_ = runtime.Set("console", require.Require(runtime, console.ModuleName))

// Register embedded javacript helpers
// Register embedded javascript helpers
if err := global.RegisterNativeScripts(runtime); err != nil {
gologger.Error().Msgf("Could not register scripts: %s\n", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/js/devtools/tsgen/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (p *EntityParser) Parse() error {
for _, file := range p.syntax {
// Traverse the AST and find all relevant declarations
ast.Inspect(file, func(n ast.Node) bool {
// look for funtions and methods
// look for functions and methods
// and generate entities for them
fn, ok := n.(*ast.FuncDecl)
if ok {
Expand Down
2 changes: 1 addition & 1 deletion pkg/js/generated/ts/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class MySQLClient {


/**
* returns MySQLInfo when fingerpint is successful
* returns MySQLInfo when fingerprint is successful
* @example
* ```javascript
* const mysql = require('nuclei/mysql');
Expand Down
2 changes: 1 addition & 1 deletion pkg/js/global/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func registerAdditionalHelpers(runtime *goja.Runtime) {

func init() {
// these are dummy functions we use trigger documentation generation
// actual definations are in exports.js
// actual definitions are in exports.js
_ = gojs.RegisterFuncWithSignature(nil, gojs.FuncOpts{
Name: "to_json",
Signatures: []string{
Expand Down
2 changes: 1 addition & 1 deletion pkg/js/libs/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ type (
}
)

// returns MySQLInfo when fingerpint is successful
// returns MySQLInfo when fingerprint is successful
// @example
// ```javascript
// const mysql = require('nuclei/mysql');
Expand Down
2 changes: 1 addition & 1 deletion pkg/js/libs/structs/smbexploit.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final.append(packet.bytes());

console.log("Netbios", netbios.hex(), netbios.len());
console.log("Header", header.hex(), header.len());
console.log("Negotation", negotiation.hex(), negotiation.len());
console.log("Negotiation", negotiation.hex(), negotiation.len());
console.log("Packet", final.hex(), final.len());

const c = require("nuclei/libnet");
Expand Down
2 changes: 1 addition & 1 deletion pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func getJSONLogRequestFromError(templatePath, input, requestType string, request
request.Attrs = slog.GroupValue(errX.Attrs()...)
}
}
// check if address slog attr is avaiable in error if set use it
// check if address slog attr is available in error if set use it
if val := errkit.GetAttrValue(requestErr, "address"); val.Any() != nil {
request.Address = val.String()
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/protocols/code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const (
var (
// pythonEnvRegexCompiled is the compiled regex for python environment variables
pythonEnvRegexCompiled = regexp.MustCompile(pythonEnvRegex)
// ErrCodeExecutionDeadline is the error returned when alloted time for script execution exceeds
// ErrCodeExecutionDeadline is the error returned when allotted time for script execution exceeds
ErrCodeExecutionDeadline = errkit.New("code execution deadline exceeded").SetKind(errkit.ErrKindDeadline).Build()
)

Expand Down Expand Up @@ -279,7 +279,7 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa
fmt.Fprintf(sb, "\n%v\n%v\n%v\n", dashes, "Command Output:", dashes)
sb.WriteString(gOutput.DebugData.String())
sb.WriteString("\n")
sb.WriteString("[WRN] Command Output here is stdout+sterr, in response variables they are seperate (use -v -svd flags for more details)")
sb.WriteString("[WRN] Command Output here is stdout+sterr, in response variables they are separate (use -v -svd flags for more details)")
return sb.String()
})
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/protocols/common/generators/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ type aggressionLevelToPayloads struct {

// parsePayloadsWithAggression parses the payloads with the aggression level
//
// Three agression are supported -
// Three aggression are supported -
// - low
// - medium
// - high
//
// low is the default level. If medium is specified, all templates from
// low and medium are executed. Similarly with high, including all templates
// from low, medium, high.
func parsePayloadsWithAggression(name string, v map[interface{}]interface{}, agression string) (map[string]interface{}, error) {
func parsePayloadsWithAggression(name string, v map[interface{}]interface{}, aggression string) (map[string]interface{}, error) {
payloadsLevels := &aggressionLevelToPayloads{}

for k, v := range v {
Expand All @@ -107,7 +107,7 @@ func parsePayloadsWithAggression(name string, v map[interface{}]interface{}, agr
}

payloads := make(map[string]interface{})
switch agression {
switch aggression {
case "low":
payloads[name] = payloadsLevels.Low
case "medium":
Expand All @@ -116,7 +116,7 @@ func parsePayloadsWithAggression(name string, v map[interface{}]interface{}, agr
payloads[name] = append(payloadsLevels.Low, payloadsLevels.Medium...)
payloads[name] = append(payloads[name].([]interface{}), payloadsLevels.High...)
default:
return nil, errors.Errorf("invalid aggression level %s specified for %s", agression, name)
return nil, errors.Errorf("invalid aggression level %s specified for %s", aggression, name)
}
return payloads, nil
}
Expand Down
Loading
Loading