HyperSine / how-does-SecureCRT-encrypt-password

Transferred from https://github.com/DoubleLabyrinth/how-does-SecureCRT-encrypt-password
262 stars 98 forks source link

NameError: name 'xrange' is not defined #7

Open Chunbinlai opened 11 months ago

Chunbinlai commented 11 months ago

Hi man , I followed the steps you in bellow described, https://github.com/HyperSine/how-does-SecureCRT-encrypt-password/blob/master/README.md and I got this error :

E:\Database\python>python securecrt_cipher_1.py dec -2 --prefix 03 70e0ef15dd8**ecb Traceback (most recent call last): File "E:\Database\python\securecrt_cipher_1.py", line 4, in from Crypto.Cipher import AES, Blowfish File "C:\Users\Horry\AppData\Roaming\Python\Python311\site-packages\Crypto\Cipher\Blowfish.py", line 120, in key_size = xrange(4,56+1) ^^^^^^

NameError: name 'xrange' is not defined. Did you mean: 'range'?

Please's help me deal with this problem . Thinks man .

Notie . and Im python version is : 3.11.6 pip version is : 23.2.1 pycryptodome version is : 3.8.2

That error like :

image

HyperSine commented 11 months ago

Your pycryptodome is too old, please upgrade it to the latest version:

$ pip install -U pycryptodome
Chunbinlai commented 11 months ago

Your pycryptodome is too old, please upgrade it to the latest version:

$ pip install -U pycryptodome

Hi man , Im upgrade to last version with pycrytodome after execute command appear error “AttributeError: function 'SHA512_init' not found” , What is that mean ?? that log information in bellow :

  1. Im to upgrade pycrytodome

PS C:\Users\Horry> pip install -U pycryptodome Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pycryptodome in c:\program files\python\python311\lib\site-packages (3.8.2) Collecting pycryptodome Obtaining dependency information for pycryptodome from https://files.pythonhosted.org/packages/87/c4/c979db0914a23541d62c9e4b5e8a30f56a78c6dec8677db6a5327d306be5/pycryptodome-3.19.0-cp35-abi3-win_amd64.whl.metadata Using cached pycryptodome-3.19.0-cp35-abi3-win_amd64.whl.metadata (3.4 kB) Using cached pycryptodome-3.19.0-cp35-abi3-win_amd64.whl (1.7 MB) Installing collected packages: pycryptodome Successfully installed pycryptodome-3.19.0

[notice] A new release of pip is available: 23.2.1 -> 23.3 [notice] To update, run: python.exe -m pip install --upgrade pip

  1. After execute command appear error :

PS E:\Database\python> python securecrt_cipher_1.py dec -2 --prefix 03 70e0ef15dd8c31f59988e0**cba9f418c10daecb Traceback (most recent call last): File "E:\Database\python\securecrt_cipher_1.py", line 266, in print(getattr(cipher, operation)(args.PASSWORD, prefix = args.prefix)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Database\python\securecrt_cipher_1.py", line 166, in decrypt kdf_bytes = bcrypt_pbkdf2(self._config_passphrase, salt, 32 + AES.block_size, 16) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Database\python\securecrt_cipher_1.py", line 21, in bcrypt_pbkdf2 out = KDF.PBKDF2(password, salt, out_len, rounds, prf = bcrypt_hash) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Horry\AppData\Roaming\Python\Python311\site-packages\Crypto\Protocol\KDF.py", line 168, in PBKDF2 s = [ prf(password, salt + struct.pack(">I", i)) ] * 2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Database\python\securecrt_cipher_1.py", line 8, in bcrypt_hash password = SHA512.new(password).digest() ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Horry\AppData\Roaming\Python\Python311\site-packages\Crypto\Hash\SHA512.py", line 177, in new return SHA512Hash(data, truncate) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Horry\AppData\Roaming\Python\Python311\site-packages\Crypto\Hash\SHA512.py", line 85, in init result = _raw_sha512_lib.SHA512_init(state.address_of(), ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python\Python311\Lib\ctypes__init.py", line 389, in getattr func = self.getitem(name) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python\Python311\Lib\ctypes\init.py", line 394, in getitem__ func = self._FuncPtr((name_or_ordinal, self)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: function 'SHA512_init' not found