mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-02-02 08:43:09 +08:00
* prototype errkit
* complete errkit implementation
* add cause to all timeouts
* fix request timeout annotation @timeout
* increase responseHeaderTimeout to 8 for stability
* rawhttp error related improvements
* feat: add port status caching
* add port status caching to http
* migrate to new utils/errkit
* remote dialinterface + error cause
* debug dir support using .gitignore debug-*
* make nuclei easy to debug
* debug dir update .gitignore
* temp change (to revert)
* Revert "temp change (to revert)"
This reverts commit d3131f7777.
* use available context instead of new one
* bump fastdialer
* fix hosterrorscache + misc improvements
* add 'address' field in error log
* fix js vague errors + pgwrap driver
* fix max host error + misc updates
* update tests as per changes
* fix request annotation context
* remove closed dialer reference
* fix sdk panic issue
* bump retryablehttp-go,utils,fastdialer
---------
Co-authored-by: Sandeep Singh <sandeep@projectdiscovery.io>
62 lines
1.9 KiB
Go
Executable File
62 lines
1.9 KiB
Go
Executable File
// Warning - This is generated code
|
|
package postgres
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
_ "github.com/projectdiscovery/nuclei/v3/pkg/js/utils/pgwrap"
|
|
|
|
utils "github.com/projectdiscovery/nuclei/v3/pkg/js/utils"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"
|
|
)
|
|
|
|
func memoizedisPostgres(host string, port int) (bool, error) {
|
|
hash := "isPostgres" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
|
|
|
|
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
|
|
return isPostgres(host, port)
|
|
})
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
if value, ok := v.(bool); ok {
|
|
return value, nil
|
|
}
|
|
|
|
return false, errors.New("could not convert cached result")
|
|
}
|
|
|
|
func memoizedexecuteQuery(host string, port int, username string, password string, dbName string, query string) (*utils.SQLResult, error) {
|
|
hash := "executeQuery" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(username) + ":" + fmt.Sprint(password) + ":" + fmt.Sprint(dbName) + ":" + fmt.Sprint(query)
|
|
|
|
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
|
|
return executeQuery(host, port, username, password, dbName, query)
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if value, ok := v.(*utils.SQLResult); ok {
|
|
return value, nil
|
|
}
|
|
|
|
return nil, errors.New("could not convert cached result")
|
|
}
|
|
|
|
func memoizedconnect(host string, port int, username string, password string, dbName string) (bool, error) {
|
|
hash := "connect" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(username) + ":" + fmt.Sprint(password) + ":" + fmt.Sprint(dbName)
|
|
|
|
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
|
|
return connect(host, port, username, password, dbName)
|
|
})
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
if value, ok := v.(bool); ok {
|
|
return value, nil
|
|
}
|
|
|
|
return false, errors.New("could not convert cached result")
|
|
}
|