RsaCtfTool / RsaCtfTool

RSA attack tool (mainly for ctf) - retrieve private key from weak public key and/or uncipher data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnboundLocalError: local variable 't' referenced before assignment

catap opened this issue · comments

I'm using c352e87 as the local root and attempt to use another attack fails:

> python3.10 RsaCtfTool.py --createpub -n 1000000000000000127 -e 65537 > test.pub 
> python3.10 RsaCtfTool.py --attack wiener --publickey test.pub
...
[*] Testing key test.pub.
[*] Performing wiener attack on test.pub.
 29%|████████████████████████████████████████▊                                                                                                      | 2/7 [00:00<00:00, 42366.71it/s]
[!] An exception has occurred during the attack. Please check your inputs.
[!] local variable 't' referenced before assignment
[!] Traceback (most recent call last):
  File "/Users/catap/src/RsaCtfTool/lib/rsa_attack.py", line 328, in attack_single_key
    self.priv_key, unciphered = attack_module.attack_wrapper(
  File "/Users/catap/src/RsaCtfTool/attacks/abstract_attack.py", line 44, in attack_wrapper
    return self.attack(publickeys, cipher, progress)
  File "/Users/catap/src/RsaCtfTool/attacks/single_key/wiener.py", line 37, in attack
    pq = wiener(publickey.n, publickey.e, progress)
  File "/Users/catap/src/RsaCtfTool/attacks/single_key/wiener.py", line 24, in wiener
    if (s + t) & 1 == 0:
UnboundLocalError: local variable 't' referenced before assignment

[+] Time elapsed: 0.0139 sec.
[+] Total time elapsed min,max,avg: 0.0139/0.0139/0.0139 sec.

Hi, thanks for reporting.