Exemplo n.º 1
0
def main():
    if sys.version_info[0] != 3:
        print("[-] Intensio-Obfuscator only support Python 3.x")
        sys.exit(0)

    if sys.platform != "win32" and sys.platform != "linux":
        print("[-] This tool support [windows - Linux] only !")
        sys.exit(0)

    try:
        from core.utils.intensio_design import INTENSIO_BANNER
        from core.utils.intensio_utils import Utils
        from core.utils.intensio_usage import Args
        from core.utils.intensio_error import EXIT_SUCCESS, ERROR_BAD_ENVIRONMENT, ERROR_INVALID_PARAMETER, ERROR_BAD_ARGUMENTS,\
                                                ERROR_INVALID_FUNCTION, ERROR_FILE_NOT_FOUND
        from core.obfuscation.intensio_replace import ReplaceWords
        from core.obfuscation.intensio_padding import Padding
        from core.obfuscation.intensio_analyze import Analyze
        from core.obfuscation.intensio_remove import Remove
    except ImportError as e:
        print("[-] {0}\n".format(e))
        sys.exit(0)

    args = Args()
    utils = Utils()

    if len(sys.argv) > 1 and len(sys.argv) <= 14:
        pass
    else:
        print("[-] Incorrect number of arguments\n")
        args.GetArgHelp()
        sys.exit(ERROR_BAD_ARGUMENTS)

    if args.GetArgsValue().input:
        if args.GetArgsValue().output:
            if args.GetArgsValue().code:
                if re.match(r"^python$", args.GetArgsValue().code):
                    if args.GetArgsValue().mixerlevel:
                        if re.match(r"^lower$|^medium$|^high$",
                                    args.GetArgsValue().mixerlevel):
                            if not args.GetArgsValue().padding and not args.GetArgsValue().replace \
                                and not args.GetArgsValue().rcommentaries and not args.GetArgsValue().rprint:
                                print(
                                    "\n[-] Need at least one argument [-r --replace] or [-p --padding] or [-rc --rcommentaries] or [-rp --rprint]"
                                )
                                sys.exit(ERROR_BAD_ARGUMENTS)
                        else:
                            print(
                                "[-] Incorrect level of mixerlevel, [lower - medium - high] only supported\n"
                            )
                            sys.exit(ERROR_INVALID_PARAMETER)
                    else:
                        print(
                            "[-] Mixerlevel [-m --mixerlevel] argument missing\n"
                        )
                        sys.exit(ERROR_BAD_ARGUMENTS)
                else:
                    print(
                        "[-] '{0}' Incorrect code argument, [python] only supported\n"
                        .format(args.GetArgsValue().Code))
                    sys.exit(ERROR_INVALID_PARAMETER)
            else:
                print("[-] Code [-c --code] argument missing\n")
                sys.exit(ERROR_BAD_ARGUMENTS)
        else:
            print("[-] Output [-o --output] argument missing\n")
            sys.exit(ERROR_BAD_ARGUMENTS)
    else:
        print("[-] Input [-i --input] argument missing\n")
        sys.exit(ERROR_BAD_ARGUMENTS)

    for line in INTENSIO_BANNER.split("\n"):
        time.sleep(0.05)
        print(line)

    # -- Analysis and set up of the work environment -- #
    print(
        "\n\n*********************** [ Analyze and setup environment ] ************************\n"
    )
    analyze = Analyze()

    if (analyze.InputAvailable(args.GetArgsValue().input,
                               args.GetArgsValue().code,
                               args.GetArgsValue().verbose) == EXIT_SUCCESS):
        print("\n[+] Analyze input argument '{0}' -> Successful".format(
            args.GetArgsValue().input))
    else:
        print("[-] Analyze input '{0}' failed\n".format(
            args.GetArgsValue().input))
        sys.exit(ERROR_INVALID_FUNCTION)

    if (analyze.OutputAvailable(args.GetArgsValue().input,
                                args.GetArgsValue().code,
                                args.GetArgsValue().output,
                                args.GetArgsValue().verbose) == EXIT_SUCCESS):
        print(
            "\n[+] Analyze and setup output argument environment '{0}' -> Successful"
            .format(args.GetArgsValue().output))
    else:
        print("[-] Analyze output '{0}' failed\n".format(
            args.GetArgsValue().output))
        sys.exit(ERROR_INVALID_FUNCTION)

    # -- Obfuscation process -- #
    print(
        "\n\n************************** [ Obfuscation Rcommentaries ] **************************\n"
    )
    if args.GetArgsValue().rcommentaries:
        removeData = Remove()

        if (removeData.Commentaries(
                args.GetArgsValue().code,
                args.GetArgsValue().output) == EXIT_SUCCESS):
            print("[+] Obfuscation Rcommentaries -> Successful")
        else:
            print("\n[-] Obfuscation Rcommentaries -> Failed")
    else:
        print("[!] Obfuscation Rcommentaries no asked !")

    print(
        "\n\n***************************** [ Obfuscation Replace ] *****************************\n"
    )
    if args.GetArgsValue().replace:
        replaceWords = ReplaceWords()

        if (replaceWords.VarsDefinedByUser(
                args.GetArgsValue().code,
                args.GetArgsValue().output,
                args.GetArgsValue().mixerlevel,
                args.GetArgsValue().verbose) == EXIT_SUCCESS):
            print("[+] Obfuscation Replace -> Successful")
        else:
            print("\n[-] Obfuscation Replace -> Failed")
    else:
        print("[!] Obfuscation Replace no asked !")

    print(
        "\n\n***************************** [ Obfuscation Padding ] *****************************\n"
    )
    if args.GetArgsValue().padding:
        paddingScripts = Padding()

        if (paddingScripts.AddScripts(
                args.GetArgsValue().code,
                args.GetArgsValue().output,
                args.GetArgsValue().mixerlevel) == EXIT_SUCCESS):
            print("[+] Obfuscation Padding -> Successful")
        else:
            print("\n[-] Obfuscation Padding -> Failed")
    else:
        print("[!] Obfuscation Padding no asked !")

    print(
        "\n\n****************************** [ Obfuscation Rprint ] *****************************\n"
    )
    if args.GetArgsValue().rprint:

        if (removeData.PrintFunc(args.GetArgsValue().code,
                                 args.GetArgsValue().output) == EXIT_SUCCESS):
            print("[+] Obfuscation Rprint -> Successful\n")
        else:
            print("\n[-] Obfuscation Rprint -> Failed\n")
    else:
        print("[!] Obfuscation Rprint no asked !\n")
Exemplo n.º 2
0
def main():
    if sys.version_info[0] != 3:
        print(ERROR_COLOUR + "[-] Intensio-Obfuscator only support Python 3.x")
        sys.exit(0)

    if sys.platform != "win32" and sys.platform != "linux":
        print(ERROR_COLOUR + "[-] This tool support [windows - Linux] only !")
        sys.exit(0)

    args = Args()
    utils = Utils()

    if len(sys.argv) > 1 and len(sys.argv) <= 13:
        pass
    else:
        print(ERROR_COLOUR + "[-] Incorrect number of arguments\n")
        args.GetArgHelp()
        sys.exit(ERROR_BAD_ARGUMENTS)

    if args.GetArgsValue().input:
        if args.GetArgsValue().output:
            if args.GetArgsValue().mixerlevel:
                if re.match(r"^lower$|^medium$|^high$",
                            args.GetArgsValue().mixerlevel):
                    if not args.GetArgsValue().paddingscript and not args.GetArgsValue().replacetostr \
                        and not args.GetArgsValue().replacefilename and not args.GetArgsValue().replacetohex:
                        print(
                            ERROR_COLOUR +
                            "\n[-] Need at least one argument [-rts] - [-ps] - [-rfn] - [-rth]"
                        )
                        sys.exit(ERROR_BAD_ARGUMENTS)
                else:
                    print(
                        ERROR_COLOUR +
                        "[-] Incorrect level of mixerlevel, [lower - medium - high] only supported\n"
                    )
                    sys.exit(ERROR_INVALID_PARAMETER)
            else:
                print(ERROR_COLOUR +
                      "[-] Mixerlevel [-m, --mixerlevel] argument missing\n")
                sys.exit(ERROR_BAD_ARGUMENTS)
        else:
            print(ERROR_COLOUR +
                  "[-] Output [-o, --output] argument missing\n")
            sys.exit(ERROR_BAD_ARGUMENTS)
    else:
        print(ERROR_COLOUR + "[-] Input [-i, --input] argument missing\n")
        sys.exit(ERROR_BAD_ARGUMENTS)

    for line in INTENSIO_BANNER.split("\n"):
        time.sleep(0.05)
        print(BANNER_COLOUR + line)

    # -- Analysis and set up of the work environment -- #
    print(
        SECTION_COLOUR +
        "\n\n*********************** [ Analyze and setup environment ] ************************\n"
    )
    analyzeData = Analyze()
    analyseDataInEnv = analyzeData.InputAvailable(
        inputArg=args.GetArgsValue().input,
        verboseArg=args.GetArgsValue().verbose)
    if analyseDataInEnv == EXIT_SUCCESS:
        print("\n[+] Analyze input argument '{0}' -> ".format(
            args.GetArgsValue().input) + SUCESS_COLOUR + "Successful")
    else:
        print("[-] Analyze input '{0}' -> ".format(args.GetArgsValue().input) +
              FAILED_COLOUR + "failed\n")
        sys.exit(ERROR_INVALID_FUNCTION)

    analyseDataOutEnv = analyzeData.OutputAvailable(
        inputArg=args.GetArgsValue().input,
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)
    if analyseDataOutEnv == EXIT_SUCCESS:
        print("\n[+] Analyze and setup output argument environment '{0}' -> " \
                .format(args.GetArgsValue().output) + SUCESS_COLOUR + "Successful")
    else:
        print(
            "[-] Analyze output '{0}' -> ".format(args.GetArgsValue().output) +
            FAILED_COLOUR + "failed\n")
        sys.exit(ERROR_INVALID_FUNCTION)

    # -- Obfuscation process -- #
    print(
        SECTION_COLOUR +
        "\n\n************************ [ Obfuscation remove comment ] *************************\n"
    )
    removeData = Remove()
    removeCommentsData = removeData.Comments(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)
    if removeCommentsData == EXIT_SUCCESS:
        print("[+] Obfuscation remove comments -> " + SUCESS_COLOUR +
              "Successful")
    else:
        print("\n[-] Obfuscation remove comments -> " + FAILED_COLOUR +
              "Failed")
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    print(
        SECTION_COLOUR +
        "\n\n*********************** [ Obfuscation remove line space ] ***********************\n"
    )
    if removeData:
        pass
    else:
        removeData = Remove()

    removeLinesSpacesData = removeData.LinesSpaces(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)

    if removeLinesSpacesData == EXIT_SUCCESS:
        print("[+] Obfuscation remove lines spaces -> " + SUCESS_COLOUR +
              "Successful")
    else:
        print("\n[-] Obfuscation remove lines spaces -> " + FAILED_COLOUR +
              "Failed")
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    # -- If empty class (avert to generate an error) -- #
    print(
        SECTION_COLOUR +
        "\n\n*********************** [ Correction padding empty class ] **********************\n"
    )
    paddingData = Padding()
    paddingDataEmptyClass = paddingData.EmptyClasses(
        outputArg=args.GetArgsValue().output,
        mixerLevelArg=args.GetArgsValue().mixerlevel,
        verboseArg=args.GetArgsValue().verbose)
    if paddingDataEmptyClass == EXIT_SUCCESS:
        pass
    else:
        print("\n[-] Padding empty class -> " + FAILED_COLOUR + "Failed")
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    # -- If empty functions (avert to generate an error) -- #
    print(
        SECTION_COLOUR +
        "\n\n********************** [ Correction padding empty function ] ********************\n"
    )
    if paddingData:
        pass
    else:
        paddingData = Padding()

    paddingDataEmptyFunc = paddingData.EmptyFunctions(
        outputArg=args.GetArgsValue().output,
        mixerLevelArg=args.GetArgsValue().mixerlevel,
        verboseArg=args.GetArgsValue().verbose)
    if paddingDataEmptyFunc == EXIT_SUCCESS:
        pass
    else:
        print("\n[-] Padding empty function -> " + FAILED_COLOUR + "Failed")
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    print(
        SECTION_COLOUR +
        "\n\n**************** [ Obfuscation replace string to string mixed ] *****************\n"
    )
    if args.GetArgsValue().replacetostr:
        replaceData = Replace()

        replaceDataStrStr = replaceData.StringToString(
            outputArg=args.GetArgsValue().output,
            mixerLevelArg=args.GetArgsValue().mixerlevel,
            verboseArg=args.GetArgsValue().verbose)

        if replaceDataStrStr == EXIT_SUCCESS:
            print("[+] Obfuscation replace string to string mixed -> " +
                  SUCESS_COLOUR + "Successful")
        else:
            print("\n[-] Obfuscation replace string to string mixed -> " +
                  FAILED_COLOUR + "Failed")
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace string to string ] mixed no asked !")

    print(
        SECTION_COLOUR +
        "\n\n********************* [ Obfuscation adding padding script ] *********************\n"
    )
    if args.GetArgsValue().paddingscript:
        if paddingData:
            pass
        else:
            paddingData = Padding()

        paddingDataGarbage = paddingData.AddRandomScripts(
            outputArg=args.GetArgsValue().output,
            mixerLevelArg=args.GetArgsValue().mixerlevel,
            verboseArg=args.GetArgsValue().verbose)
        if paddingDataGarbage == EXIT_SUCCESS:
            print("[+] Obfuscation padding script -> " + SUCESS_COLOUR +
                  "Successful")
        else:
            print("\n[-] Obfuscation padding script -> " + FAILED_COLOUR +
                  "Failed")
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ padding script ] no asked !")

    print(
        SECTION_COLOUR +
        "\n\n********************** [ Obfuscation replace file name ] ************************\n"
    )
    if args.GetArgsValue().replacefilename:
        if args.GetArgsValue().replacetostr:
            pass
        else:
            replaceData = Replace()

        replaceDataStrFname = replaceData.FilesName(
            outputArg=args.GetArgsValue().output,
            mixerLevelArg=args.GetArgsValue().mixerlevel,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrFname == EXIT_SUCCESS:
            print("\n[+] Obfuscation replace file name -> " + SUCESS_COLOUR +
                  "Successful")
        else:
            print("\n[-] Obfuscation replace file name -> " + FAILED_COLOUR +
                  "Failed")
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace file name ] feature no asked !")

    print(
        SECTION_COLOUR +
        "\n\n******************** [ Obfuscation replace string to hex ] **********************\n"
    )
    if args.GetArgsValue().replacetohex:
        if args.GetArgsValue().replacetostr or args.GetArgsValue(
        ).replacefilename:
            pass
        else:
            replaceData = Replace()

        replaceDataStrHex = replaceData.StringsToHex(
            outputArg=args.GetArgsValue().output,
            mixerLevelArg=args.GetArgsValue().mixerlevel,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrHex == EXIT_SUCCESS:
            print("\n[+] Obfuscation replace string to hex -> " +
                  SUCESS_COLOUR + "Successful")
        else:
            print("\n[-] Obfuscation replace string to hex -> " +
                  FAILED_COLOUR + "Failed")
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace string to hex ] feature no asked !")

    # -- Remove if python pyc file in output directory -- #
    print(
        SECTION_COLOUR +
        "\n\n*********************** [ Correction remove .pyc file ] *************************\n"
    )
    if removeData:
        pass
    else:
        removeData = Remove()

    removePycData = removeData.TrashFiles(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose,
    )
    if removePycData == EXIT_SUCCESS:
        pass
    else:
        print("\n[-] Remove .pyc file in {0} directory -> ".format(
            args.GetArgsValue().output) + FAILED_COLOUR + "Failed")
        if not args.GetArgsValue().verbose:
            print(
                "\n[!] Retry with [-v, --verbose] parameter for more informations"
            )
def main():
    if sys.version_info[0] != 3:
        print(Colors.ERROR +
              "[-] Intensio-Obfuscator only support Python 3.x" +
              Colors.DISABLE)
        sys.exit(0)

    if sys.platform != "win32" and sys.platform != "linux":
        print(Colors.ERROR + "[-] This tool support [windows - Linux] only !" +
              Colors.DISABLE)
        sys.exit(0)

    args = Args()
    utils = Utils()

    if len(sys.argv) > 1 and len(sys.argv) <= 15:
        pass
    else:
        print(Colors.ERROR + "[-] Incorrect number of arguments" +
              Colors.DISABLE + "\n")
        args.GetArgHelp()
        sys.exit(0)

    if args.GetArgsValue().input:
        if args.GetArgsValue().output:
            if re.match(Reg.detectMlenArg,
                        str(args.GetArgsValue().mixerlength)):
                if re.match(Reg.detectIndentArg,
                            str(args.GetArgsValue().indent)):
                    pass
                else:
                    print("\n" + Colors.ERROR +
                          "[-] -ind, --indent argument [2|4|8] missing" +
                          Colors.DISABLE + "\n")
                    sys.exit(0)
            else:
                print(
                    "\n" + Colors.ERROR +
                    "[-] -mlen, --mixerlength argument [lower|medium|high] missing"
                    + Colors.DISABLE + "\n")
                sys.exit(0)
        else:
            print("\n" + Colors.ERROR +
                  "[-] Output [-o, --output] argument missing" +
                  Colors.DISABLE + "\n")
            sys.exit(0)
    else:
        print("\n" + Colors.ERROR +
              "[-] Input [-i, --input] argument missing" + Colors.DISABLE +
              "\n")
        sys.exit(0)

    for line in INTENSIO_BANNER.split("\n"):
        time.sleep(0.05)
        print(line)

    print("\n\n" + Colors.SECTION + "********************************* [ START ] **********************************" \
        + Colors.DISABLE + "\n")

    # -- Analysis and set up of the work environment -- #
    print("\n\n" + Colors.SECTION + "********************* [ Analyze and setup environment ] **********************" \
        + Colors.DISABLE + "\n")
    analyzeData = Analyze()
    analyseDataInEnv = analyzeData.InputAvailable(
        inputArg=args.GetArgsValue().input,
        verboseArg=args.GetArgsValue().verbose)
    if analyseDataInEnv == 1:
        print("\n[+] Analyze input argument '{}' -> ".format(args.GetArgsValue().input) + Colors.SUCCESS + \
            "Successful" + Colors.DISABLE)
    else:
        print("[-] Analyze input '{}' -> ".format(args.GetArgsValue().input) +
              Colors.ERROR + "failed" + Colors.DISABLE + "\n")
        sys.exit(0)

    analyseDataOutEnv = analyzeData.OutputAvailable(
        inputArg=args.GetArgsValue().input,
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)
    if analyseDataOutEnv == 1:
        print("\n[+] Analyze and setup output argument environment '{}' -> " \
                .format(args.GetArgsValue().output) + Colors.SUCCESS + "Successful" + Colors.DISABLE)
    else:
        print(
            "[-] Analyze output '{}' -> ".format(args.GetArgsValue().output) +
            Colors.ERROR + "failed" + Colors.DISABLE + "\n")
        sys.exit(0)

    # -- Obfuscation process -- #
    startObfuscationTime = time.time()

    print("\n\n" + Colors.SECTION + "********************** [ Obfuscation delete comments ] ***********************" \
     + Colors.DISABLE + "\n")
    deleteData = Delete()
    deleteCommentsData = deleteData.Comments(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)
    if deleteCommentsData == 1:
        print("[+] Obfuscation delete comments -> " + Colors.SUCCESS +
              "Successful" + Colors.DISABLE)
    else:
        print("\n[-] Obfuscation delete comments -> " + Colors.ERROR +
              "Failed" + Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    print("\n\n" + Colors.SECTION + "******************** [ Obfuscation delete line space(s) ] ********************" \
        + Colors.DISABLE + "\n")
    if deleteData:
        pass
    else:
        deleteData = Delete()

    deleteLinesSpacesData = deleteData.LinesSpaces(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)

    if deleteLinesSpacesData == 1:
        print("[+] Obfuscation delete lines spaces -> " + Colors.SUCCESS +
              "Successful" + Colors.DISABLE)
    else:
        print("\n[-] Obfuscation delete lines spaces -> " + Colors.ERROR +
              "Failed" + Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    # -- If empty class (avert to generate an error) -- #
    print("\n\n" + Colors.SECTION + "******************* [ Correction padding empty class(es) ] *******************" \
        + Colors.DISABLE + "\n")
    paddingData = Padding()
    paddingDataEmptyClass = paddingData.EmptyClasses(
        outputArg=args.GetArgsValue().output,
        mixerLengthArg=args.GetArgsValue().mixerlength,
        basicIndentArg=args.GetArgsValue().indent,
        verboseArg=args.GetArgsValue().verbose)
    if paddingDataEmptyClass == 1:
        pass
    else:
        print("\n[-] Padding empty class -> " + Colors.ERROR + "Failed" +
              Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    # -- If empty functions (avert to generate an error) -- #
    print("\n\n" + Colors.SECTION + "****************** [ Correction padding empty function(s) ] ******************" \
        + Colors.DISABLE + "\n")
    if paddingData:
        pass
    else:
        paddingData = Padding()

    paddingDataEmptyFunc = paddingData.EmptyFunctions(
        outputArg=args.GetArgsValue().output,
        mixerLengthArg=args.GetArgsValue().mixerlength,
        basicIndentArg=args.GetArgsValue().indent,
        verboseArg=args.GetArgsValue().verbose)
    if paddingDataEmptyFunc == 1:
        pass
    else:
        print("\n[-] Padding empty function -> " + Colors.ERROR + "Failed" +
              Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    print("\n\n" + Colors.SECTION + "************ [ Obfuscation replace string(s) to string(s) mixed ] ************" \
        + Colors.DISABLE + "\n")
    if args.GetArgsValue().replacetostr:
        replaceData = Replace()

        replaceDataStrStr = replaceData.StringToString(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrStr == 1:
            print("[+] Obfuscation replace string to string mixed -> " +
                  Colors.SUCCESS + "Successful" + Colors.DISABLE)
        else:
            print("\n[-] Obfuscation replace string to string mixed -> " +
                  Colors.ERROR + "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace string to string ] mixed no asked !")

    print("\n\n" + Colors.SECTION + "****************** [ Obfuscation adding padding script(s) ] ******************" \
        + Colors.DISABLE + "\n")
    if args.GetArgsValue().paddingscript:
        if paddingData:
            pass
        else:
            paddingData = Padding()

        paddingDataGarbage = paddingData.AddRandomScripts(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            basicIndentArg=args.GetArgsValue().indent,
            verboseArg=args.GetArgsValue().verbose)
        if paddingDataGarbage == 1:
            print("[+] Obfuscation padding script -> " + Colors.SUCCESS +
                  "Successful" + Colors.DISABLE)
        else:
            print("\n[-] Obfuscation padding script -> " + Colors.ERROR +
                  "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ padding script ] no asked !")

    print("\n\n" + Colors.SECTION + "******************** [ Obfuscation replace file(s) name ] ********************" \
        + Colors.DISABLE + "\n")
    if args.GetArgsValue().replacefilename:
        if args.GetArgsValue().replacetostr:
            pass
        else:
            replaceData = Replace()

        replaceDataStrFname = replaceData.FilesName(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrFname == 1:
            print("\n[+] Obfuscation replace file name -> " + Colors.SUCCESS +
                  "Successful" + Colors.DISABLE)
        else:
            print("\n[-] Obfuscation replace file name -> " + Colors.ERROR +
                  "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace file name ] feature no asked !")

    print("\n\n" + Colors.SECTION + "****************** [ Obfuscation replace string(s) to hex ] ******************" \
        + Colors.DISABLE + "\n")
    if args.GetArgsValue().replacetohex:
        if args.GetArgsValue().replacetostr or args.GetArgsValue(
        ).replacefilename:
            pass
        else:
            replaceData = Replace()

        replaceDataStrHex = replaceData.StringsToHex(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrHex == 1:
            print("\n[+] Obfuscation replace string to hex -> " +
                  Colors.SUCCESS + "Successful" + Colors.DISABLE)
            print("\n[!] care, only works for python 2 files")
        else:
            print("\n[-] Obfuscation replace string to hex -> " +
                  Colors.ERROR + "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace string to hex ] feature no asked !")

    # -- Delete line spaces of padding scripts -- #
    if args.GetArgsValue().paddingscript:
        print("\n\n" + Colors.SECTION + "******************** [ Obfuscation delete line space(s) ] ********************" \
            + Colors.DISABLE + "\n")
        if deleteData:
            pass
        else:
            deleteData = Delete()

        deleteLinesSpacesData = deleteData.LinesSpaces(
            outputArg=args.GetArgsValue().output,
            verboseArg=args.GetArgsValue().verbose)
        if deleteLinesSpacesData == 1:
            print("[+] Obfuscation delete lines spaces of padding scripts-> " +
                  Colors.SUCCESS + "Successful" + Colors.DISABLE)
        else:
            print(
                "\n[-] Obfuscation delete lines spaces of padding scripts -> "
                + Colors.ERROR + "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print("\n[!] Retry with [-v, --verbose] parameter")

    # -- Delete if python pyc file in output directory -- #
    print("\n\n" + Colors.SECTION + "********************* [ Correction delete .pyc file(s) ] *********************" \
        + Colors.DISABLE + "\n")
    if deleteData:
        pass
    else:
        deleteData = Delete()

    deletePycData = deleteData.TrashFiles(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose,
    )
    if deletePycData == 1:
        pass
    else:
        print("\n[-] Delete .pyc file from {} directory -> ".format(args.GetArgsValue().output) + Colors.ERROR + \
            "Failed" + Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print(
                "\n[!] Retry with [-v, --verbose] parameter for more informations"
            )

    print("\n\n" + Colors.SECTION + "********************************** [ END ] ************************************" \
        + Colors.DISABLE + "\n")

    # -- Result of execution time -- #
    endObfuscationTime = time.time()
    executionTime = endObfuscationTime - startObfuscationTime
    executionTime = str(executionTime)
    executionTime = executionTime.split(".")

    print("[*] Obfuscation Time : {} second(s)".format(executionTime[0]))
Exemplo n.º 4
0
def main():
    if sys.version_info[0] != 3:
        print(Colors.ERROR +
              "[-] Intensio-Obfuscator only support Python 3.x" +
              Colors.DISABLE)
        sys.exit(1)

    if sys.platform != "win32" and sys.platform != "linux":
        print(Colors.ERROR + "[-] This tool support [windows - Linux] only !" +
              Colors.DISABLE)
        sys.exit(1)

    args = Args()
    utils = Utils()

    if len(sys.argv) > 1 and len(sys.argv) <= 13:
        pass
    else:
        print(Colors.ERROR + "[-] Incorrect number of arguments\n" +
              Colors.DISABLE)
        args.GetArgHelp()
        sys.exit(1)

    if args.GetArgsValue().input:
        if args.GetArgsValue().output:
            if re.match(r"^lower$|^medium$|^high$",
                        args.GetArgsValue().mixerlength):
                if not args.GetArgsValue().paddingscript and not args.GetArgsValue().replacetostr \
                    and not args.GetArgsValue().replacefilename and not args.GetArgsValue().replacetohex:
                    print(
                        Colors.ERROR +
                        "\n[-] Need at least one argument [-rts] - [-ps] - [-rfn] - [-rth]"
                        + Colors.DISABLE)
                    sys.exit(1)
            else:
                print(
                    Colors.ERROR +
                    "[-] -mlen, --mixerlength argument [lower-medium-high] only supported\n"
                    + Colors.DISABLE)
                sys.exit(1)
        else:
            print(Colors.ERROR +
                  "[-] Output [-o, --output] argument missing\n" +
                  Colors.DISABLE)
            sys.exit(1)
    else:
        print(Colors.ERROR + "[-] Input [-i, --input] argument missing\n" +
              Colors.DISABLE)
        sys.exit(1)

    for line in INTENSIO_BANNER.split("\n"):
        time.sleep(0.05)
        print(line)

    # -- Analysis and set up of the work environment -- #
    print(Colors.SECTION + "\n\n********************* [ Analyze and setup environment ] **********************\n" \
        + Colors.DISABLE)
    analyzeData = Analyze()
    analyseDataInEnv = analyzeData.InputAvailable(
        inputArg=args.GetArgsValue().input,
        verboseArg=args.GetArgsValue().verbose)
    if analyseDataInEnv == 0:
        print("\n[+] Analyze input argument '{}' -> ".format(args.GetArgsValue().input) + Colors.SUCCESS + \
            "Successful" + Colors.DISABLE)
    else:
        print("[-] Analyze input '{}' -> ".format(args.GetArgsValue().input) +
              Colors.ERROR + "failed\n" + Colors.DISABLE)
        sys.exit(1)

    analyseDataOutEnv = analyzeData.OutputAvailable(
        inputArg=args.GetArgsValue().input,
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)
    if analyseDataOutEnv == 0:
        print("\n[+] Analyze and setup output argument environment '{}' -> " \
                .format(args.GetArgsValue().output) + Colors.SUCCESS + "Successful" + Colors.DISABLE)
    else:
        print(
            "[-] Analyze output '{}' -> ".format(args.GetArgsValue().output) +
            Colors.ERROR + "failed\n" + Colors.DISABLE)
        sys.exit(1)

    # -- Obfuscation process -- #
    print(
        Colors.SECTION +
        "\n\n********************** [ Obfuscation delete comments ] ***********************\n"
        + Colors.DISABLE)
    deleteData = Delete()
    deleteCommentsData = deleteData.Comments(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)
    if deleteCommentsData == 0:
        print("[+] Obfuscation delete comments -> " + Colors.SUCCESS +
              "Successful" + Colors.DISABLE)
    else:
        print("\n[-] Obfuscation delete comments -> " + Colors.ERROR +
              "Failed" + Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    print(
        Colors.SECTION +
        "\n\n******************** [ Obfuscation delete line space(s) ] ********************\n"
        + Colors.DISABLE)
    if deleteData:
        pass
    else:
        deleteData = Delete()

    deleteLinesSpacesData = deleteData.LinesSpaces(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose)

    if deleteLinesSpacesData == 0:
        print("[+] Obfuscation delete lines spaces -> " + Colors.SUCCESS +
              "Successful" + Colors.DISABLE)
    else:
        print("\n[-] Obfuscation delete lines spaces -> " + Colors.ERROR +
              "Failed" + Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    # -- If empty class (avert to generate an error) -- #
    print(
        Colors.SECTION +
        "\n\n******************* [ Correction padding empty class(es) ] *******************\n"
        + Colors.DISABLE)
    paddingData = Padding()
    paddingDataEmptyClass = paddingData.EmptyClasses(
        outputArg=args.GetArgsValue().output,
        mixerLengthArg=args.GetArgsValue().mixerlength,
        verboseArg=args.GetArgsValue().verbose)
    if paddingDataEmptyClass == 0:
        pass
    else:
        print("\n[-] Padding empty class -> " + Colors.ERROR + "Failed" +
              Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    # -- If empty functions (avert to generate an error) -- #
    print(
        Colors.SECTION +
        "\n\n****************** [ Correction padding empty function(s) ] ******************\n"
        + Colors.DISABLE)
    if paddingData:
        pass
    else:
        paddingData = Padding()

    paddingDataEmptyFunc = paddingData.EmptyFunctions(
        outputArg=args.GetArgsValue().output,
        mixerLengthArg=args.GetArgsValue().mixerlength,
        verboseArg=args.GetArgsValue().verbose)
    if paddingDataEmptyFunc == 0:
        pass
    else:
        print("\n[-] Padding empty function -> " + Colors.ERROR + "Failed" +
              Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print("\n[!] Retry with [-v, --verbose] parameter")

    print(
        Colors.SECTION +
        "\n\n************ [ Obfuscation replace string(s) to string(s) mixed ] ************\n"
        + Colors.DISABLE)
    if args.GetArgsValue().replacetostr:
        replaceData = Replace()

        replaceDataStrStr = replaceData.StringToString(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrStr == 0:
            print("[+] Obfuscation replace string to string mixed -> " +
                  Colors.SUCCESS + "Successful" + Colors.DISABLE)
        else:
            print("\n[-] Obfuscation replace string to string mixed -> " +
                  Colors.ERROR + "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace string to string ] mixed no asked !")

    print(
        Colors.SECTION +
        "\n\n****************** [ Obfuscation adding padding script(s) ] ******************\n"
        + Colors.DISABLE)
    if args.GetArgsValue().paddingscript:
        if paddingData:
            pass
        else:
            paddingData = Padding()

        paddingDataGarbage = paddingData.AddRandomScripts(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            verboseArg=args.GetArgsValue().verbose)
        if paddingDataGarbage == 0:
            print("[+] Obfuscation padding script -> " + Colors.SUCCESS +
                  "Successful" + Colors.DISABLE)
        else:
            print("\n[-] Obfuscation padding script -> " + Colors.ERROR +
                  "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ padding script ] no asked !")

    print(
        Colors.SECTION +
        "\n\n******************** [ Obfuscation replace file(s) name ] ********************\n"
        + Colors.DISABLE)
    if args.GetArgsValue().replacefilename:
        if args.GetArgsValue().replacetostr:
            pass
        else:
            replaceData = Replace()

        replaceDataStrFname = replaceData.FilesName(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrFname == 0:
            print("\n[+] Obfuscation replace file name -> " + Colors.SUCCESS +
                  "Successful" + Colors.DISABLE)
        else:
            print("\n[-] Obfuscation replace file name -> " + Colors.ERROR +
                  "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace file name ] feature no asked !")

    print(
        Colors.SECTION +
        "\n\n****************** [ Obfuscation replace string(s) to hex ] ******************\n"
        + Colors.DISABLE)
    if args.GetArgsValue().replacetohex:
        if args.GetArgsValue().replacetostr or args.GetArgsValue(
        ).replacefilename:
            pass
        else:
            replaceData = Replace()

        replaceDataStrHex = replaceData.StringsToHex(
            outputArg=args.GetArgsValue().output,
            mixerLengthArg=args.GetArgsValue().mixerlength,
            verboseArg=args.GetArgsValue().verbose)
        if replaceDataStrHex == 0:
            print("\n[+] Obfuscation replace string to hex -> " +
                  Colors.SUCCESS + "Successful" + Colors.DISABLE)
        else:
            print("\n[-] Obfuscation replace string to hex -> " +
                  Colors.ERROR + "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print(
                    "\n[!] Retry with [-v, --verbose] parameter for more informations"
                )
    else:
        print("[!] Obfuscation [ replace string to hex ] feature no asked !")

    # -- Delete line spaces of padding scripts -- #
    if args.GetArgsValue().paddingscript:
        print(
            Colors.SECTION +
            "\n\n******************** [ Obfuscation delete line space(s) ] ********************\n"
            + Colors.DISABLE)
        if deleteData:
            pass
        else:
            deleteData = Delete()

        deleteLinesSpacesData = deleteData.LinesSpaces(
            outputArg=args.GetArgsValue().output,
            verboseArg=args.GetArgsValue().verbose)
        if deleteLinesSpacesData == 0:
            print("[+] Obfuscation delete lines spaces of padding scripts-> " +
                  Colors.SUCCESS + "Successful" + Colors.DISABLE)
        else:
            print(
                "\n[-] Obfuscation delete lines spaces of padding scripts -> "
                + Colors.ERROR + "Failed" + Colors.DISABLE)
            if not args.GetArgsValue().verbose:
                print("\n[!] Retry with [-v, --verbose] parameter")

    # -- Delete if python pyc file in output directory -- #
    print(
        Colors.SECTION +
        "\n\n********************* [ Correction delete .pyc file(s) ] *********************\n"
        + Colors.DISABLE)
    if deleteData:
        pass
    else:
        deleteData = Delete()

    deletePycData = deleteData.TrashFiles(
        outputArg=args.GetArgsValue().output,
        verboseArg=args.GetArgsValue().verbose,
    )
    if deletePycData == 0:
        pass
    else:
        print("\n[-] Delete .pyc file from {} directory -> ".format(args.GetArgsValue().output) + Colors.ERROR + \
            "Failed" + Colors.DISABLE)
        if not args.GetArgsValue().verbose:
            print(
                "\n[!] Retry with [-v, --verbose] parameter for more informations"
            )
def main():
    if sys.version_info[0] != 3:
        print(ERROR_COLOUR + "[-] Intensio-Obfuscator only support Python 3.x")
        sys.exit(0)

    if sys.platform != "win32" and sys.platform != "linux":
        print(ERROR_COLOUR + "[-] This tool support [windows - Linux] only !")
        sys.exit(0)

    try:
        from core.utils.intensio_design import INTENSIO_BANNER
        from core.utils.intensio_utils import Utils
        from core.utils.intensio_usage import Args
        from core.utils.intensio_error  import EXIT_SUCCESS, ERROR_BAD_ENVIRONMENT, ERROR_INVALID_PARAMETER, \
                                                ERROR_BAD_ARGUMENTS, ERROR_INVALID_FUNCTION, ERROR_FILE_NOT_FOUND
        from core.obfuscation.intensio_replace import Replace
        from core.obfuscation.intensio_padding import Padding
        from core.obfuscation.intensio_analyze import Analyze
        from core.obfuscation.intensio_remove import Remove
    except ImportError as e:
        print(ERROR_COLOUR + "[-] {0}\n".format(e))
        sys.exit(0)

    args = Args()
    utils = Utils()

    if len(sys.argv) > 1 and len(sys.argv) <= 16:
        pass
    else:
        print(ERROR_COLOUR + "[-] Incorrect number of arguments\n")
        args.GetArgHelp()
        sys.exit(ERROR_BAD_ARGUMENTS)

    if args.GetArgsValue().input:
        if args.GetArgsValue().output:
            if args.GetArgsValue().code:
                if args.GetArgsValue().code == "python":
                    if args.GetArgsValue().mixerlevel:
                        if re.match(r"^lower$|^medium$|^high$",
                                    args.GetArgsValue().mixerlevel):
                            if not args.GetArgsValue().paddingscripts and not args.GetArgsValue().replacetostr \
                                and not args.GetArgsValue().removecommentaries and not args.GetArgsValue().removeprint \
                                and not args.GetArgsValue().replacetohex and not args.GetArgsValue().replacefilesname:
                                print(
                                    ERROR_COLOUR +
                                    "\n[-] Need at least one argument [-rts --replacetostr] or [-ps --paddingscripts] \
                                    or [-rc --removecommentaries] or [-rp --removeprint] or [-rth --replacetohex] or [-rfn, --replacefilesname]"
                                )
                                sys.exit(ERROR_BAD_ARGUMENTS)
                        else:
                            print(
                                ERROR_COLOUR +
                                "[-] Incorrect level of mixerlevel, [lower - medium - high] only supported\n"
                            )
                            sys.exit(ERROR_INVALID_PARAMETER)
                    else:
                        print(
                            ERROR_COLOUR +
                            "[-] Mixerlevel [-m --mixerlevel] argument missing\n"
                        )
                        sys.exit(ERROR_BAD_ARGUMENTS)
                else:
                    print(
                        ERROR_COLOUR +
                        "[-] '{0}' Incorrect code argument, [python] only supported\n"
                        .format(args.GetArgsValue().Code))
                    sys.exit(ERROR_INVALID_PARAMETER)
            else:
                print(ERROR_COLOUR + "[-] Code [-c --code] argument missing\n")
                sys.exit(ERROR_BAD_ARGUMENTS)
        else:
            print(ERROR_COLOUR + "[-] Output [-o --output] argument missing\n")
            sys.exit(ERROR_BAD_ARGUMENTS)
    else:
        print(ERROR_COLOUR + "[-] Input [-i --input] argument missing\n")
        sys.exit(ERROR_BAD_ARGUMENTS)

    for line in INTENSIO_BANNER.split("\n"):
        time.sleep(0.05)
        print(BANNER_COLOUR + line)

    # -- Analysis and set up of the work environment -- #
    print(
        SECTION_COLOUR +
        "\n\n*********************** [ Analyze and setup environment ] ************************\n"
    )
    analyzeData = Analyze()

    if (analyzeData.InputAvailable(
            args.GetArgsValue().input,
            args.GetArgsValue().code,
            args.GetArgsValue().verbose) == EXIT_SUCCESS):
        print("\n[+] Analyze input argument '{0}' -> ".format(
            args.GetArgsValue().input) + SUCESS_COLOUR + "Successful")
    else:
        print("[-] Analyze input '{0}' -> ".format(args.GetArgsValue().input) +
              FAILED_COLOUR + "failed\n")
        sys.exit(ERROR_INVALID_FUNCTION)

    if (analyzeData.OutputAvailable(
            args.GetArgsValue().input,
            args.GetArgsValue().code,
            args.GetArgsValue().output,
            args.GetArgsValue().verbose) == EXIT_SUCCESS):
        print("\n[+] Analyze and setup output argument environment '{0}' -> ".
              format(args.GetArgsValue().output) + SUCESS_COLOUR +
              "Successful")
    else:
        print(
            "[-] Analyze output '{0}' -> ".format(args.GetArgsValue().output) +
            FAILED_COLOUR + "failed\n")
        sys.exit(ERROR_INVALID_FUNCTION)

    # -- Obfuscation process -- #
    print(
        SECTION_COLOUR +
        "\n\n********************** [ Obfuscation remove commentaries ] **********************\n"
    )
    if args.GetArgsValue().removecommentaries:
        removeData = Remove()

        if (removeData.Commentaries(
                args.GetArgsValue().code,
                args.GetArgsValue().output) == EXIT_SUCCESS):
            print("[+] Obfuscation remove commentaries -> " + SUCESS_COLOUR +
                  "Successful")
        else:
            print("\n[-] Obfuscation remove commentaries -> " + FAILED_COLOUR +
                  "Failed")
    else:
        print("[!] Obfuscation remove commentaries no asked !")

    print(
        SECTION_COLOUR +
        "\n\n*************** [ Obfuscation replace strings to strings mixed ] ****************\n"
    )
    if args.GetArgsValue().replacetostr:
        replaceData = Replace()

        if (replaceData.StringsToStrings(
                args.GetArgsValue().code,
                args.GetArgsValue().output,
                args.GetArgsValue().mixerlevel,
                args.GetArgsValue().verbose) == EXIT_SUCCESS):
            print("[+] Obfuscation replace strings to strings mixed -> " +
                  SUCESS_COLOUR + "Successful")
        else:
            print("\n[-] Obfuscation replace strings to strings mixed -> " +
                  FAILED_COLOUR + "Failed")
    else:
        print("[!] Obfuscation replace strings to strings mixed no asked !")

    print(
        SECTION_COLOUR +
        "\n\n************************ [ Obfuscation padding scripts ] ************************\n"
    )
    if args.GetArgsValue().paddingscripts:
        paddingData = Padding()

        if (paddingData.AddRandomScripts(
                args.GetArgsValue().code,
                args.GetArgsValue().output,
                args.GetArgsValue().mixerlevel) == EXIT_SUCCESS):
            print("[+] Obfuscation padding random scripts -> " +
                  SUCESS_COLOUR + "Successful")
        else:
            print("\n[-] Obfuscation padding random scripts -> " +
                  FAILED_COLOUR + "Failed")
    else:
        print("[!] Obfuscation add random scripts no asked !")

    print(
        SECTION_COLOUR +
        "\n\n************************* [ Obfuscation remove print ] **************************\n"
    )
    if args.GetArgsValue().removeprint:

        if (removeData.PrintFunctions(
                args.GetArgsValue().code,
                args.GetArgsValue().output) == EXIT_SUCCESS):
            print("[+] Obfuscation remove print functions -> " +
                  SUCESS_COLOUR + "Successful")
        else:
            print("\n[-] Obfuscation remove print functions -> " +
                  FAILED_COLOUR + "Failed")
    else:
        print("[!] Obfuscation remove print functions no asked !")

    print(
        SECTION_COLOUR +
        "\n\n********************** [ Obfuscation replace files name ] ***********************\n"
    )
    if args.GetArgsValue().replacefilesname:
        if args.GetArgsValue().replacetostr:
            pass
        else:
            replaceData = Replace()

        if (replaceData.FilesName(
                args.GetArgsValue().code,
                args.GetArgsValue().output,
                args.GetArgsValue().mixerlevel,
                args.GetArgsValue().verbose) == EXIT_SUCCESS):
            print("\n[+] Obfuscation replace files name -> " + SUCESS_COLOUR +
                  "Successful")
        else:
            print("\n[-] Obfuscation replace files name -> " + FAILED_COLOUR +
                  "Failed")
    else:
        print("[!] Obfuscation replace files name no asked !")

    print(
        SECTION_COLOUR +
        "\n\n******************** [ Obfuscation replace strings to hex ] *********************\n"
    )
    if args.GetArgsValue().replacetohex:
        if args.GetArgsValue().replacetostr or args.GetArgsValue(
        ).replacefilesname:
            pass
        else:
            replaceData = Replace()

        if (replaceData.StringsToHex(
                args.GetArgsValue().code,
                args.GetArgsValue().output,
                args.GetArgsValue().mixerlevel) == EXIT_SUCCESS):
            print("\n[+] Obfuscation replace strings to hex -> " +
                  SUCESS_COLOUR + "Successful\n")
        else:
            print("\n[-] Obfuscation replace strings to hex -> " +
                  FAILED_COLOUR + "Failed\n")
    else:
        print("[!] Obfuscation replace strings to hex no asked !\n")

    # -- Remove if python pyc file(s) in output directory -- #
    if (removeData.TrashFiles(args.GetArgsValue().code,
                              args.GetArgsValue().output) >= 0):
        pass
    else:
        print(
            SECTION_COLOUR +
            "\n**************************** [ Remove pyc files ] *****************************\n"
        )
        print("\n[-] Remove .pyc files in {0} directory -> " + FAILED_COLOUR +
              "Failed\n".format(args.GetArgsValue().output))