Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/libs/smb/memo.smb.go
2070 views
1
// Warning - This is generated code
2
package smb
3
4
import (
5
"errors"
6
"fmt"
7
8
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"
9
10
"github.com/zmap/zgrab2/lib/smb/smb"
11
)
12
13
func memoizedconnectSMBInfoMode(executionId string, host string, port int) (*smb.SMBLog, error) {
14
hash := "connectSMBInfoMode" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
15
16
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
17
return connectSMBInfoMode(executionId, host, port)
18
})
19
if err != nil {
20
return nil, err
21
}
22
if value, ok := v.(*smb.SMBLog); ok {
23
return value, nil
24
}
25
26
return nil, errors.New("could not convert cached result")
27
}
28
29
func memoizedlistShares(executionId string, host string, port int, user string, password string) ([]string, error) {
30
hash := "listShares" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(user) + ":" + fmt.Sprint(password)
31
32
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
33
return listShares(executionId, host, port, user, password)
34
})
35
if err != nil {
36
return []string{}, err
37
}
38
if value, ok := v.([]string); ok {
39
return value, nil
40
}
41
42
return []string{}, errors.New("could not convert cached result")
43
}
44
45