From cad98163151a598fef90574ef04513083e9285ba Mon Sep 17 00:00:00 2001 From: Spotlight Date: Sun, 9 Jan 2022 21:05:58 -0600 Subject: [PATCH] Properly seed randomness I am not really sure how that went unnoticed. --- ecs.go | 7 +------ main.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ecs.go b/ecs.go index 57efe14..8f3753e 100644 --- a/ecs.go +++ b/ecs.go @@ -154,13 +154,8 @@ func purchaseTitle(e *Envelope) { }) e.AddKVNode("SyncTime", e.Timestamp()) - //// Two cert types must be present. - //type Certs struct { - // XMLName xml.Name `xml:"Certs"` - // Value string `xml:",chardata"` - //} - e.AddKVNode("ETickets", ticketString) + // Two cert types must be present. e.AddKVNode("Certs", b64(wadlib.CertChainTemplate)) e.AddKVNode("Certs", b64(wadlib.CertChainTemplate)) e.AddKVNode("TitleId", titleId) diff --git a/main.go b/main.go index 3cbc057..1fc5e91 100644 --- a/main.go +++ b/main.go @@ -19,11 +19,15 @@ package main import ( "context" + crypto "crypto/rand" "encoding/xml" "fmt" "github.com/jackc/pgx/v4/pgxpool" "io/ioutil" "log" + "math" + "math/big" + "math/rand" "net/http" ) @@ -47,10 +51,15 @@ func checkError(err error) { } func main() { + // Seed our random number generator before anything else. + seed, err := crypto.Int(crypto.Reader, big.NewInt(math.MaxInt64)) + checkError(err) + rand.Seed(seed.Int64()) + // Initial Start. fmt.Println("WiiSOAP 0.2.6 Kawauso\n[i] Reading the Config...") - // Check the Config. + // Check the config. ioconfig, err := ioutil.ReadFile("./config.xml") checkError(err) readConfig := Config{}