mirror of
https://github.com/bettercap/bettercap.git
synced 2024-11-03 04:00:07 -08:00
28 lines
483 B
Go
28 lines
483 B
Go
package js
|
|
|
|
import (
|
|
"math/rand"
|
|
"net"
|
|
|
|
"github.com/bettercap/bettercap/v2/network"
|
|
)
|
|
|
|
type randomPackage struct {
|
|
}
|
|
|
|
func (c randomPackage) String(size int, charset string) string {
|
|
runes := []rune(charset)
|
|
nrunes := len(runes)
|
|
buf := make([]rune, size)
|
|
for i := range buf {
|
|
buf[i] = runes[rand.Intn(nrunes)]
|
|
}
|
|
return string(buf)
|
|
}
|
|
|
|
func (c randomPackage) Mac() string {
|
|
hw := make([]byte, 6)
|
|
rand.Read(hw)
|
|
return network.NormalizeMac(net.HardwareAddr(hw).String())
|
|
}
|