0

I tried to run this code using both Python and Python 3 on my machine, but it has many errors such as:

python3 gen.py

Output:

Traceback (most recent call last):
  File "/home/kali/Downloads/gen.py", line 1, in <module>
    from crypto.Cipher import DES
ModuleNotFoundError: No module named 'crypto'

And:

python gen.py

Output:

Traceback (most recent call last):
  File "gen.py", line 1, in <module>
    from Crypto.Cipher import DES
ImportError: No module named Crypto.Cipher

Code

from Crypto.Cipher import DES
import binascii

key = open('key').read()
iv = '55531056'
cipher = DES.new(key, DES.MODE_OFB, iv)
plaintext = open('plain.txt').read()
msg = iv + cipher.encrypt(plaintext)
with open('flag.enc', 'w') as f:
    f.write(msg)
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

0

It seems like you are missing the package called crypto. Install it and execute your program again:

pip install pycrypto
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Benny Elgazar
  • 243
  • 2
  • 9
  • 1
    [`pycrypto`](https://pypi.org/project/pycrypto/) is an abandoned project, I don't recommend anybody to use it, there's [`pycryptodome`](https://pypi.org/project/pycryptodome/) which is a compatible replacement. – Olvin Roght Dec 13 '21 at 17:05