From 8df2e2815dea3f676eddcfdfd9b1399c3ba89cb4 Mon Sep 17 00:00:00 2001 From: dmur1 <93072266+dmur1@users.noreply.github.com> Date: Mon, 31 Mar 2025 20:57:42 +0100 Subject: [PATCH] make the rsa command report factors always fixes: https://github.com/rerrorctf/ret/issues/304 --- rsa/factor_with_ecm.go | 2 ++ rsa/factor_with_pari.go | 2 ++ rsa/factordb.go | 2 ++ rsa/rsa.go | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rsa/factor_with_ecm.go b/rsa/factor_with_ecm.go index ae70c4c..4d87ec4 100644 --- a/rsa/factor_with_ecm.go +++ b/rsa/factor_with_ecm.go @@ -76,6 +76,8 @@ func factorWithECM(strategy *Strategy, n *big.Int) { return } + fmt.Printf("["+theme.ColorGreen+"%s"+theme.ColorReset+"] "+theme.ColorPurple+"%v"+theme.ColorReset+"\n", strategy.Name, factors) + if len(factors) == 2 { // special case for N = p * q where p and q and two distinct primes p := factors[0] diff --git a/rsa/factor_with_pari.go b/rsa/factor_with_pari.go index 62587f5..ba1032d 100644 --- a/rsa/factor_with_pari.go +++ b/rsa/factor_with_pari.go @@ -76,6 +76,8 @@ func factorWithPari(strategy *Strategy, n *big.Int) { return } + fmt.Printf("["+theme.ColorGreen+"%s"+theme.ColorReset+"] "+theme.ColorPurple+"%v"+theme.ColorReset+"\n", strategy.Name, factors) + if len(factors) == 2 { // special case for N = p * q where p and q and two distinct primes p := factors[0] diff --git a/rsa/factordb.go b/rsa/factordb.go index 409579e..d071eb6 100644 --- a/rsa/factordb.go +++ b/rsa/factordb.go @@ -75,6 +75,8 @@ func factorDB(strategy *Strategy, n *big.Int) { log.Fatalf("šŸ’„ "+theme.ColorRed+"error"+theme.ColorReset+": %v\n", err) } + fmt.Printf("["+theme.ColorGreen+"%s"+theme.ColorReset+"] "+theme.ColorPurple+"%v"+theme.ColorReset+"\n", strategy.Name, factors) + if len(factors) == 2 { // special case for N = p * q where p and q and two distinct primes p := factors[0] diff --git a/rsa/rsa.go b/rsa/rsa.go index f61d379..c14dfa5 100644 --- a/rsa/rsa.go +++ b/rsa/rsa.go @@ -53,7 +53,7 @@ func ResultChecker(strategy *Strategy, m *big.Int) []byte { now := time.Now() diff := now.Sub(StartTime) - fmt.Printf("["+theme.ColorGreen+"%s"+theme.ColorReset+"] after %v\nšŸ "+theme.ColorPurple+"%s"+theme.ColorReset+"\n", strategy.Name, diff, mBytes) + fmt.Printf("["+theme.ColorGreen+"%s"+theme.ColorReset+"] after %v šŸ "+theme.ColorPurple+"%s"+theme.ColorReset+"\n", strategy.Name, diff, mBytes) return mBytes }