MCPcopy Index your code
hub / github.com/SummerSec/SpringExploit / GetCode

Function GetCode

cmd/commons/utils/useragent.go:17–30  ·  view source on GitHub ↗

GetCode 获取一个随机用户唯一编号

(codeLen int)

Source from the content-addressed store, hash-verified

15
16// GetCode 获取一个随机用户唯一编号
17func GetCode(codeLen int) string {
18 // 1. 定义原始字符串
19 rawStr := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
20 // 2. 定义一个buf,并且将buf交给bytes往buf中写数据
21 buf := make([]byte, 0, codeLen)
22 b := bytes.NewBuffer(buf)
23 // 随机从中获取
24 rand.Seed(time.Now().UnixNano())
25 for rawStrLen := len(rawStr); codeLen > 0; codeLen-- {
26 randNum := rand.Intn(rawStrLen)
27 b.WriteByte(rawStr[randNum])
28 }
29 return b.String()
30}

Callers 7

mainFunction · 0.92
SendPocMethod · 0.92
SendPocMethod · 0.92
SendPocMethod · 0.92
SendPocMethod · 0.92
SendPocMethod · 0.92
SetIdMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected