Benign go Download

github.com/external-secrets/external-secrets/generators/v1/mfa v0.0.0-20260420085006-9be2c268b9f6

Standard Go module definition

Go module C2 client namingimports crypto/hmac

Evidence

Go module C2 client naming go.mod · line 1
1module github.com/external-secrets/external-secrets/generators/v1/mfa
imports encoding/base32 otp_test.go · lines 12–31
12:42… IND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package mfa
18
19import (
20 "encoding/base32"
21 "testing"
22 "time"
23
24 "github.com/stretchr/testify/require"
25)
26
27func TestDefault(t *testing.T) {
28 input := base32.StdEncoding.EncodeToString([]byte("12345678912345678912"))
29 table := map[time.Time]string{
30 time.Date(1970, 1, 1, 0, 0, 59, 0, time.UTC): "016480",
31 …
imports crypto/hmac otp.go · lines 12–38
12:42… IND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package mfa
18
19import (
20 "crypto/hmac"
21 "crypto/sha1" //nolint:gosec // not used for encryption purposes
22 "crypto/sha256"
23 "crypto/sha512"
24 "encoding/base32"
25 "encoding/binary"
26 "errors"
27 "fmt"
28 "hash"
29 "math"
30 "strconv"
31 "strings"
32 "time"
33)
34
⋯4 lines
References an HMAC API otp.go · lines 111–134
111:40… defaults.when.Unix()%defaults.timePeriod
112
113 secretBytes, err := base32.StdEncoding.WithPadding(base32.NoPadding).DecodeString(defaults.token)
114 if err != nil {
115 return "", "", fmt.Errorf("failed to generate OTP code: %w", err)
116 }
117
118 buf := make([]byte, 8)
119 shaFunc, err := getAlgorithmFunction(defaults.algorithm)
120 if err != nil {
121 return "", "", err
122 }
123 mac := hmac.New(shaFunc, secretBytes)
124
125 binary.BigEndian.PutUint64(buf, timer)
126 _, _ = mac.Write(buf)
127 sum := mac.Sum(nil)
128
⋯6 lines
Kubernetes API package import mfa_test.go · lines 12–36
12:42… IND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package mfa
18
19import (
20 "context"
21 "testing"
22
23 "github.com/stretchr/testify/assert"
24 v1 "k8s.io/api/core/v1"
25 apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
26 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27 "sigs.k8s.io/controller-runtime/pkg/client"
28 clientfake "sigs.k8s.io/controller-runtime/pkg/client/fake"
29)
30
31func TestGenerate(t *testing.T) {
32 type args struct {
33 jsonSpec *apiextensions.JSON
34 client client.Client
35 }
36 tests := []s …

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.