mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 13:02:12 -07:00
new: ticker now broadcasts a tick event
This commit is contained in:
parent
31b06638d8
commit
bfe307ffe6
5 changed files with 45 additions and 2 deletions
26
js/random.go
Normal file
26
js/random.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package js
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"net"
|
||||
"github.com/bettercap/bettercap/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())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue