Skip to content

raivenLockdown/RSA_Even-N_Cracker_Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔐 RSA Even-N Cracker Tool

A Python tool to exploit the weak RSA case where N is even (p = 2, q = N/2). It works with local files or directly with remote CTF challenge servers (netcat-style).


📦 Requirements

  • Python 3.8+
  • No external libraries (only Python standard library).

⚙️ Usage

1. Crack from a file

python3 rsa_evenN_cracker_tool.py input.txt

The file may contain:

N=12345678901234567890
e=65537
c=98765432109876543210

or Python-style:

N = 12345678901234567890
e = 65537
c = 98765432109876543210

or with colons:

N: 12345678901234567890
e: 65537
cyphertext: 98765432109876543210

2. Crack from a challenge server (netcat mode)

Connect to a remote challenge server like with nc host port:

python3 rsa_evenN_cracker_tool.py -n verbal-sleep.picoctf.net 53671

The tool will capture the output (e.g. N: ..., e: ..., cyphertext: ...), factor N, compute d, and print the plaintext.


3. Output control

  • Pretty output (default):

    == Case #1 ==
    N (even) = ...
    e = 65537
    q = N//2 = ...
    phi = ...
    m (int) = ...
    plaintext (utf-8): picoCTF{flag_here}
    
  • Raw plaintext only (good for piping):

    python3 rsa_evenN_cracker_tool.py input.txt -r
  • Escape non-UTF8 bytes:

    python3 rsa_evenN_cracker_tool.py input.txt -r -x
  • Verbose (debug) mode — show the raw captured server/file text before parsing:

    python3 rsa_evenN_cracker_tool.py -n verbal-sleep.picoctf.net 53671 -v

📝 Examples

From file

python3 rsa_evenN_cracker_tool.py encrypt.txt

Output:

== Case #1 ==
N (even) = 188548530
e = 65537
q = N//2 = 94274265
phi = 94274264
m (int) = 1122334455
plaintext (utf-8): picoCTF{tw0_1$_pr!m378257f39}

From server

python3 rsa_evenN_cracker_tool.py -n verbal-sleep.picoctf.net 53671 -r

Output:

picoCTF{flag_here}

🚨 Limitations

  • Only solves RSA when N is even (p=2).
  • If N is odd (normal RSA), the script will refuse to solve.
  • In netcat mode, the tool only receives data — it does not automatically send the cracked flag back to the server (you copy-paste manually).

🔖 Flags & Options

Option Description
file Input file containing N/e/c values
-n host port Connect to a challenge server (netcat mode)
-r Print only plaintext (raw mode)
-x Escape invalid UTF-8 characters
-v Show raw captured text (useful for debugging parsing)

About

No description or website provided.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages