(feature string, r *rand.Rand)
| 48 | } |
| 49 | |
| 50 | func generateFeature(feature string, r *rand.Rand) string { |
| 51 | switch feature { |
| 52 | case "<ip>": |
| 53 | return fmt.Sprintf("%d.%d.%d.%d", r.Intn(256), r.Intn(256), r.Intn(256), r.Intn(256)) |
| 54 | case "<base64>": |
| 55 | return base64.StdEncoding.EncodeToString(randomBytes(r, 10)) |
| 56 | case "<uuid>": |
| 57 | return uuid.New().String() |
| 58 | case "<word>": |
| 59 | return randomWord(r) |
| 60 | case "<word-list>": |
| 61 | return randomWordList(r) |
| 62 | case "<method>": |
| 63 | return randomMethod(r) |
| 64 | case "<protocol>": |
| 65 | return randomProtocol(r) |
| 66 | case "<md5>": |
| 67 | return hex.EncodeToString(md5.New().Sum(randomBytes(r, 10))) //nolint:gosec // this is a test tool |
| 68 | case "<alphanumeric>": |
| 69 | return randomAlphanumeric(r) |
| 70 | case "<number>": |
| 71 | return strconv.Itoa(r.Intn(1000)) |
| 72 | case "<sqlkeyword>": |
| 73 | return randomSQLKeyword(r) |
| 74 | case "<sql>": |
| 75 | return randomSQL(r) |
| 76 | default: |
| 77 | return feature |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func randomSQLKeyword(r *rand.Rand) string { |
| 82 | statements := []string{ |
no test coverage detected