Skip to content

Commit b729c0d

Browse files
kmrozioj
authored andcommitted
dga: inject random number (0-9) into random label location
1 parent 487ab0f commit b729c0d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

simulator/dga.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package simulator
33
import (
44
"math/rand"
55
"net"
6+
"strconv"
67
"strings"
78

89
"github.com/alphasoc/flightsim/utils"
@@ -38,7 +39,9 @@ func (t *DGA) Hosts(scope string, size int) ([]string, error) {
3839
labelLen := 7 + rand.Intn(4)
3940

4041
for i := 0; i < size; i++ {
41-
label := strings.ToLower(utils.RandString(labelLen))
42+
tmpLabel := strings.ToLower(utils.RandString(labelLen))
43+
replaceAt := rand.Intn(labelLen)
44+
label := tmpLabel[:replaceAt] + strconv.Itoa(rand.Intn(10)) + tmpLabel[replaceAt+1:]
4245
tld := dgaTLDs[tldIdx[rand.Intn(len(tldIdx))]]
4346
hosts = append(hosts, label+tld)
4447
}

0 commit comments

Comments
 (0)