Skip to content

Commit

Permalink
Added support of python3
Browse files Browse the repository at this point in the history
  • Loading branch information
MyLoginOnGitHub committed Jan 5, 2020
1 parent c58ffcc commit e5182e1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Windows/lazagne/softwares/chats/skype.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,34 @@ def get_md5_hash(self, enc_hex, key):
enc_binary = binascii.unhexlify(enc_hex)

# retrieve the salt
salt = hashlib.sha1('\x00\x00\x00\x00' + key).digest() + hashlib.sha1('\x00\x00\x00\x01' + key).digest()
salt = hashlib.sha1(b'\x00\x00\x00\x00' + key).digest() + hashlib.sha1(b'\x00\x00\x00\x01' + key).digest()

# encrypt value used with the XOR operation
aes_key = self.aes_encrypt(struct.pack('I', 0) * 4, salt[0:32])[0:16]

# XOR operation
decrypted = []

# Make code python3-compatible
if win.python_version == 3:
enc_binary = [bytes([x]) for x in enc_binary]
aes_key = [bytes([x]) for x in aes_key]

for d in range(16):
decrypted.append(struct.unpack('B', enc_binary[d])[0] ^ struct.unpack('B', aes_key[d])[0])

# cast the result byte
tmp = ''
tmp = b''
for dec in decrypted:
tmp = tmp + struct.pack(">I", dec).strip('\x00')
tmp = tmp + struct.pack(">I", dec).strip(b'\x00')

# byte to hex
return binascii.hexlify(tmp)

def dictionary_attack(self, login, md5):
wordlist = constant.password_found + get_dic()
for word in wordlist:
hash_ = hashlib.md5('%s\nskyper\n%s' % (login, word)).hexdigest()
hash_ = hashlib.md5(('%s\nskyper\n%s' % (login, word)).encode()).hexdigest()
if hash_ == md5:
return word
return False
Expand Down Expand Up @@ -111,7 +117,7 @@ def get_info(self, key, username, path):
self.warning(u'No credential stored on the config.xml file.')
else:
# decrypt the hash to get the md5 to brue force
values['Hash'] = self.get_md5_hash(enc_hex, key)
values['Hash'] = self.get_md5_hash(enc_hex, key).decode()
values['Pattern to bruteforce using md5'] = win.string_to_unicode(values['Login']) + u'\\nskyper\\n<password>'

# Try a dictionary attack on the hash
Expand Down

1 comment on commit e5182e1

@MyLoginOnGitHub
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now on this commit the same behaviour for python2 and python3: project is not crashed, it retrieves md5 of credentials, but it could not to perform successful dictionary attack even if the right password is added in the passords list.
I have checked out that md5-sums, counted in dictionary_attack method, are the same in python2 and python3.

Please sign in to comment.