Skip to content

Commit 4cc75f3

Browse files
committed
Added random chance of char getting set to upper case
1 parent aaa80db commit 4cc75f3

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

computernames.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,19 @@ func getComputerName() string {
4040
func randomString() string {
4141
strLen := getRandomNumberBetween(16, 32)
4242
compName := make([]string, strLen)
43-
var numOrStr int
4443
for x := 0; x < strLen; x++ {
45-
numOrStr = getRandomNumber(2)
44+
numOrStr := getRandomNumber(2)
45+
upperOrLower := getRandomNumber(2)
4646
switch numOrStr {
4747
case 0:
4848
compName[x] = num[getRandomNumber(len(num))]
4949
case 1:
50-
compName[x] = alph[getRandomNumber(len(alph))]
50+
switch upperOrLower {
51+
case 0:
52+
compName[x] = alph[getRandomNumber(len(alph))]
53+
case 1:
54+
compName[x] = strings.ToUpper(alph[getRandomNumber(len(alph))])
55+
}
5156
}
5257
}
5358
return strings.Join(compName, "")

respounder.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ func sendLLMNRProbe(ip net.IP) string {
140140
// 2 byte random transaction id eg. 0x8e53
141141
randomTransactionID := fmt.Sprintf("%04x", rand.Intn(65535))
142142
switch comNameType {
143-
case def:
144-
cName = string(*compPtr)
145-
case newComp:
143+
case def, newComp:
146144
cName = string(*compPtr)
147145
case randCom:
148146
cName = getComputerName()

0 commit comments

Comments
 (0)