mirror of
https://github.com/BishopFox/sliver.git
synced 2026-11-08 01:38:17 -10:00
Compare commits
1
Commits
feature/rc
...
fix/rand
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31930197d6 |
No files matched your search
@@ -19,26 +19,9 @@ package main
|
||||
*/
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
insecureRand "math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/bishopfox/sliver/client/cli"
|
||||
)
|
||||
|
||||
// Attempt to seed insecure rand with secure rand, but we really
|
||||
// don't care that much if it fails since it's insecure anyways
|
||||
func init() {
|
||||
buf := make([]byte, 8)
|
||||
_, err := rand.Read(buf)
|
||||
if err != nil {
|
||||
insecureRand.Seed(int64(time.Now().Unix()))
|
||||
} else {
|
||||
insecureRand.Seed(int64(binary.LittleEndian.Uint64(buf)))
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
cli.Execute()
|
||||
}
|
||||
@@ -25,8 +25,6 @@ import "C"
|
||||
// {{end}}
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"log"
|
||||
insecureRand "math/rand"
|
||||
"os"
|
||||
@@ -67,13 +65,6 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
buf := make([]byte, 8)
|
||||
n, err := rand.Read(buf)
|
||||
if err != nil || n != len(buf) {
|
||||
insecureRand.Seed(time.Now().Unix())
|
||||
} else {
|
||||
insecureRand.Seed(int64(binary.LittleEndian.Uint64(buf)))
|
||||
}
|
||||
id, err := uuid.NewV4()
|
||||
if err != nil {
|
||||
buf := make([]byte, 16) // NewV4 fails if secure rand fails
|
||||
|
||||
@@ -19,26 +19,9 @@ package main
|
||||
*/
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
insecureRand "math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/bishopfox/sliver/server/cli"
|
||||
)
|
||||
|
||||
// Attempt to seed insecure rand with secure rand, but we really
|
||||
// don't care that much if it fails since it's insecure anyways
|
||||
func init() {
|
||||
buf := make([]byte, 8)
|
||||
_, err := rand.Read(buf)
|
||||
if err != nil {
|
||||
insecureRand.Seed(int64(time.Now().Unix()))
|
||||
} else {
|
||||
insecureRand.Seed(int64(binary.LittleEndian.Uint64(buf)))
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
cli.Execute()
|
||||
}
|
||||
Reference in new issue
Block a user