2024-03-01 16:10:18 +03:00
|
|
|
// Warning - This is generated code
|
|
|
|
|
package smb
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"
|
|
|
|
|
|
|
|
|
|
"github.com/zmap/zgrab2/lib/smb/smb"
|
|
|
|
|
)
|
|
|
|
|
|
2025-07-09 14:47:26 -05:00
|
|
|
func memoizedconnectSMBInfoMode(executionId string, host string, port int) (*smb.SMBLog, error) {
|
2024-03-01 16:10:18 +03:00
|
|
|
hash := "connectSMBInfoMode" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
|
|
|
|
|
|
|
|
|
|
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
|
2025-07-09 14:47:26 -05:00
|
|
|
return connectSMBInfoMode(executionId, host, port)
|
2024-03-01 16:10:18 +03:00
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
if value, ok := v.(*smb.SMBLog); ok {
|
|
|
|
|
return value, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil, errors.New("could not convert cached result")
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-09 14:47:26 -05:00
|
|
|
func memoizedlistShares(executionId string, host string, port int, user string, password string) ([]string, error) {
|
2024-03-01 16:10:18 +03:00
|
|
|
hash := "listShares" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(user) + ":" + fmt.Sprint(password)
|
|
|
|
|
|
|
|
|
|
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
|
2025-07-09 14:47:26 -05:00
|
|
|
return listShares(executionId, host, port, user, password)
|
2024-03-01 16:10:18 +03:00
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return []string{}, err
|
|
|
|
|
}
|
|
|
|
|
if value, ok := v.([]string); ok {
|
|
|
|
|
return value, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return []string{}, errors.New("could not convert cached result")
|
|
|
|
|
}
|