mirror of
https://github.com/FalconOpsLLC/goexec
synced 2026-06-06 15:44:27 +00:00
add truncate func
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"math/rand" // not crypto secure
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const randHostnameCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"
|
||||
@@ -24,6 +25,13 @@ func RandomHostname() (hostname string) {
|
||||
}
|
||||
}
|
||||
|
||||
func Truncate(s string, n int) string {
|
||||
if len(s) <= n {
|
||||
return s
|
||||
}
|
||||
return s[:n] + "..."
|
||||
}
|
||||
|
||||
func RandomWindowsTempFile() string {
|
||||
return `\Windows\Temp\` + strings.ToUpper(uuid.New().String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user