# Path: interface/messages.py
# def print_success(*args, **kwargs):
#     print(Color.GREEN + Color.BOLD + "[+]" + Color.ENDC, *args, **kwargs)
# 
# def print_green(msg):
#     print(Color.GREEN + msg + Color.ENDC)
# 
# def print_yellow(msg):
#     print(Color.YELLOW + msg + Color.ENDC)
# 
# def print_warning(*args, **kwargs):
#     print(Color.YELLOW + Color.BOLD + "[!]" + Color.ENDC, *args, **kwargs)
# 
# def print_info(*args, **kwargs):
#     print(Color.BLUE + Color.BOLD + "[*]" + Color.ENDC, *args, **kwargs)


import core.Decryptor
import core.io
import core.compression.lzo
import math
from interface.messages import print_success, print_green, print_yellow, print_warning, print_info
from collections import defaultdict
from struct import unpack, pack
File:vigor_config.py
Author:Ján Trenčanský
License: GNU GPL v3
Created: 7.3.2014
Description: Guess the state of config file and decrypt and decompress it, extract passwords
Based on: draytools work of Nikita Abdullin (AMMOnium) https://github.com/ammonium/draytools

Options:
    Name        Description

    file        Input config file path
    """

    CFG_RAW = 0
    CFG_LZO = 1
    CFG_ENC = 2

    def __init__(self):
        core.Decryptor.RextDecryptor.__init__(self)

    def do_run(self, e):
        f = open(self.input_file, 'rb')
        data = f.read()
        f.close()
        g, outdata = self.de_cfg(data)
        if g != self.CFG_RAW:
            core.io.writefile(outdata, "config.out")
            print_success("config file written to config.out, extracting credentials...")
        creds = self.get_credentials(outdata)
        print_green("Login    :\t" + (creds[0] == b"" and b"admin" or creds[0]).decode())

# Path: interface/messages.py
# def print_success(*args, **kwargs):
#     print(Color.GREEN + Color.BOLD + "[+]" + Color.ENDC, *args, **kwargs)
# 
# def print_green(msg):
#     print(Color.GREEN + msg + Color.ENDC)
# 
# def print_yellow(msg):
#     print(Color.YELLOW + msg + Color.ENDC)
# 
# def print_warning(*args, **kwargs):
#     print(Color.YELLOW + Color.BOLD + "[!]" + Color.ENDC, *args, **kwargs)
# 
# def print_info(*args, **kwargs):
#     print(Color.BLUE + Color.BOLD + "[*]" + Color.ENDC, *args, **kwargs)


# Path: modules/decryptors/draytek/vigor_config_old.py
import core.Decryptor
import core.io
import core.compression.lzo
import math
from interface.messages import print_success, print_green, print_yellow, print_warning, print_info
from collections import defaultdict
from struct import unpack, pack

File:vigor_config.py
Author:Ján Trenčanský
License: GNU GPL v3
Created: 7.3.2014
Description: Guess the state of config file and decrypt and decompress it, extract passwords
Based on: draytools work of Nikita Abdullin (AMMOnium) https://github.com/ammonium/draytools

Options:
    Name        Description

    file        Input config file path
    """

    CFG_RAW = 0
    CFG_LZO = 1
    CFG_ENC = 2

    def __init__(self):
        core.Decryptor.RextDecryptor.__init__(self)

    def do_run(self, e):
        f = open(self.input_file, 'rb')
        data = f.read()
        f.close()
        g, outdata = self.de_cfg(data)
        if g != self.CFG_RAW:
            core.io.writefile(outdata, "config.out")
            print_success("config file written to config.out, extracting credentials...")
        creds = self.get_credentials(outdata)
        print_green("Login    :\t" + (creds[0] == b"" and b"admin" or creds[0]).decode())

        print_green("Password :\t" + (creds[1] == b"" and b"admin" or creds[1]).decode())