简体   繁体   中英

i have this python code that is supposed to generate a key and i cant execute the program on linux

i tried to run this code using both python and python3 on my machine but it has many errors such as:

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'```

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


```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)

Seems like you are missing the package called crypto Install it and execute your program again: pip install pycrypto

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM