Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an updated version of the crypto library #59

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ There are some pre-reqs that are included in the pip setup and the requirements.
- pefile
- pbkdf2
- javaobj-py3
- pycrypto
- pycryptodome
- androguard

For all the decoders you will need yara and yara-python. For dealing with .NET malware you will need to install yara-python with dotnet support
Expand Down
6 changes: 3 additions & 3 deletions malwareconfig/crypto.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import itertools
import struct
from Crypto.Cipher import ARC4, DES, DES3, AES, Blowfish, XOR
from Crypto.Cipher import ARC4, DES, DES3, AES, Blowfish
from Crypto.PublicKey import RSA

from pbkdf2 import PBKDF2
Expand All @@ -13,8 +14,7 @@ def decrypt_rsa(key, data):

# XOR
def decrypt_xor(key, data):
cipher = XOR.new(key)
return cipher.decrypt(data)
return bytes([a ^ b for a, b in zip(itertools.cycle(key), data)])


# RC4
Expand Down
4 changes: 2 additions & 2 deletions malwareconfig/decoders/sakula.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_config(self):
# RE for 1.2, 1.3, 1.4
re_pattern2 = b'([ -~]{50})([ -~]{50})([ -~]{50})([ -~]{50})([ -~]{50})([ -~]{50})([ -~]{50})([ -~]{50})([ -~]{12})(0uVVVVVV)'

xor_data = crypto.decrypt_xor('\x88', file_data)
xor_data = crypto.decrypt_xor(b'\x88', file_data)

config_list = re.findall(re_pattern1, xor_data)

Expand All @@ -77,7 +77,7 @@ def get_config(self):

# XOR for later versions

xor_data = crypto.decrypt_xor('V', file_data)
xor_data = crypto.decrypt_xor(b'V', file_data)

config_list = re.findall(re_pattern2, xor_data)

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pefile
pbkdf2
javaobj-py3
pycrypto
androguard
pycryptodome
androguard