# Path: malwareconfig/crypto.py
# def decrypt_rsa(key, data):
# def decrypt_xor(key, data):
# def decrypt_arc4(key, data):
# def decrypt_des_ecb(key, data, iv=None):
# def decrypt_des_cbc(key, data, iv=None):
# def decrypt_des3(key, data):
# def decrypt_aes(key, data):
# def decrypt_aes_cbc_iv(key, iv, data):
# def decrypt_blowfish(key, data):
# def decrypt_RC6(key, encrypted, P, Q, rounds):
#     def rol(a, i):
#     def ror(a, i):
#     def to_int(bytestring):
#     def decrypt_block(block, S):
# def derive_pbkdf2(key, salt, iv_length, key_length, iterations=8):
#     T = 2 * rounds + 4
#     L = to_int(key)
#     S = []
#     S = [0 for i in range(T)]
#     S[0] = P
#     A = 0
#     B = 0
#         A = S[i] = rol((S[i] + A + B), 3)
#         B = L[j] = rol((L[j] + A + B), (A + B))
# 
# Path: malwareconfig/common.py
# class Decoder(object):
#     decoder_name = ""
#     decoder_version = 1
#     decoder_author = ""
#     decoder_description = ""
#     file_info = object
# 
#     def set_file(self, file_info):
#         self.file_info = file_info
# 
#     def get_config(self):
#         pass
# 
# Path: malwareconfig/common.py
# def string_printable(line):
#     line = str(line)
#     new_line = ''
#     for c in line:
#         if c in string.printable:
#             new_line += c
#         else:
#             new_line += '\\x' + c.encode("utf-8").hex()
#     return new_line


import re
import binascii
import hashlib
from base64 import b64decode
from malwareconfig import crypto
from malwareconfig.common import Decoder
from malwareconfig.common import string_printable
            config_dict['Mutex'] = sections[6]
        if len(sections) == 5:
            config_dict['Version'] = '2.x'
            config_dict['Domain1'] = sections[0]
            config_dict['Domain2'] = sections[1]
            config_dict['Port1'] = sections[2]
            config_dict['Port2'] = sections[3]
            config_dict['AntiDebug'] = sections[4]
        return config_dict

    def get_config(self):
        '''
        This is the main entry
        :return:
        '''

        # Known Values
        key = '&%#@?,:*'
        iv = b'\x12\x34\x56\x78\x90\xab\xcd\xef'

        file_data = self.file_info.file_data

        # Get the base64 config
        search = re.search(b'\x01\x96\x01(.*)@@', file_data)
        coded_config = search.group(0).replace(b'@', b'')[3:]

        # decode the config
        decoded_config = b64decode(coded_config)

        # Decrypt

# Path: malwareconfig/crypto.py
# def decrypt_rsa(key, data):
# def decrypt_xor(key, data):
# def decrypt_arc4(key, data):
# def decrypt_des_ecb(key, data, iv=None):
# def decrypt_des_cbc(key, data, iv=None):
# def decrypt_des3(key, data):
# def decrypt_aes(key, data):
# def decrypt_aes_cbc_iv(key, iv, data):
# def decrypt_blowfish(key, data):
# def decrypt_RC6(key, encrypted, P, Q, rounds):
#     def rol(a, i):
#     def ror(a, i):
#     def to_int(bytestring):
#     def decrypt_block(block, S):
# def derive_pbkdf2(key, salt, iv_length, key_length, iterations=8):
#     T = 2 * rounds + 4
#     L = to_int(key)
#     S = []
#     S = [0 for i in range(T)]
#     S[0] = P
#     A = 0
#     B = 0
#         A = S[i] = rol((S[i] + A + B), 3)
#         B = L[j] = rol((L[j] + A + B), (A + B))
# 
# Path: malwareconfig/common.py
# class Decoder(object):
#     decoder_name = ""
#     decoder_version = 1
#     decoder_author = ""
#     decoder_description = ""
#     file_info = object
# 
#     def set_file(self, file_info):
#         self.file_info = file_info
# 
#     def get_config(self):
#         pass
# 
# Path: malwareconfig/common.py
# def string_printable(line):
#     line = str(line)
#     new_line = ''
#     for c in line:
#         if c in string.printable:
#             new_line += c
#         else:
#             new_line += '\\x' + c.encode("utf-8").hex()
#     return new_line


# Path: malwareconfig/decoders/aar.py
import re
import binascii
import hashlib
from base64 import b64decode
from malwareconfig import crypto
from malwareconfig.common import Decoder
from malwareconfig.common import string_printable

            config_dict['Mutex'] = sections[6]
        if len(sections) == 5:
            config_dict['Version'] = '2.x'
            config_dict['Domain1'] = sections[0]
            config_dict['Domain2'] = sections[1]
            config_dict['Port1'] = sections[2]
            config_dict['Port2'] = sections[3]
            config_dict['AntiDebug'] = sections[4]
        return config_dict

    def get_config(self):
        '''
        This is the main entry
        :return:
        '''

        # Known Values
        key = '&%#@?,:*'
        iv = b'\x12\x34\x56\x78\x90\xab\xcd\xef'

        file_data = self.file_info.file_data

        # Get the base64 config
        search = re.search(b'\x01\x96\x01(.*)@@', file_data)
        coded_config = search.group(0).replace(b'@', b'')[3:]

        # decode the config
        decoded_config = b64decode(coded_config)

        # Decrypt

        clear_config = crypto.decrypt_des_cbc(key, decoded_config, iv=iv)