|
12 | 12 | except: # removed ImportError because of https://github.com/sqlmapproject/sqlmap/issues/3171
|
13 | 13 | from thirdparty.fcrypt.fcrypt import crypt
|
14 | 14 |
|
| 15 | +try: |
| 16 | + from Crypto.Cipher.DES import MODE_CBC as CBC |
| 17 | + from Crypto.Cipher.DES import new as des |
| 18 | +except: |
| 19 | + from thirdparty.pydes.pyDes import CBC |
| 20 | + from thirdparty.pydes.pyDes import des |
| 21 | + |
15 | 22 | _multiprocessing = None
|
16 | 23 |
|
17 | 24 | import base64
|
|
80 | 87 | from lib.core.wordlist import Wordlist
|
81 | 88 | from thirdparty import six
|
82 | 89 | from thirdparty.colorama.initialise import init as coloramainit
|
83 |
| -from thirdparty.pydes.pyDes import CBC |
84 |
| -from thirdparty.pydes.pyDes import des |
85 | 90 | from thirdparty.six.moves import queue as _queue
|
86 | 91 |
|
87 | 92 | def mysql_passwd(password, uppercase=True):
|
@@ -219,14 +224,21 @@ def oracle_old_passwd(password, username, uppercase=True): # prior to version '
|
219 | 224 | 'F894844C34402B67'
|
220 | 225 | """
|
221 | 226 |
|
222 |
| - IV, pad = "\0" * 8, "\0" |
| 227 | + IV, pad = b"\0" * 8, b"\0" |
223 | 228 |
|
224 | 229 | unistr = b"".join((b"\0" + _.encode(UNICODE_ENCODING)) if ord(_) < 256 else _.encode(UNICODE_ENCODING) for _ in (username + password).upper())
|
225 | 230 |
|
226 |
| - cipher = des(decodeHex("0123456789ABCDEF"), CBC, IV, pad) |
227 |
| - encrypted = cipher.encrypt(unistr) |
228 |
| - cipher = des(encrypted[-8:], CBC, IV, pad) |
229 |
| - encrypted = cipher.encrypt(unistr) |
| 231 | + if des.__module__ == "Crypto.Cipher.DES": |
| 232 | + unistr += b"\0" * ((8 - len(unistr) % 8) & 7) |
| 233 | + cipher = des(decodeHex("0123456789ABCDEF"), CBC, iv=IV) |
| 234 | + encrypted = cipher.encrypt(unistr) |
| 235 | + cipher = des(encrypted[-8:], CBC, iv=IV) |
| 236 | + encrypted = cipher.encrypt(unistr) |
| 237 | + else: |
| 238 | + cipher = des(decodeHex("0123456789ABCDEF"), CBC, IV, pad) |
| 239 | + encrypted = cipher.encrypt(unistr) |
| 240 | + cipher = des(encrypted[-8:], CBC, IV, pad) |
| 241 | + encrypted = cipher.encrypt(unistr) |
230 | 242 |
|
231 | 243 | retVal = encodeHex(encrypted[-8:], binary=False)
|
232 | 244 |
|
|
0 commit comments