mzack 2024-03-07 17:11:52 +01:00
parent 75183c7660
commit 89858a2ec8
5 changed files with 1 additions and 78 deletions

2
go.mod
View File

@ -59,7 +59,6 @@ require (
github.com/aws/aws-sdk-go-v2/credentials v1.13.27
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.72
github.com/aws/aws-sdk-go-v2/service/s3 v1.37.0
github.com/cespare/xxhash/v2 v2.2.0
github.com/charmbracelet/glamour v0.6.0
github.com/denisenkom/go-mssqldb v0.12.3
github.com/ditashi/jsbeautifier-go v0.0.0-20141206144643-2520a8026a9c
@ -125,6 +124,7 @@ require (
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cheggaaa/pb/v3 v3.1.4 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cloudflare/cfssl v1.6.4 // indirect

4
go.sum
View File

@ -828,8 +828,6 @@ github.com/projectdiscovery/gologger v1.1.12 h1:uX/QkQdip4PubJjjG0+uk5DtyAi1ANPJ
github.com/projectdiscovery/gologger v1.1.12/go.mod h1:DI8nywPLERS5mo8QEA9E7gd5HZ3Je14SjJBH3F5/kLw=
github.com/projectdiscovery/gostruct v0.0.2 h1:s8gP8ApugGM4go1pA+sVlPDXaWqNP5BBDDSv7VEdG1M=
github.com/projectdiscovery/gostruct v0.0.2/go.mod h1:H86peL4HKwMXcQQtEa6lmC8FuD9XFt6gkNR0B/Mu5PE=
github.com/projectdiscovery/gozero v0.0.1 h1:f08ZnYlbDZV/TNGDvIXV9s/oB/sAI+HWaSbW4em4aKM=
github.com/projectdiscovery/gozero v0.0.1/go.mod h1:/dHwbly+1lhOX9UreVure4lEe7K4hIHeu/c/wZGNTDo=
github.com/projectdiscovery/gozero v0.0.2-0.20240305085154-99aa5ddb9f98 h1:KKS26wFrlcfPxKDmop+2NmI8HbGn8pgotHJBTh+3R4k=
github.com/projectdiscovery/gozero v0.0.2-0.20240305085154-99aa5ddb9f98/go.mod h1:/dHwbly+1lhOX9UreVure4lEe7K4hIHeu/c/wZGNTDo=
github.com/projectdiscovery/hmap v0.0.40 h1:WGAIXXMY2vbV0ep7Q8s27Up/ejs8Wo1hh5AEhynLfmw=
@ -866,8 +864,6 @@ github.com/projectdiscovery/uncover v1.0.7 h1:ut+2lTuvmftmveqF5RTjMWAgyLj8ltPQC7
github.com/projectdiscovery/uncover v1.0.7/go.mod h1:HFXgm1sRPuoN0D4oATljPIdmbo/EEh1wVuxQqo/dwFE=
github.com/projectdiscovery/useragent v0.0.40 h1:1LUhReSGPkhqsM5n40OOC9dIoNqMGs1dyGFJcOmg2Fo=
github.com/projectdiscovery/useragent v0.0.40/go.mod h1:EvK1x3s948Gtqb/XOahXcauyejCL/rSgy5d1IAvsKT4=
github.com/projectdiscovery/utils v0.0.83-0.20240305000020-ff30de2464cd h1:7AvCjcfZFkYy1Cg7aoA2iqVCuG/n+OHBFWB2ELGNAiI=
github.com/projectdiscovery/utils v0.0.83-0.20240305000020-ff30de2464cd/go.mod h1:67zb3eUa96XlTpWDqnJhe7xVoDbyAwHb7ChkdooiQxQ=
github.com/projectdiscovery/utils v0.0.83-0.20240307145630-4400cc28a42f h1:rryhFp/Ie6HjHAp8X0Ms0Z200f/COFjnH6+hAbF/2CQ=
github.com/projectdiscovery/utils v0.0.83-0.20240307145630-4400cc28a42f/go.mod h1:67zb3eUa96XlTpWDqnJhe7xVoDbyAwHb7ChkdooiQxQ=
github.com/projectdiscovery/wappalyzergo v0.0.112 h1:QPpp5jmj1lqLd5mFdFKQ9VvcYhQNqyU9Mr+IB0US2zA=

View File

@ -55,7 +55,6 @@ import (
"github.com/projectdiscovery/nuclei/v3/pkg/types"
"github.com/projectdiscovery/nuclei/v3/pkg/utils"
"github.com/projectdiscovery/nuclei/v3/pkg/utils/stats"
"github.com/projectdiscovery/nuclei/v3/pkg/utils/storage"
"github.com/projectdiscovery/nuclei/v3/pkg/utils/yaml"
"github.com/projectdiscovery/retryablehttp-go"
ptrutil "github.com/projectdiscovery/utils/ptr"
@ -84,7 +83,6 @@ type Runner struct {
hostErrors hosterrorscache.CacheInterface
resumeCfg *types.ResumeCfg
pprofServer *http.Server
storage *storage.Storage
// pdcp auto-save options
pdcpUploadErrMsg string
//general purpose temporary directory

View File

@ -28,7 +28,6 @@ import (
protocolUtils "github.com/projectdiscovery/nuclei/v3/pkg/protocols/utils"
"github.com/projectdiscovery/nuclei/v3/pkg/types"
"github.com/projectdiscovery/nuclei/v3/pkg/utils"
"github.com/projectdiscovery/nuclei/v3/pkg/utils/storage"
fileutil "github.com/projectdiscovery/utils/file"
osutils "github.com/projectdiscovery/utils/os"
)
@ -78,15 +77,6 @@ func (ie InternalEvent) Set(k string, v interface{}) {
ie[k] = v
}
func (ie InternalEvent) SetWithStorage(k string, v string, storage *storage.Storage) {
if hash, err := storage.SetString(v); err == nil {
ie[k] = hash
} else {
gologger.Print().Msgf("error: %s", err)
ie[k] = v
}
}
// InternalWrappedEvent is a wrapped event with operators result added to it.
type InternalWrappedEvent struct {
// Mutex is internal field which is implicitly used

View File

@ -1,61 +0,0 @@
package storage
import (
"fmt"
"os"
"github.com/cespare/xxhash/v2"
"github.com/projectdiscovery/utils/conversion"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/opt"
)
type Storage struct {
dbPath string
storage *leveldb.DB
}
func New() (*Storage, error) {
storage := &Storage{}
dbPath, err := os.MkdirTemp("", "nuclei-storage-*")
storage.dbPath = dbPath
if err != nil {
return nil, err
}
storage.storage, err = leveldb.OpenFile(dbPath, &opt.Options{})
if err != nil {
return nil, err
}
return storage, nil
}
func (s *Storage) Close() {
s.storage.Close()
os.RemoveAll(s.dbPath)
}
func HashString(v string) uint64 {
return Hash(conversion.Bytes(v))
}
func Hash(v []byte) uint64 {
return xxhash.Sum64(v)
}
func (s *Storage) Get(k uint64) (string, error) {
v, err := s.storage.Get(conversion.Bytes(fmt.Sprint(k)), nil)
return conversion.String(v), err
}
func (s *Storage) SetString(v string) (uint64, error) {
return s.Set(conversion.Bytes(v))
}
func (s *Storage) Set(v []byte) (uint64, error) {
hash := Hash(v)
return hash, s.storage.Put(conversion.Bytes(fmt.Sprint(hash)), v, nil)
}